Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitda3751c

Browse files
committed
Be more noisy about "wrong number of nailed relations" initfile problems.
In commit5d1ff6b I added some logic torelcache.c to try to ensure that the regression tests would fail if wemade a mistake about which relations belong in the relcache init files.I'm quite sure I tested that, but I must have done so only for thenon-shared-catalog case, because a report from Adam Brightwell showed thatthe regression tests still pass just fine if we bollix the shared-cataloginit file in the way this code was supposed to catch. The reason is thatthat file gets loaded before we do client authentication, so the WARNINGis not sent to the client, only to the postmaster log, where it's far tooeasily missed.The least Rube Goldbergian answer to this is to put an Assert(false)after the elog(WARNING). That will certainly get developers' attention,while not breaking production builds' ability to recover from cornercases with similar symptoms.Since this is only of interest to developers, there seems no need fora back-patch, even though the previous commit went into all branches.
1 parent80558c1 commitda3751c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

‎src/backend/utils/cache/relcache.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4910,6 +4910,12 @@ load_relcache_init_file(bool shared)
49104910
* get the right number of nailed items? This is a useful crosscheck in
49114911
* case the set of critical rels or indexes changes. However, that should
49124912
* not happen in a normally-running system, so let's bleat if it does.
4913+
*
4914+
* For the shared init file, we're called before client authentication is
4915+
* done, which means that elog(WARNING) will go only to the postmaster
4916+
* log, where it's easily missed. To ensure that developers notice bad
4917+
* values of NUM_CRITICAL_SHARED_RELS/NUM_CRITICAL_SHARED_INDEXES, we put
4918+
* an Assert(false) there.
49134919
*/
49144920
if (shared)
49154921
{
@@ -4919,6 +4925,9 @@ load_relcache_init_file(bool shared)
49194925
elog(WARNING,"found %d nailed shared rels and %d nailed shared indexes in init file, but expected %d and %d respectively",
49204926
nailed_rels,nailed_indexes,
49214927
NUM_CRITICAL_SHARED_RELS,NUM_CRITICAL_SHARED_INDEXES);
4928+
/* Make sure we get developers' attention about this */
4929+
Assert(false);
4930+
/* In production builds, recover by bootstrapping the relcache */
49224931
gotoread_failed;
49234932
}
49244933
}
@@ -4930,6 +4939,7 @@ load_relcache_init_file(bool shared)
49304939
elog(WARNING,"found %d nailed rels and %d nailed indexes in init file, but expected %d and %d respectively",
49314940
nailed_rels,nailed_indexes,
49324941
NUM_CRITICAL_LOCAL_RELS,NUM_CRITICAL_LOCAL_INDEXES);
4942+
/* We don't need an Assert() in this case */
49334943
gotoread_failed;
49344944
}
49354945
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp