Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

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 <[email protected]>
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