xiangfu0 opened a new pull request, #18502:
URL: https://github.com/apache/pinot/pull/18502
## Summary
This is the next step toward removing the long-deprecated `TimeFieldSpec`
(apache/pinot#2756). It does three things:
1. **Formal deprecation** — `TimeFieldSpec` had only Javadoc `@deprecated`
for years; this adds the `@Deprecated` annotation so the compiler/IDE actually
warn on every remaining call site. `Schema#getTimeFieldSpec()` is also
annotated. Internal SPI bridges that intentionally keep handling
`TimeFieldSpec` for backward-compat JSON deserialization (Jackson
`@JsonSubTypes`, `Schema#addField`, `getSpecForTimeColumn`,
`convertToDateTimeFieldSpec`) carry a narrow `@SuppressWarnings("deprecation")`
so the SPI module stays warning-clean.
2. **Block creation of new `TimeFieldSpec` schemas** — `POST /schemas` now
rejects payloads with `fieldType=TIME` and returns 400 pointing at
`DateTimeFieldSpec`. Lenience is preserved for the realistic backward-compat
paths:
- **PUT (update)** is unchanged — legacy schemas already in ZK can still
be edited.
- **POST with `force=true`** is unchanged (operator escape hatch).
- **POST re-applying an existing legacy schema** (same name, ZK already
has TimeFieldSpec) is allowed, so restore / reconcile / IaC workflows keep
working. Only genuinely new TimeFieldSpec schemas are blocked.
3. **`DeprecatedFieldSpecChecker` controller periodic task** — runs hourly
by default, scans tables this controller leads, logs a warning per affected
table, and emits two new gauges:
- `tableUsesDeprecatedTimeFieldSpec` (per-table, 1 / 0)
- `tablesWithDeprecatedTimeFieldSpec` (global count; hybrid tables dedupe
to one)
Overrides `nonLeaderCleanup` to drop stale per-table gauges on leadership
shifts, and preserves prior gauge values on transient schema-fetch failures
rather than silently flipping a flagged table to clean.
## Configs added
- `controller.deprecatedFieldSpecChecker.frequencyPeriod` (default `1h`)
- `controller.deprecatedFieldSpecChecker.initialDelayInSeconds`
## Rolling-upgrade note
During a mixed-version controller deployment, newer controllers will reject
brand-new `TimeFieldSpec` schema POSTs while older controllers still accept
them. Everything below continues to work on both versions during the rollout:
existing schemas in ZK, PUT updates, `force=true`, and re-applies of
pre-existing legacy schemas via POST. No wire format or DataTable version
changes.
## Test plan
- [x] `mvn test -pl pinot-spi
-Dtest=FieldSpecTest,SchemaTest,SchemaSerializationTest` — all 60 SPI tests
pass; backward-compat JSON deserialization of `"fieldType":"TIME"` is unchanged.
- [x] `mvn test -pl pinot-controller -Dtest=PinotSchemaRestletResourceTest`
— 6 tests pass, including the new `testRejectDeprecatedTimeFieldSpec` which
covers: POST rejects, POST `force=true` accepts, PUT accepts, POST re-apply of
existing legacy schema accepts.
- [x] `mvn test -pl pinot-controller -Dtest=DeprecatedFieldSpecCheckerTest`
— 5 tests pass, covering: positive case, no-affected-tables, hybrid-table
dedupe in global gauge, null-schema fetch preserving prior gauge, non-leader
cleanup removing stale gauges.
- [x] `mvn spotless:apply checkstyle:check license:check -pl
pinot-common,pinot-controller,pinot-spi` — clean.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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]