fix s3 endpoint specific configuration priorities#109251
Conversation
| /// top-level `<s3>` section, which is less specific than the URL-scoped endpoint settings. | ||
| /// Apply it first so the endpoint settings win, matching the resolution order used at table | ||
| /// creation in `S3StorageParsedArguments::fromAST` (global `<s3>` first, endpoint on top). | ||
| apply_config_settings(); |
There was a problem hiding this comment.
StorageObjectStorage::update calls applyNewSettings on every non-table-function query, so this branch is the live S3 table path, not only SYSTEM RELOAD CONFIG. The new ordering fixes global <s3> vs endpoint precedence, but it still skips the final request_settings.updateFromSettings(...) that fromAST does in src/Storages/ObjectStorage/S3/Configuration.cpp:667-671. Because S3SettingsByEndpoint::loadFromConfig seeds each endpoint entry from S3RequestSettings(config, settings, "s3") and then applies the endpoint block on top, a query-level read setting like s3_max_single_read_retries or s3_max_get_rps is still overwritten here by the matching <s3><endpoint> config, and readObject later consumes s3_settings->request_settings directly. Can we re-apply context->getSettingsRef() after apply_endpoint_settings() in the non-disk case as well, so the priority order for ordinary S3 table reads remains global <s3> < endpoint block < query/profile`?
LLVM Coverage ReportChanged lines: Changed C/C++ lines covered: 15/15 (100.00%) · Uncovered code |

Fix S3 settings priority so a URL-scoped
<s3>endpoint block overrides the top-level<s3>defaults.The
<s3>section has two layers: top-level defaults, and URL-scoped endpoint blocks that are more specific and should win. This is done at table creation (fromAST).After #100975 was merged,
S3ObjectStorage::applyNewSettingsapplied theconfig_prefixsettings last. For disks that is correct, sinceconfig_prefixis the disk's own<storage_configuration>section, which is more specific than<s3>. But the same path also runs for tables not using a<storage_configuration>(S3,S3Queue, etc.), whereconfig_prefixis the top-level<s3>itself, so the generic defaults ended up overriding the endpoint block. For example, this turneduse_environment_credentialsoff for specific endpoints on the object-storage refresh, resulting inACCESS_DENIEDerrors on flush.After this fix:
<s3>defaults, matching how the same settings are already resolved at table creation.The disk and query/profile priority changes from #100975 are left untouched.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix S3 settings priority so a URL-scoped
<s3>endpoint block takes precedence over the top-level<s3>defaults.