Skip to content

PG16-PG17: call RelationGetSmgr instead of custom code#278

Open
ivan-v-kush wants to merge 2 commits intohydradatabase:mainfrom
ivan-v-kush:pg17-call-RelationGetSmgr
Open

PG16-PG17: call RelationGetSmgr instead of custom code#278
ivan-v-kush wants to merge 2 commits intohydradatabase:mainfrom
ivan-v-kush:pg17-call-RelationGetSmgr

Conversation

@ivan-v-kush
Copy link
Contributor

It's a preparation PR for PG16 to migrate hydra to PG17. Can be merged in PG16 version

This code should be changed in PG17, will be added one more #elif.

	if (unlikely(rel->rd_smgr == NULL))
	BlockNumber nblocks = smgrnblocks(RelationGetSmgr(rel), MAIN_FORKNUM);
	{
	#if PG_VERSION_NUM >= PG_VERSION_16
		smgrsetowner(&(rel->rd_smgr), smgropen(rel->rd_locator, rel->rd_backend));
	#else
		smgrsetowner(&(rel->rd_smgr), smgropen(rel->rd_node, rel->rd_backend));
	#endif
	}

Will be changedto smgrpin See MR in Postgres

Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date:   Wed Jan 31 12:31:02 2024 +0200
Discussion: https://www.postgresql.org/message-id/CA%2BhUKGJ8NTvqLHz6dqbQnt2c8XCki4r2QvXjBQcXpVwxTY_pvA@mail.gmail.com

But this logic is included in the standard function RelationGetSmgr. Also see the same code in the Citus repository

https://github.com/citusdata/citus/blob/f7bead22d478ac3f407b1fb0f23739a289743bcc/src/backend/columnar/columnar_tableam.c#L1891

@ivan-v-kush ivan-v-kush changed the title PG17 call RelationGetSmgr instead of custom code PG16-PG17: call RelationGetSmgr instead of custom code Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant