Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Added PostgreSQL v13 VACUUM PARALLEL option support #1208

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

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

Conversation

guptapratykshh
Copy link

@guptapratykshh guptapratykshh commented Apr 5, 2025

PostgreSQL v13 VACUUM PARALLEL option support

Description

This PR adds support for the PARALLEL option of VACUUM commands in PostgreSQL 13+. The PARALLEL option was introduced in PostgreSQL 13 and allows specifying number of parallel worker processes to use when running a parallel vacuum operation.

Changes made

  1. Added PostgreSQL version detection in PostgresGlobalState.java -
    Added a majorVersion field to store the server's major version, implemented getMajorVersion() method that extracts the major version from server_version_numand updated setConnection() to initialize the major version when connecting

  2. Enhanced PostgresVacuumGenerator.java to support the PARALLEL option -
    Added PARALLEL option to the list of vacuum options when PostgreSQL version is 13 or higher , ensured PARALLEL option always has valid integer value (between 0-4 for testing) and added error handling for the "VACUUM option PARALLEL cannot be used with FULL" error

Testing

Tested with PostgreSQL 13.20 to verify:

  • Version detection works correctly
  • VACUUM commands with PARALLEL option are properly generated
  • The PARALLEL option always receives a valid integer value
  • Error handling is appropriate for VACUUM PARALLEL constraints

Related Issues

Resolves one of the pending items from #912
Related to #1040 "[Postgres][v13] Add PARALLEL option for VACUUM"

image

@guptapratykshh
Copy link
Author

@robins @mrigger please look into this support that i added for PostgreSQL v13. Please review it.

@guptapratykshh
Copy link
Author

Can you please look into this PR @robins @mrigger

@robins
Copy link
Collaborator

robins commented Apr 8, 2025

@guptapratykshh - A few things.

  1. We don't want to go the route of server_version_num here. The goal is that ideally SQLancer doesn't need to check the version and should support all commands in the existing / supported version - See this discussion - (as discussed here) .

  2. The PR [Postgres][v13] Skip errors around VACUUM FULL not supporting PARALLEL #1053 seems to be on similar lines, and is waiting for v13 support to go live.

  3. I think the intention of this PR, to restrict PARALLEL count is understandable, but sometimes restricting search space goes against what the tool is trying to do - in effect that number is intentionally left unrestricted so that if it (negative or very large int) triggers the engine to go wild, then so be it.

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.

2 participants