File tree Expand file tree Collapse file tree 6 files changed +9
-32
lines changed Expand file tree Collapse file tree 6 files changed +9
-32
lines changed Original file line number Diff line number Diff line change 1
1
MODULE_big = raftable
2
- OBJS = raftable.o worker.o state.o blockmem.o
2
+ OBJS = raftable.o worker.o state.o blockmem.o raft/obj/raft.o raft/obj/util.o
3
3
EXTENSION = raftable
4
4
DATA = raftable--1.0.sql
5
5
6
- raftable.so : raft/lib/libraft.a
6
+ .PHONY : all
7
7
8
- raft/lib/libraft.a :
9
- make -C raft
8
+ all : raftable.so
9
+
10
+ raft/obj/raft.o raft/obj/util.o :
11
+ make -C raft obj/raft.o obj/util.o
10
12
11
13
EXTRA_INSTALL = contrib/raftable
12
14
13
- RAFT_PREFIX = raft
14
- override LDFLAGS += -L$(RAFT_PREFIX ) /lib -Wl,-whole-archive -lraft -Wl,-no-whole-archive
15
- override CFLAGS += -Wfatal-errors
16
- override CPPFLAGS += -I$(RAFT_PREFIX ) /include
15
+ override CFLAGS += -Wfatal-errors -Wall
16
+ override CPPFLAGS += -Iraft/include
17
17
18
18
ifdef USE_PGXS
19
19
PG_CONFIG = pg_config
Original file line number Diff line number Diff line change @@ -4,12 +4,6 @@ Raftable
4
4
This extension allows you to have a key-value table replicated between several
5
5
Postgres instances over Raft protocol.
6
6
7
- Depends on
8
- ----------
9
-
10
- Raft implementation in C: https://github.com/kvap/raft
11
- Please compile the raft library with -fpic flag.
12
-
13
7
Internals
14
8
---------
15
9
Original file line number Diff line number Diff line change @@ -32,8 +32,6 @@ typedef struct block_t
32
32
int
33
33
blockmem_format (void * origin , size_t size )
34
34
{
35
- block_t * block ;
36
- meta_t * meta ;
37
35
int id ;
38
36
int blocks = (size - 1 ) / BLOCK_LEN ;
39
37
if (blocks <= 0 ) return 0 ;
Original file line number Diff line number Diff line change @@ -160,7 +160,6 @@ char *raftable_get(const char *key, size_t *len)
160
160
Datum
161
161
raftable_sql_get (PG_FUNCTION_ARGS )
162
162
{
163
- RaftableEntry * e ;
164
163
RaftableKey key ;
165
164
size_t len ;
166
165
text_to_cstring_buffer (PG_GETARG_TEXT_P (0 ), key .data , sizeof (key .data ));
@@ -178,16 +177,6 @@ raftable_sql_get(PG_FUNCTION_ARGS)
178
177
PG_RETURN_NULL ();
179
178
}
180
179
181
- static void start_timer (TimestampTz * timer )
182
- {
183
- * timer -= GetCurrentTimestamp ();
184
- }
185
-
186
- static void stop_timer (TimestampTz * timer )
187
- {
188
- * timer += GetCurrentTimestamp ();
189
- }
190
-
191
180
static long msec (TimestampTz timer )
192
181
{
193
182
long sec ;
Original file line number Diff line number Diff line change @@ -264,7 +264,6 @@ StateP state_shmem_init()
264
264
info .keysize = sizeof (RaftableKey );
265
265
info .entrysize = sizeof (RaftableEntry );
266
266
bool found ;
267
- int i ;
268
267
269
268
state = ShmemInitStruct (
270
269
"raftable_state" ,
Original file line number Diff line number Diff line change @@ -131,7 +131,6 @@ static bool add_socket(int sock)
131
131
static bool add_client (int sock )
132
132
{
133
133
int i ;
134
- Client * c = server .clients ;
135
134
136
135
if (server .clientnum >= MAX_CLIENTS )
137
136
{
@@ -165,7 +164,6 @@ static bool remove_socket(int sock)
165
164
166
165
static bool remove_client (Client * c )
167
166
{
168
- int i = 0 ;
169
167
int sock = c -> sock ;
170
168
Assert (sock >= 0 );
171
169
c -> sock = -1 ;
@@ -309,7 +307,7 @@ static void attend(Client *c)
309
307
}
310
308
}
311
309
312
- static bool notify (void )
310
+ static void notify (void )
313
311
{
314
312
int i = 0 ;
315
313
for (i = 0 ; i < MAX_CLIENTS ; i ++ )
@@ -343,7 +341,6 @@ static void drop_bads(void)
343
341
344
342
static bool tick (int timeout_ms )
345
343
{
346
- int i ;
347
344
int numready ;
348
345
bool raft_ready = false;
349
346
You can’t perform that action at this time.
0 commit comments