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 11MODULE_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
33EXTENSION = raftable
44DATA = raftable--1.0.sql
55
6- raftable.so : raft/lib/libraft.a
6+ .PHONY : all
77
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
1012
1113EXTRA_INSTALL = contrib/raftable
1214
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
1717
1818ifdef USE_PGXS
1919PG_CONFIG = pg_config
Original file line number Diff line number Diff line change @@ -4,12 +4,6 @@ Raftable
44This extension allows you to have a key-value table replicated between several
55Postgres instances over Raft protocol.
66
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-
137Internals
148---------
159
Original file line number Diff line number Diff line change @@ -32,8 +32,6 @@ typedef struct block_t
3232int
3333blockmem_format (void * origin , size_t size )
3434{
35- block_t * block ;
36- meta_t * meta ;
3735 int id ;
3836 int blocks = (size - 1 ) / BLOCK_LEN ;
3937 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)
160160Datum
161161raftable_sql_get (PG_FUNCTION_ARGS )
162162{
163- RaftableEntry * e ;
164163 RaftableKey key ;
165164 size_t len ;
166165 text_to_cstring_buffer (PG_GETARG_TEXT_P (0 ), key .data , sizeof (key .data ));
@@ -178,16 +177,6 @@ raftable_sql_get(PG_FUNCTION_ARGS)
178177 PG_RETURN_NULL ();
179178}
180179
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-
191180static long msec (TimestampTz timer )
192181{
193182 long sec ;
Original file line number Diff line number Diff line change @@ -264,7 +264,6 @@ StateP state_shmem_init()
264264 info .keysize = sizeof (RaftableKey );
265265 info .entrysize = sizeof (RaftableEntry );
266266 bool found ;
267- int i ;
268267
269268 state = ShmemInitStruct (
270269 "raftable_state" ,
Original file line number Diff line number Diff line change @@ -131,7 +131,6 @@ static bool add_socket(int sock)
131131static bool add_client (int sock )
132132{
133133 int i ;
134- Client * c = server .clients ;
135134
136135 if (server .clientnum >= MAX_CLIENTS )
137136 {
@@ -165,7 +164,6 @@ static bool remove_socket(int sock)
165164
166165static bool remove_client (Client * c )
167166{
168- int i = 0 ;
169167 int sock = c -> sock ;
170168 Assert (sock >= 0 );
171169 c -> sock = -1 ;
@@ -309,7 +307,7 @@ static void attend(Client *c)
309307 }
310308}
311309
312- static bool notify (void )
310+ static void notify (void )
313311{
314312 int i = 0 ;
315313 for (i = 0 ; i < MAX_CLIENTS ; i ++ )
@@ -343,7 +341,6 @@ static void drop_bads(void)
343341
344342static bool tick (int timeout_ms )
345343{
346- int i ;
347344 int numready ;
348345 bool raft_ready = false;
349346
You can’t perform that action at this time.
0 commit comments