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

Pull 99% of walproposer code into extension. #188

Merged
merged 13 commits into from
Aug 18, 2022

Conversation

MMeent
Copy link

@MMeent MMeent commented Aug 5, 2022

There are now only a few traces of walproposer left in Community PostgreSQL, with the main ones that I can think of being the following:

  • the backpressure hook is now a proper hook
  • some initialization code remains for --sync-safekeepers

Apart from that, the entry point of this extension has been moved into neon.c, and significant amounts of code were copied from walsender.c into our extension, then modified to only contain the walsender paths. Most of this copy-edited code now resides in walproposer_utils.c.

Copy link
Member

@petuhovskiy petuhovskiy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I wonder should we copy ProcessStandbyReply and ProcessStandbyHSFeedback to walproposer_utils also?

MMeent added 2 commits August 5, 2022 21:51
- Include neon extensions into contrib Makefile
- Configure libpqwalproposer more like other extensions
The function is instead available in walpropcompat.c, which is the
authoritative version.
@kelvich
Copy link

kelvich commented Aug 8, 2022

I think with the extension, there is no need to have a separate build for libpagestore -- it could be just a .c file in the extension root path.

@MMeent
Copy link
Author

MMeent commented Aug 8, 2022

I think with the extension, there is no need to have a separate build for libpagestore -- it could be just a .c file in the extension root path.

I'm not sure about that -- we need to build against libpq which has #define FRONTEND, which isn't compatible with many other header files. That's also the reason why it's a separate build.

@kelvich
Copy link

kelvich commented Aug 8, 2022

I'm not sure about that -- we need to build against libpq which has #define FRONTEND, which isn't compatible with many other header files. That's also the reason why it's a separate build.

libpq avoidance in the backend is more of a deliberate decision, not that much of incompatibility. E.g. works well for these:

https://github.com/neondatabase/postgres/blob/main/contrib/dblink/dblink.c#L50
https://github.com/neondatabase/postgres/blob/main/contrib/postgres_fdw/connection.c#L407

@MMeent MMeent force-pushed the feat/walproposer-as-an-extension branch from 5306ec7 to 7996665 Compare August 9, 2022 12:32
@MMeent
Copy link
Author

MMeent commented Aug 9, 2022

I think I've addressed all comments, and tests are green (up to the previous commit at least, with last commit only removing an outdated comment).

Feel free to merge when appropriate - I'll be OOO until the 17th.

@MMeent MMeent requested a review from kelvich August 9, 2022 16:25
Copy link

@arssher arssher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mind merging as is, though now a lot of code in walproposer_utils.c is just coped from walsender.c and large part of it can be removed/cleaned up.

@@ -1336,7 +1336,7 @@ zenith_nblocks(SMgrRelation reln, ForkNumber forknum)
/*
* zenith_db_size() -- Get the size of the database in bytes.
*/
int64
const int64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does it mean for a function to be const?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know - it was required for signature checks and was pre-existing in the signature for the db_size hook - I didn't want to change this annotation without knowing why it was annotated.

MMeent added 2 commits August 18, 2022 10:17
…n-extension

# Conflicts:
#	src/backend/replication/walsender.c
#	src/include/replication/walsender.h
@MMeent MMeent merged commit 7e32bba into main Aug 18, 2022
@MMeent MMeent deleted the feat/walproposer-as-an-extension branch August 18, 2022 13:50
MMeent added a commit that referenced this pull request Aug 18, 2022
* Pull 99% of walproposer code into extension.

* Annotate nbytes to show it's used for asserts only, fixing one more warning.

* Fix makefiles:

- Include neon extensions into contrib Makefile
- Configure libpqwalproposer more like other extensions

* Add comment about lack of PG timelines, and make StartReplication static again.

* Fix some compiler warnings in vendor/postgres, and pull libpqwalproposer into vendor/neon

* Fix issue with makefile that didn't get caught in the normal test envs.
lubennikovaav pushed a commit that referenced this pull request Nov 21, 2022
* Pull 99% of walproposer code into extension.

* Annotate nbytes to show it's used for asserts only, fixing one more warning.

* Fix makefiles:

- Include neon extensions into contrib Makefile
- Configure libpqwalproposer more like other extensions

* Add comment about lack of PG timelines, and make StartReplication static again.

* Fix some compiler warnings in vendor/postgres, and pull libpqwalproposer into vendor/neon

* Fix issue with makefile that didn't get caught in the normal test envs.
MMeent added a commit that referenced this pull request Feb 10, 2023
* Pull 99% of walproposer code into extension.

* Annotate nbytes to show it's used for asserts only, fixing one more warning.

* Fix makefiles:

- Include neon extensions into contrib Makefile
- Configure libpqwalproposer more like other extensions

* Add comment about lack of PG timelines, and make StartReplication static again.

* Fix some compiler warnings in vendor/postgres, and pull libpqwalproposer into vendor/neon

* Fix issue with makefile that didn't get caught in the normal test envs.
MMeent added a commit that referenced this pull request Feb 10, 2023
* Pull 99% of walproposer code into extension.

* Annotate nbytes to show it's used for asserts only, fixing one more warning.

* Fix makefiles:

- Include neon extensions into contrib Makefile
- Configure libpqwalproposer more like other extensions

* Add comment about lack of PG timelines, and make StartReplication static again.

* Fix some compiler warnings in vendor/postgres, and pull libpqwalproposer into vendor/neon

* Fix issue with makefile that didn't get caught in the normal test envs.
MMeent added a commit that referenced this pull request May 11, 2023
* Pull 99% of walproposer code into extension.

* Annotate nbytes to show it's used for asserts only, fixing one more warning.

* Fix makefiles:

- Include neon extensions into contrib Makefile
- Configure libpqwalproposer more like other extensions

* Add comment about lack of PG timelines, and make StartReplication static again.

* Fix some compiler warnings in vendor/postgres, and pull libpqwalproposer into vendor/neon

* Fix issue with makefile that didn't get caught in the normal test envs.
tristan957 pushed a commit that referenced this pull request Aug 10, 2023
* Pull 99% of walproposer code into extension.

* Annotate nbytes to show it's used for asserts only, fixing one more warning.

* Fix makefiles:

- Include neon extensions into contrib Makefile
- Configure libpqwalproposer more like other extensions

* Add comment about lack of PG timelines, and make StartReplication static again.

* Fix some compiler warnings in vendor/postgres, and pull libpqwalproposer into vendor/neon

* Fix issue with makefile that didn't get caught in the normal test envs.
tristan957 pushed a commit that referenced this pull request Nov 8, 2023
* Pull 99% of walproposer code into extension.

* Annotate nbytes to show it's used for asserts only, fixing one more warning.

* Fix makefiles:

- Include neon extensions into contrib Makefile
- Configure libpqwalproposer more like other extensions

* Add comment about lack of PG timelines, and make StartReplication static again.

* Fix some compiler warnings in vendor/postgres, and pull libpqwalproposer into vendor/neon

* Fix issue with makefile that didn't get caught in the normal test envs.
tristan957 pushed a commit that referenced this pull request Nov 8, 2023
* Pull 99% of walproposer code into extension.

* Annotate nbytes to show it's used for asserts only, fixing one more warning.

* Fix makefiles:

- Include neon extensions into contrib Makefile
- Configure libpqwalproposer more like other extensions

* Add comment about lack of PG timelines, and make StartReplication static again.

* Fix some compiler warnings in vendor/postgres, and pull libpqwalproposer into vendor/neon

* Fix issue with makefile that didn't get caught in the normal test envs.
tristan957 pushed a commit that referenced this pull request Feb 5, 2024
* Pull 99% of walproposer code into extension.

* Annotate nbytes to show it's used for asserts only, fixing one more warning.

* Fix makefiles:

- Include neon extensions into contrib Makefile
- Configure libpqwalproposer more like other extensions

* Add comment about lack of PG timelines, and make StartReplication static again.

* Fix some compiler warnings in vendor/postgres, and pull libpqwalproposer into vendor/neon

* Fix issue with makefile that didn't get caught in the normal test envs.
tristan957 pushed a commit that referenced this pull request Feb 5, 2024
* Pull 99% of walproposer code into extension.

* Annotate nbytes to show it's used for asserts only, fixing one more warning.

* Fix makefiles:

- Include neon extensions into contrib Makefile
- Configure libpqwalproposer more like other extensions

* Add comment about lack of PG timelines, and make StartReplication static again.

* Fix some compiler warnings in vendor/postgres, and pull libpqwalproposer into vendor/neon

* Fix issue with makefile that didn't get caught in the normal test envs.
tristan957 pushed a commit that referenced this pull request Feb 6, 2024
* Pull 99% of walproposer code into extension.

* Annotate nbytes to show it's used for asserts only, fixing one more warning.

* Fix makefiles:

- Include neon extensions into contrib Makefile
- Configure libpqwalproposer more like other extensions

* Add comment about lack of PG timelines, and make StartReplication static again.

* Fix some compiler warnings in vendor/postgres, and pull libpqwalproposer into vendor/neon

* Fix issue with makefile that didn't get caught in the normal test envs.
tristan957 pushed a commit that referenced this pull request May 10, 2024
* Pull 99% of walproposer code into extension.

* Annotate nbytes to show it's used for asserts only, fixing one more warning.

* Fix makefiles:

- Include neon extensions into contrib Makefile
- Configure libpqwalproposer more like other extensions

* Add comment about lack of PG timelines, and make StartReplication static again.

* Fix some compiler warnings in vendor/postgres, and pull libpqwalproposer into vendor/neon

* Fix issue with makefile that didn't get caught in the normal test envs.
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.

6 participants