mirror of https://github.com/citusdata/citus.git
Fix nits
parent
b6662ff872
commit
ea9eb103e0
|
@ -3,8 +3,7 @@
|
|||
* shardsplit_decoder.c
|
||||
* Logical Replication output plugin
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* src/backend/distributed/shardsplit/shardsplit_decoder.c
|
||||
* Copyright (c) Citus Data, Inc.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -80,6 +79,8 @@ split_change_cb(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
|
|||
return;
|
||||
}
|
||||
|
||||
char *replicationSlotName = ctx->slot->data.name.data;
|
||||
|
||||
/*
|
||||
* Initialize SourceToDestinationShardMap if not already initialized.
|
||||
* This gets initialized during the replication of first message.
|
||||
|
@ -87,11 +88,10 @@ split_change_cb(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
|
|||
if (SourceToDestinationShardMap == NULL)
|
||||
{
|
||||
SourceToDestinationShardMap = PopulateSourceToDestinationShardMapForSlot(
|
||||
ctx->slot->data.name.data);
|
||||
replicationSlotName, TopMemoryContext);
|
||||
}
|
||||
|
||||
Oid targetRelationOid = InvalidOid;
|
||||
char *replicationSlotName = ctx->slot->data.name.data;
|
||||
switch (change->action)
|
||||
{
|
||||
case REORDER_BUFFER_CHANGE_INSERT:
|
||||
|
|
|
@ -236,7 +236,7 @@ ShardSplitShmemInit(void)
|
|||
|
||||
if (!alreadyInitialized)
|
||||
{
|
||||
char *trancheName = "Split_Shard_Setup_Tranche";
|
||||
char *trancheName = "Split Shard Setup Tranche";
|
||||
|
||||
NamedLWLockTranche *namedLockTranche =
|
||||
&smData->namedLockTranche;
|
||||
|
@ -341,20 +341,20 @@ GetShardSplitSharedMemoryHandle(void)
|
|||
* To populate the map, the function traverses 'ShardSplitInfo' array stored within shared memory segment.
|
||||
*/
|
||||
HTAB *
|
||||
PopulateSourceToDestinationShardMapForSlot(char *slotName)
|
||||
PopulateSourceToDestinationShardMapForSlot(char *slotName, MemoryContext cxt)
|
||||
{
|
||||
HASHCTL info;
|
||||
memset(&info, 0, sizeof(info));
|
||||
info.keysize = sizeof(Oid);
|
||||
info.entrysize = sizeof(SourceToDestinationShardMapEntry);
|
||||
info.hash = uint32_hash;
|
||||
info.hcxt = TopMemoryContext;
|
||||
info.hcxt = cxt;
|
||||
|
||||
int hashFlags = (HASH_ELEM | HASH_CONTEXT | HASH_FUNCTION);
|
||||
HTAB *sourceShardToDesShardMap = hash_create("SourceToDestinationShardMap", 128,
|
||||
&info, hashFlags);
|
||||
|
||||
MemoryContext oldContext = MemoryContextSwitchTo(TopMemoryContext);
|
||||
MemoryContext oldContext = MemoryContextSwitchTo(cxt);
|
||||
|
||||
ShardSplitInfoSMHeader *smHeader = GetShardSplitInfoSMHeader();
|
||||
for (int index = 0; index < smHeader->count; index++)
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
DROP TYPE IF EXISTS citus.split_shard_info;
|
||||
|
||||
DROP FUNCTION IF EXISTS pg_catalog.worker_split_shard_replication_setup;
|
||||
|
||||
CREATE TYPE citus.split_shard_info AS (
|
||||
source_shard_id bigint,
|
||||
child_shard_id bigint,
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
DROP TYPE IF EXISTS citus.split_shard_info;
|
||||
|
||||
DROP FUNCTION IF EXISTS pg_catalog.worker_split_shard_replication_setup;
|
||||
|
||||
CREATE TYPE citus.split_shard_info AS (
|
||||
source_shard_id bigint,
|
||||
child_shard_id bigint,
|
||||
|
|
|
@ -62,7 +62,8 @@ extern void ReleaseSharedMemoryOfShardSplitInfo(void);
|
|||
|
||||
extern ShardSplitInfoSMHeader * GetShardSplitInfoSMHeader(void);
|
||||
|
||||
extern HTAB * PopulateSourceToDestinationShardMapForSlot(char *slotName);
|
||||
extern HTAB * PopulateSourceToDestinationShardMapForSlot(char *slotName, MemoryContext
|
||||
cxt);
|
||||
|
||||
char * encode_replication_slot(uint32_t nodeId, uint32_t tableOwnerId);
|
||||
#endif /* SHARDSPLIT_SHARED_MEMORY_H */
|
||||
|
|
Loading…
Reference in New Issue