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

Allow use_remote_estimate to be set to 0. #335

Merged

Conversation

deathwish
Copy link
Contributor

Previously, the code applying default settings would assume the option was unset, and set the default value of 1. We use a sentinel value instead, which allows us to detect this case separately.

Previously, the code applying default settings would assume the option
was unset, and set the default value of 1. We use a sentinel value
instead, which allows us to detect this case separately.
@jenkins-juliogonzalez
Copy link
Member

Can one of the admins verify this patch?

@GeoffMontee
Copy link
Collaborator

Test this, please

@jenkins-juliogonzalez
Copy link
Member

Test FAILed.

@GeoffMontee
Copy link
Collaborator

Hi @deathwish,

Thanks for the patch! It looks like there are some test failures. Could you please fix those? For example, see here: https://jenkins.juliogonzalez.es/job/tds_fdw-build-pr/15/DISTRO=centos7,PG_VER=11,label=docker/console

In tdsValidateForeignTableOptionSet(TdsFdwOptionSet *option_set), it looks to me like this condition might need to be tweaked:

if (option_set->use_remote_estimate < 0 || option_set->use_remote_estimate > 1)

Isn't the following condition correct for this context instead?:

if (option_set->use_remote_estimate < -1 || option_set->use_remote_estimate > 1)

@deathwish deathwish force-pushed the BUGFIX-allow_remote_estimate_disablement branch from d12b303 to 55f74e6 Compare June 22, 2023 18:48
@deathwish
Copy link
Contributor Author

deathwish commented Jun 22, 2023

if (option_set->use_remote_estimate < -1 || option_set->use_remote_estimate > 1)

The -1 value is supposed to be replaced by the option's default value in all cases, so I view the test failures as indicative. Ensuring defaults are set before option validation in all cases, as the commit I just pushed does, seems to fix the test failures and likely fixes other problems.

ETA: It's possible that tdsGetForeignServerTableOptions should also validate the range of use_remote_estimate. It would be reasonable to allow -1 in this case to explicitly select the default behavior.

@GeoffMontee
Copy link
Collaborator

Test this, please

@jenkins-juliogonzalez
Copy link
Member

Test PASSed.

@GeoffMontee GeoffMontee merged commit 3c79ca7 into tds-fdw:master Jun 23, 2023
@GeoffMontee
Copy link
Collaborator

This has been merged. Thanks again for the patch!

@deathwish
Copy link
Contributor Author

Great! Glad I could help, thanks for getting this in.

@deathwish deathwish deleted the BUGFIX-allow_remote_estimate_disablement branch June 23, 2023 21:06
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.

3 participants