deepthi912 opened a new pull request, #19420:
URL: https://github.com/apache/pinot/pull/19420
## Summary
`PinotTableRestletResource#validateConfig` — the private method served by
`POST /tables/validate` — only invokes `TableConfigUtils.validate` and
`TaskConfigUtils.validateTaskConfigs`. The create and update paths (`POST
/tables`, `PUT /tables/{tableName}`) route through
`TableConfigValidationUtils#validateTableConfig`, which additionally invokes
`TableConfigValidatorRegistry.validate`. Any SPI-registered validator therefore
rejects the config at apply time but silently passes at preflight time.
This PR adds the registry call to the preflight so validate/apply agree.
## Behavior
| Endpoint | Registry invoked? | Before | After |
|---|---|---|---|
| `POST /tables` (create) | ✅ (via
`TableConfigValidationUtils#validateTableConfig`) | unchanged | unchanged |
| `PUT /tables/{tableName}` (update) | ✅ (via same helper) | unchanged |
unchanged |
| `POST /tables/validate` (preflight) | ❌ → ✅ | false green when an SPI
validator would reject | preflight now matches apply |
| `POST /tableConfigs`, `PUT /tableConfigs/{tableName}`, `POST
/tableConfigs/validate` | ✅ (via `TableConfigsRestletResource#validateConfig`)
| unchanged | unchanged |
The bundle-config counterpart `TableConfigsRestletResource#validateConfig`
already invokes the registry, so its `/tableConfigs` endpoints (create, update,
validate) are unaffected.
## Test
New unit test
`PinotTableRestletResourceTest#testValidateConfigRunsRegisteredValidators`:
registers a stub `TableConfigValidator` that throws for any config, invokes
`validateConfig`, and asserts the preflight rejects and surfaces the
validator's rejection message. Uses `finally` to unregister the stub so it does
not leak into other tests. `validateConfig` visibility relaxed from `private`
to package-private with `@VisibleForTesting` to allow direct invocation.
## Backward compatibility
Adds a new validation gate on the preflight endpoint. Configs that
previously produced a false green from `/tables/validate` will now produce the
same rejection the create/update paths already produce. No wire format, segment
format, or config format changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]