mirror of https://github.com/citusdata/citus.git
Fix possible shard cache incoherency.
When a table and it's shards are dropped, and afterwards the same shard identifiers are reused, e.g. due to a DROP & CREATE EXTENSION, the old entry in the shard cache and the required entry in the shard cache might be for different tables. Force invalidation for both old and new table to fix.pull/1591/head
parent
41350fdd54
commit
78716e5546
|
@ -642,11 +642,18 @@ LookupShardCacheEntry(int64 shardId)
|
||||||
|
|
||||||
if (!shardEntry->tableEntry->isValid)
|
if (!shardEntry->tableEntry->isValid)
|
||||||
{
|
{
|
||||||
|
Oid oldRelationId = shardEntry->tableEntry->relationId;
|
||||||
|
Oid currentRelationId = LookupShardRelation(shardId);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The cache entry might not be valid right now. Reload cache entry
|
* The relation OID to which the shard belongs could have changed,
|
||||||
* and recheck (as the offset might have changed).
|
* most notably when the extension is dropped and a shard ID is
|
||||||
|
* reused. Reload the cache entries for both old and new relation
|
||||||
|
* ID and then look up the shard entry again.
|
||||||
*/
|
*/
|
||||||
LookupDistTableCacheEntry(shardEntry->tableEntry->relationId);
|
LookupDistTableCacheEntry(oldRelationId);
|
||||||
|
LookupDistTableCacheEntry(currentRelationId);
|
||||||
|
|
||||||
recheck = true;
|
recheck = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue