mirror of https://github.com/citusdata/citus.git
Revert "Avoid re-assigning the global pid when we cannot retrieve local node id without unsafe catalog access"
This reverts commit d06c0cd958
.
pull/7791/head
parent
1754f9f3ec
commit
4745a889da
|
@ -4545,16 +4545,6 @@ GetLocalNodeId(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* CachedLocalNodeIdIsValid return true if the cached local node id is valid.
|
|
||||||
*/
|
|
||||||
bool
|
|
||||||
CachedLocalNodeIdIsValid(void)
|
|
||||||
{
|
|
||||||
return LocalNodeId != -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* RegisterLocalGroupIdCacheCallbacks registers the callbacks required to
|
* RegisterLocalGroupIdCacheCallbacks registers the callbacks required to
|
||||||
* maintain LocalGroupId at a consistent value. It's separate from
|
* maintain LocalGroupId at a consistent value. It's separate from
|
||||||
|
|
|
@ -2899,13 +2899,6 @@ ApplicationNameAssignHook(const char *newval, void *extra)
|
||||||
* So we set the FinishedStartupCitusBackend flag in StartupCitusBackend to
|
* So we set the FinishedStartupCitusBackend flag in StartupCitusBackend to
|
||||||
* indicate when this responsibility handoff has happened.
|
* indicate when this responsibility handoff has happened.
|
||||||
*
|
*
|
||||||
* On the other hand, even if now it's this hook's responsibility to update
|
|
||||||
* the global pid, we cannot do so if the cached local node id is invalidated
|
|
||||||
* and we're not allowed to access the catalog tables. Within a transaction
|
|
||||||
* block, we can access the catalog tables. For this reason, in addition to
|
|
||||||
* checking FinishedStartupCitusBackend, we also require either being in a
|
|
||||||
* transaction block or the cached local node id to be valid.
|
|
||||||
*
|
|
||||||
* Another solution to the catalog table acccess problem would be to update
|
* Another solution to the catalog table acccess problem would be to update
|
||||||
* global pid lazily, like we do for HideShards. But that's not possible
|
* global pid lazily, like we do for HideShards. But that's not possible
|
||||||
* for the global pid, since it is stored in shared memory instead of in a
|
* for the global pid, since it is stored in shared memory instead of in a
|
||||||
|
@ -2914,8 +2907,7 @@ ApplicationNameAssignHook(const char *newval, void *extra)
|
||||||
* as reasonably possible, which is also why we extract global pids in the
|
* as reasonably possible, which is also why we extract global pids in the
|
||||||
* AuthHook already (extracting doesn't require catalog access).
|
* AuthHook already (extracting doesn't require catalog access).
|
||||||
*/
|
*/
|
||||||
if (FinishedStartupCitusBackend &&
|
if (FinishedStartupCitusBackend)
|
||||||
(IsTransactionState() || CachedLocalNodeIdIsValid()))
|
|
||||||
{
|
{
|
||||||
AssignGlobalPID(newval);
|
AssignGlobalPID(newval);
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,7 +181,6 @@ extern CitusTableCacheEntry * LookupCitusTableCacheEntry(Oid relationId);
|
||||||
extern DistObjectCacheEntry * LookupDistObjectCacheEntry(Oid classid, Oid objid, int32
|
extern DistObjectCacheEntry * LookupDistObjectCacheEntry(Oid classid, Oid objid, int32
|
||||||
objsubid);
|
objsubid);
|
||||||
extern int32 GetLocalGroupId(void);
|
extern int32 GetLocalGroupId(void);
|
||||||
extern bool CachedLocalNodeIdIsValid(void);
|
|
||||||
extern int32 GetLocalNodeId(void);
|
extern int32 GetLocalNodeId(void);
|
||||||
extern void CitusTableCacheFlushInvalidatedEntries(void);
|
extern void CitusTableCacheFlushInvalidatedEntries(void);
|
||||||
extern Oid LookupShardRelationFromCatalog(int64 shardId, bool missing_ok);
|
extern Oid LookupShardRelationFromCatalog(int64 shardId, bool missing_ok);
|
||||||
|
|
Loading…
Reference in New Issue