Skip to content

Commit 9b0e4c8

Browse files
committed
Fix some warnings in raftable. Link raft as .o files instead of .a.
1 parent dae55b4 commit 9b0e4c8

File tree

6 files changed

+9
-32
lines changed

6 files changed

+9
-32
lines changed

contrib/raftable/Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
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
33
EXTENSION = raftable
44
DATA = 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

1113
EXTRA_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

1818
ifdef USE_PGXS
1919
PG_CONFIG = pg_config

contrib/raftable/README

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ Raftable
44
This extension allows you to have a key-value table replicated between several
55
Postgres 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-
137
Internals
148
---------
159

contrib/raftable/blockmem.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ typedef struct block_t
3232
int
3333
blockmem_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;

contrib/raftable/raftable.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ char *raftable_get(const char *key, size_t *len)
160160
Datum
161161
raftable_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-
191180
static long msec(TimestampTz timer)
192181
{
193182
long sec;

contrib/raftable/state.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff 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",

contrib/raftable/worker.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ static bool add_socket(int sock)
131131
static 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

166165
static 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

344342
static bool tick(int timeout_ms)
345343
{
346-
int i;
347344
int numready;
348345
bool raft_ready = false;
349346

0 commit comments

Comments
 (0)