Skip to content

Commit 793fb60

Browse files
committed
[lsm] add InitLsmLogBlocks
1 parent 1a237ae commit 793fb60

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

src/backend/storage/lsm/Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#-------------------------------------------------------------------------
2+
#
3+
# Makefile--
4+
# Makefile for storage/lsm
5+
#
6+
# IDENTIFICATION
7+
# src/backend/storage/lsm/Makefile
8+
#
9+
#-------------------------------------------------------------------------
10+
11+
subdir = src/backend/storage/lsm
12+
top_builddir = ../../../..
13+
include $(top_builddir)/src/Makefile.global
14+
15+
OBJS = \
16+
lsm.o
17+
18+
include $(top_srcdir)/src/backend/common.mk

src/backend/storage/lsm/lsm.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* lsm.c
4+
* Log structure merge (LSM) tree methods
5+
*
6+
* IDENTIFICATION
7+
* src/backend/storage/buffer/lsm.c
8+
*
9+
*-------------------------------------------------------------------------
10+
*/
11+
#include "postgres.h"
12+
13+
#include "storage/lsm.h"
14+
#include "storage/shmem.h"
15+
16+
char *LsmLogBlocks;
17+
18+
/*
19+
* Initialize LSM log blocks
20+
*/
21+
void
22+
InitLsmLogBlocks(void)
23+
{
24+
bool foundBufs;
25+
LsmLogBlocks = (char *)
26+
ShmemInitStruct("LSM Log Blocks",
27+
NBuffers * (Size) LSM_LOG_BLOCKSZ, &foundBufs);
28+
}

src/include/storage/lsm.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
#include "c.h"
1212

13+
extern PGDLLIMPORT int NBuffers;
14+
1315
/*
1416
* The log file contents are a sequence of 32KB blocks.
1517
* The only exception is that the tail of the file may contain a partial block.
@@ -39,3 +41,8 @@ typedef struct
3941
} LsmLogRecord;
4042

4143
#endif /* LSM_H */
44+
45+
/*
46+
* prototypes for functions in lsm.c
47+
*/
48+
extern void InitLsmLogBlocks(void);

0 commit comments

Comments
 (0)