mirror of https://github.com/citusdata/citus.git
Use function to get table metadata list
parent
290a4737fc
commit
7ad5773598
|
@ -83,7 +83,6 @@
|
||||||
char *EnableManualMetadataChangesForUser = "";
|
char *EnableManualMetadataChangesForUser = "";
|
||||||
|
|
||||||
|
|
||||||
static List * CitusTableMetadataCreateCommandList(Oid relationId);
|
|
||||||
static void EnsureObjectMetadataIsSane(int distributionArgumentIndex,
|
static void EnsureObjectMetadataIsSane(int distributionArgumentIndex,
|
||||||
int colocationId);
|
int colocationId);
|
||||||
static char * SchemaOwnerName(Oid objectId);
|
static char * SchemaOwnerName(Oid objectId);
|
||||||
|
@ -706,7 +705,7 @@ DistributedObjectMetadataSyncCommandList(void)
|
||||||
* CitusTableMetadataCreateCommandList returns the set of commands necessary to
|
* CitusTableMetadataCreateCommandList returns the set of commands necessary to
|
||||||
* create the given distributed table metadata on a worker.
|
* create the given distributed table metadata on a worker.
|
||||||
*/
|
*/
|
||||||
static List *
|
List *
|
||||||
CitusTableMetadataCreateCommandList(Oid relationId)
|
CitusTableMetadataCreateCommandList(Oid relationId)
|
||||||
{
|
{
|
||||||
CitusTableCacheEntry *cacheEntry = GetCitusTableCacheEntry(relationId);
|
CitusTableCacheEntry *cacheEntry = GetCitusTableCacheEntry(relationId);
|
||||||
|
|
|
@ -660,29 +660,18 @@ PgDistTableMetadataSyncCommandList(void)
|
||||||
/* create pg_dist_partition, pg_dist_shard and pg_dist_placement entries */
|
/* create pg_dist_partition, pg_dist_shard and pg_dist_placement entries */
|
||||||
foreach_ptr(cacheEntry, propagatedTableList)
|
foreach_ptr(cacheEntry, propagatedTableList)
|
||||||
{
|
{
|
||||||
Oid clusteredTableId = cacheEntry->relationId;
|
List *tableMetadataCreateCommandList =
|
||||||
|
CitusTableMetadataCreateCommandList(cacheEntry->relationId);
|
||||||
/* add the table metadata command first */
|
|
||||||
char *metadataCommand = DistributionCreateCommand(cacheEntry);
|
|
||||||
metadataSnapshotCommandList = lappend(metadataSnapshotCommandList,
|
|
||||||
metadataCommand);
|
|
||||||
|
|
||||||
/* add the pg_dist_shard{,placement} entries */
|
|
||||||
List *shardIntervalList = LoadShardIntervalList(clusteredTableId);
|
|
||||||
List *shardCreateCommandList = ShardListInsertCommand(shardIntervalList);
|
|
||||||
|
|
||||||
metadataSnapshotCommandList = list_concat(metadataSnapshotCommandList,
|
metadataSnapshotCommandList = list_concat(metadataSnapshotCommandList,
|
||||||
shardCreateCommandList);
|
tableMetadataCreateCommandList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* As the last step, propagate the pg_dist_object entities */
|
/* As the last step, propagate the pg_dist_object entities */
|
||||||
if (ShouldPropagate())
|
Assert(ShouldPropagate());
|
||||||
{
|
List *distributedObjectSyncCommandList = DistributedObjectMetadataSyncCommandList();
|
||||||
List *distributedObjectSyncCommandList =
|
|
||||||
DistributedObjectMetadataSyncCommandList();
|
|
||||||
metadataSnapshotCommandList = list_concat(metadataSnapshotCommandList,
|
metadataSnapshotCommandList = list_concat(metadataSnapshotCommandList,
|
||||||
distributedObjectSyncCommandList);
|
distributedObjectSyncCommandList);
|
||||||
}
|
|
||||||
|
|
||||||
metadataSnapshotCommandList = lcons(DISABLE_DDL_PROPAGATION,
|
metadataSnapshotCommandList = lcons(DISABLE_DDL_PROPAGATION,
|
||||||
metadataSnapshotCommandList);
|
metadataSnapshotCommandList);
|
||||||
|
|
|
@ -38,6 +38,7 @@ extern bool ShouldSyncTableMetadata(Oid relationId);
|
||||||
extern bool ShouldSyncTableMetadataViaCatalog(Oid relationId);
|
extern bool ShouldSyncTableMetadataViaCatalog(Oid relationId);
|
||||||
extern List * NodeMetadataCreateCommands(void);
|
extern List * NodeMetadataCreateCommands(void);
|
||||||
extern List * DistributedObjectMetadataSyncCommandList(void);
|
extern List * DistributedObjectMetadataSyncCommandList(void);
|
||||||
|
extern List * CitusTableMetadataCreateCommandList(Oid relationId);
|
||||||
extern List * NodeMetadataDropCommands(void);
|
extern List * NodeMetadataDropCommands(void);
|
||||||
extern char * MarkObjectsDistributedCreateCommand(List *addresses,
|
extern char * MarkObjectsDistributedCreateCommand(List *addresses,
|
||||||
List *distributionArgumentIndexes,
|
List *distributionArgumentIndexes,
|
||||||
|
|
Loading…
Reference in New Issue