Skip to content

Commit 0d82adc

Browse files
committed
Fix conflicting raftable header names. Remove raftable.o from Makefile.
1 parent 86ef2cd commit 0d82adc

File tree

4 files changed

+32
-10
lines changed

4 files changed

+32
-10
lines changed

contrib/mmts/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
MODULE_big = multimaster
2-
OBJS = multimaster.o raftable.o arbiter.o bytebuf.o bgwpool.o pglogical_output.o pglogical_proto.o pglogical_receiver.o pglogical_apply.o pglogical_hooks.o pglogical_config.o ddd.o bkb.o
2+
OBJS = multimaster.o arbiter.o bytebuf.o bgwpool.o pglogical_output.o pglogical_proto.o pglogical_receiver.o pglogical_apply.o pglogical_hooks.o pglogical_config.o ddd.o bkb.o
33

44
override CPPFLAGS += -I../raftable
55

contrib/mmts/multimaster.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@
5555
#include "catalog/indexing.h"
5656
#include "pglogical_output/hooks.h"
5757

58-
#include "raftable.h"
5958
#include "multimaster.h"
6059
#include "ddd.h"
60+
#include "raftable_wrapper.h"
6161
#include "raftable.h"
6262

6363
typedef struct {
@@ -2372,3 +2372,24 @@ MtmDetectGlobalDeadLock(PGPROC* proc)
23722372
}
23732373
return hasDeadlock;
23742374
}
2375+
2376+
void* RaftableGet(char const* key, int* size, RaftableTimestamp* ts, bool nowait)
2377+
{
2378+
size_t s;
2379+
char *value;
2380+
Assert(ts == NULL); /* not implemented */
2381+
value = raftable_get(key, &s);
2382+
*size = s;
2383+
return value;
2384+
}
2385+
2386+
void RaftableSet(char const* key, void const* value, int size, bool nowait)
2387+
{
2388+
raftable_set(key, value, size, nowait ? 0 : -1);
2389+
}
2390+
2391+
bool RaftableCAS(char const* key, char const* value, bool nowait)
2392+
{
2393+
Assert(false); /* not implemented */
2394+
return false;
2395+
}

contrib/mmts/raftable.h renamed to contrib/mmts/raftable_wrapper.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef __RAFTABLE_H__
2-
#define __RAFTABLE_H__
1+
#ifndef __RAFTABLE_WRAPPER_H__
2+
#define __RAFTABLE_WRAPPER_H__
33

44
typedef struct RaftableTimestamp {
55
time_t time; /* local time at master */

contrib/raftable/state.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,17 @@ typedef struct State {
1818

1919
static char *state_get_string(StateP state, RaftableEntry *e, size_t *len)
2020
{
21-
size_t checklen;
21+
size_t actlen;
2222
char *s;
2323
Assert(state);
2424
Assert(LWLockHeldByMe(state->lock));
2525

26-
*len = blockmem_len(state->blockmem, e->block);
27-
Assert(len > 0);
28-
s = palloc(*len);
29-
checklen = blockmem_get(state->blockmem, e->block, s, *len);
30-
Assert(*len == checklen);
26+
actlen = blockmem_len(state->blockmem, e->block);
27+
if (len) *len = actlen;
28+
Assert(actlen > 0);
29+
s = palloc(actlen);
30+
actlen -= blockmem_get(state->blockmem, e->block, s, actlen);
31+
Assert(actlen == 0);
3132

3233
return s;
3334
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy