Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit acb39af

Browse files
committed
multidb refactor: change ddd to be a separate file with it own private data structures
1 parent dd77982 commit acb39af

14 files changed

+517
-338
lines changed

multimaster--1.0.sql

-4
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,6 @@ CREATE FUNCTION mtm.check_deadlock(xid bigint) RETURNS boolean
168168
AS 'MODULE_PATHNAME','mtm_check_deadlock'
169169
LANGUAGE C;
170170

171-
CREATE FUNCTION mtm.referee_poll(xid bigint) RETURNS bigint
172-
AS 'MODULE_PATHNAME','mtm_referee_poll'
173-
LANGUAGE C;
174-
175171
CREATE TABLE IF NOT EXISTS mtm.local_tables(rel_schema name, rel_name name, primary key(rel_schema, rel_name));
176172

177173
CREATE TABLE mtm.referee_decision(key text primary key not null, node_id int);

src/bgwpool.c

+6-5
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111
#include "datatype/timestamp.h"
1212
#include "utils/portal.h"
1313
#include "tcop/pquery.h"
14+
#include "utils/guc.h"
1415

1516
#include "bgwpool.h"
16-
#include "multimaster.h"
17-
#include "utils/guc.h"
17+
#include "mm.h"
18+
#include "logger.h"
1819

1920
bool MtmIsLogicalReceiver;
2021
int MtmMaxWorkers;
@@ -26,7 +27,6 @@ void BgwPoolDynamicWorkerMainLoop(Datum arg);
2627

2728
static void BgwShutdownWorker(int sig)
2829
{
29-
MTM_LOG1("Background worker %d received shutdown request", MyProcPid);
3030
if (MtmPool) {
3131
BgwPoolStop(MtmPool);
3232
}
@@ -38,12 +38,13 @@ static void BgwPoolMainLoop(BgwPool* pool)
3838
void* work;
3939
static PortalData fakePortal;
4040

41-
MTM_ELOG(LOG, "Start background worker %d, shutdown=%d", MyProcPid, pool->shutdown);
41+
mtm_log(BgwPoolEvent, "Start background worker %d, shutdown=%d", MyProcPid, pool->shutdown);
4242

4343
MtmBackgroundWorker = true;
4444
MtmIsLogicalReceiver = true;
4545
MtmPool = pool;
4646

47+
// XXX: fix that
4748
pqsignal(SIGINT, BgwShutdownWorker);
4849
pqsignal(SIGQUIT, BgwShutdownWorker);
4950
pqsignal(SIGTERM, BgwShutdownWorker);
@@ -100,7 +101,7 @@ static void BgwPoolMainLoop(BgwPool* pool)
100101
SpinLockRelease(&pool->lock);
101102
}
102103
SpinLockRelease(&pool->lock);
103-
MTM_ELOG(LOG, "Shutdown background worker %d", MyProcPid);
104+
mtm_log(BgwPoolEvent, "Shutdown background worker %d", MyProcPid);
104105
}
105106

106107
void BgwPoolInit(BgwPool* pool, BgwPoolExecutor executor, char const* dbname, char const* dbuser, size_t queueSize, size_t nWorkers)

src/bkb.c

+20
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,23 @@ nodemask_t MtmFindMaxClique(nodemask_t* graph, int n_nodes, int* clique_size)
119119
*clique_size = result.size;
120120
return mask;
121121
}
122+
123+
#ifdef TEST
124+
#include <stdio.h>
125+
#include <stdint.h>
126+
#include "bkb.h"
127+
128+
int main()
129+
{
130+
nodemask_t matrix[64] = {0};
131+
nodemask_t clique;
132+
int clique_size;
133+
matrix[0] = 6;
134+
matrix[1] = 4;
135+
matrix[2] = 1;
136+
matrix[4] = 3;
137+
clique = MtmFindMaxClique(matrix, 64, &clique_size);
138+
printf("Clique=%llx\n", clique);
139+
return 0;
140+
}
141+
#endif

src/bkbtest.c

-17
This file was deleted.

0 commit comments

Comments
 (0)