mirror of https://github.com/citusdata/citus.git
Improve heap access methods
This commit improves heap access methods for reference table upgrade and colocation group modifications.pull/1148/head
parent
ac7235bfaa
commit
bd825be340
|
@ -900,6 +900,7 @@ UpdateColocationGroupReplicationFactor(uint32 colocationId, int replicationFacto
|
|||
int scanKeyCount = 1;
|
||||
bool indexOK = true;
|
||||
HeapTuple heapTuple = NULL;
|
||||
HeapTuple newHeapTuple = NULL;
|
||||
TupleDesc tupleDescriptor = NULL;
|
||||
|
||||
Datum values[Natts_pg_dist_colocation];
|
||||
|
@ -925,17 +926,22 @@ UpdateColocationGroupReplicationFactor(uint32 colocationId, int replicationFacto
|
|||
}
|
||||
|
||||
/* after we find colocation group, we update it with new values */
|
||||
memset(replace, 0, sizeof(replace));
|
||||
memset(replace, false, sizeof(replace));
|
||||
memset(isnull, false, sizeof(isnull));
|
||||
memset(values, 0, sizeof(values));
|
||||
|
||||
values[Anum_pg_dist_colocation_replicationfactor - 1] = Int32GetDatum(
|
||||
replicationFactor);
|
||||
isnull[Anum_pg_dist_colocation_replicationfactor - 1] = false;
|
||||
replace[Anum_pg_dist_colocation_replicationfactor - 1] = true;
|
||||
|
||||
heapTuple = heap_modify_tuple(heapTuple, tupleDescriptor, values, isnull, replace);
|
||||
simple_heap_update(pgDistColocation, &heapTuple->t_self, heapTuple);
|
||||
newHeapTuple = heap_modify_tuple(heapTuple, tupleDescriptor, values, isnull, replace);
|
||||
simple_heap_update(pgDistColocation, &newHeapTuple->t_self, newHeapTuple);
|
||||
|
||||
CatalogUpdateIndexes(pgDistColocation, heapTuple);
|
||||
CatalogUpdateIndexes(pgDistColocation, newHeapTuple);
|
||||
|
||||
CommandCounterIncrement();
|
||||
|
||||
heap_freetuple(newHeapTuple);
|
||||
|
||||
systable_endscan(scanDescriptor);
|
||||
heap_close(pgDistColocation, NoLock);
|
||||
|
|
|
@ -988,7 +988,6 @@ DeleteColocationGroup(uint32 colocationId)
|
|||
{
|
||||
simple_heap_delete(pgDistColocation, &(heapTuple->t_self));
|
||||
|
||||
CatalogUpdateIndexes(pgDistColocation, heapTuple);
|
||||
CitusInvalidateRelcacheByRelid(DistColocationRelationId());
|
||||
CommandCounterIncrement();
|
||||
}
|
||||
|
|
|
@ -650,9 +650,6 @@ WHERE
|
|||
1360013 | f | f
|
||||
(1 row)
|
||||
|
||||
-- eliminate the duplicate intermediate duplicate rows in pg_dist_colocation
|
||||
VACUUM ANALYZE pg_dist_colocation;
|
||||
|
||||
SELECT *
|
||||
FROM pg_dist_colocation
|
||||
WHERE colocationid IN
|
||||
|
|
|
@ -423,9 +423,6 @@ FROM
|
|||
WHERE
|
||||
logicalrelid = 'upgrade_reference_table_transaction_rollback'::regclass;
|
||||
|
||||
-- eliminate the duplicate intermediate duplicate rows in pg_dist_colocation
|
||||
VACUUM ANALYZE pg_dist_colocation;
|
||||
|
||||
SELECT *
|
||||
FROM pg_dist_colocation
|
||||
WHERE colocationid IN
|
||||
|
|
Loading…
Reference in New Issue