Re: isTempNamespaceInUse() is incorrect with its handling of MyBackendId
Michael Paquier <[email protected]> Mon, 13 Jan 2020 22:14:52 +0900
| Newsgroups | gmane.comp.db.postgresql.devel.general |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Jan 13, 2020 at 01:09:01PM +0100, Julien Rouhaud wrote: > But that means an extraneous call to BackendIdGetProc() in that > case, it seems better to avoid it if we already have the information. Note that you cannot make a direct comparison of the result from GetTempNamespaceBackendId() with MyBackendId, because it is critical to be able to handle the case of a session which has not created yet an object on its own temp namespace (this way any temp objects from previous connections which used the same backend slot can be marked as orphaned and discarded by autovacuum, the whole point of 246a6c8). So in order to get a fast-exit path we could do the following: - Add a routine GetTempNamespace which returns myTempNamespace (the result can be InvalidOid). - Add an assertion at the beginning of isTempNamespaceInUse() to make sure that it never gets called with InvalidOid as input argument. - Return true as a first step of GetTempNamespaceBackendId() if namespaceId matches GetTempNamespace(). What do you think? -- Michael
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl4cbUwACgkQnvQgOdby QH0Gpg//UCVLYZX1beh551Xx22p8Yp5JhuuWoBzJfpFNtitTVcpw4xCOaOGZyutJ RPIAAa/TLfnpDx66OF609bZ9MuiXJ5IrjxUlePZ0HhP1uCQqJDO6ROK5oRTw758e XUNYQdoDsGHzc0Lztt/r9UraTAJZ+97Y6hR5/LD6CPVIBmJAvf5iZWc3ASyxeAp1 gYiZi0jPwdQnewsjG0U5qIPBNvsXYI3BTw6ilqvtc0Of1mGX84dSM8koROBIxx78 w/bF/8aIUl/gzF1X6hmnPPX+UPMfpQ1CwPy8A8Rtl8KFfG2eYBYWRq3uazS12C8+ Djk5psXNzLt5AE79ylCuMCIAIGUExg9wbia9ND4KUGy86GeAL9A7AKxw/teSzdO9 4CrtTAbNrd8KdHN3TMQd0ciWOtPpXDD0Zop1r5+OMa5SKT+oWVH/zkq67+hhFUOP OPsXp8OjtNVaMOkrapyb2cgEKPOQ0EN7kTTHXjNf205n1llx0Wk2l2UholqpndVS HyEmMe/vnak2J0UlBsQRH0B5cpiW946Dpopvd6/NGBEZvaQRHUAXi2oVdHEx0jnB YYMmrBqVgBteMP8vT20R+5TxULsT/mkv0co7o+BxX4f9/T1zN8q1n438eoIBJveG QxwevRltsTq0RpcpMBjAWLaTiw0AXSrKS8aOOe0izI1qQKh6UPg= =Bvst -----END PGP SIGNATURE-----