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 = "";
|
||||
|
||||
|
||||
static List * CitusTableMetadataCreateCommandList(Oid relationId);
|
||||
static void EnsureObjectMetadataIsSane(int distributionArgumentIndex,
|
||||
int colocationId);
|
||||
static char * SchemaOwnerName(Oid objectId);
|
||||
|
@ -706,7 +705,7 @@ DistributedObjectMetadataSyncCommandList(void)
|
|||
* CitusTableMetadataCreateCommandList returns the set of commands necessary to
|
||||
* create the given distributed table metadata on a worker.
|
||||
*/
|
||||
static List *
|
||||
List *
|
||||
CitusTableMetadataCreateCommandList(Oid relationId)
|
||||
{
|
||||
CitusTableCacheEntry *cacheEntry = GetCitusTableCacheEntry(relationId);
|
||||
|
|
|
@ -660,29 +660,18 @@ PgDistTableMetadataSyncCommandList(void)
|
|||
/* create pg_dist_partition, pg_dist_shard and pg_dist_placement entries */
|
||||
foreach_ptr(cacheEntry, propagatedTableList)
|
||||
{
|
||||
Oid clusteredTableId = 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);
|
||||
List *tableMetadataCreateCommandList =
|
||||
CitusTableMetadataCreateCommandList(cacheEntry->relationId);
|
||||
|
||||
metadataSnapshotCommandList = list_concat(metadataSnapshotCommandList,
|
||||
shardCreateCommandList);
|
||||
tableMetadataCreateCommandList);
|
||||
}
|
||||
|
||||
/* As the last step, propagate the pg_dist_object entities */
|
||||
if (ShouldPropagate())
|
||||
{
|
||||
List *distributedObjectSyncCommandList =
|
||||
DistributedObjectMetadataSyncCommandList();
|
||||
metadataSnapshotCommandList = list_concat(metadataSnapshotCommandList,
|
||||
distributedObjectSyncCommandList);
|
||||
}
|
||||
Assert(ShouldPropagate());
|
||||
List *distributedObjectSyncCommandList = DistributedObjectMetadataSyncCommandList();
|
||||
metadataSnapshotCommandList = list_concat(metadataSnapshotCommandList,
|
||||
distributedObjectSyncCommandList);
|
||||
|
||||
metadataSnapshotCommandList = lcons(DISABLE_DDL_PROPAGATION,
|
||||
metadataSnapshotCommandList);
|
||||
|
|
|
@ -38,6 +38,7 @@ extern bool ShouldSyncTableMetadata(Oid relationId);
|
|||
extern bool ShouldSyncTableMetadataViaCatalog(Oid relationId);
|
||||
extern List * NodeMetadataCreateCommands(void);
|
||||
extern List * DistributedObjectMetadataSyncCommandList(void);
|
||||
extern List * CitusTableMetadataCreateCommandList(Oid relationId);
|
||||
extern List * NodeMetadataDropCommands(void);
|
||||
extern char * MarkObjectsDistributedCreateCommand(List *addresses,
|
||||
List *distributionArgumentIndexes,
|
||||
|
|
Loading…
Reference in New Issue