Refrain reading the metadata cache for all tables during upgrade

First, it is not needed. Second, in the past we had issues regarding
this: https://github.com/citusdata/citus/pull/4344

When I create 10k tables, ~120K shards, this saves
40Mb of memory during ALTER EXTENSION citus UPDATE.

Before the change:  MetadataCacheMemoryContext: 41943040 ~ 40MB
After the change:  MetadataCacheMemoryContext: 8192
pull/5925/head
Onder Kalaci 2022-05-04 16:44:06 +02:00
parent 0e1e2275f0
commit f193e16a01
1 changed files with 2 additions and 1 deletions

View File

@ -513,7 +513,8 @@ MarkExistingObjectDependenciesDistributedIfSupported()
ObjectAddress tableAddress = { 0 }; ObjectAddress tableAddress = { 0 };
ObjectAddressSet(tableAddress, RelationRelationId, citusTableId); ObjectAddressSet(tableAddress, RelationRelationId, citusTableId);
if (ShouldSyncTableMetadata(citusTableId)) /* refrain reading the metadata cache for all tables */
if (ShouldSyncTableMetadataViaCatalog(citusTableId))
{ {
/* we need to pass pointer allocated in the heap */ /* we need to pass pointer allocated in the heap */
ObjectAddress *addressPointer = palloc0(sizeof(ObjectAddress)); ObjectAddress *addressPointer = palloc0(sizeof(ObjectAddress));