Support codecSpec on segment reload and enable codecSpec end to end - #19308
Support codecSpec on segment reload and enable codecSpec end to end#19308xiangfu0 wants to merge 1 commit into
Conversation
9737c0c to
aafe8c6
Compare
|
Pushed 1. The DELTA/DELTADELTA guidance described a migration that is not possible. The previous wording ("For new SV INT/LONG columns, prefer Same for DELTADELTA and for LONG. Note this makes The Javadoc now states plainly that these values are rejected by table-config validation and points to 2. The six constants with no
I also fixed the malformed Net effect: the guidance now covers all 12 constants and matches what validation actually does. Comment-only change, no behavior difference. Verification: |
Stacked on #19307 (
xiangfu0/codex/codec-stack/05-v7-format). Part of the split of #18229.Summary
This is the enabling PR of the series: it removes every remaining
codecSpecfeature-gate site andreplaces the gates with real behavior — semantic table-config-time validation, reload/rewrite support in
ForwardIndexHandler, and rollback back to the legacy formats.Reload / rewrite (
ForwardIndexHandler)shouldChangeRawCompressionTypeis replaced byshouldRewriteRawForwardIndex, which handles everycombination of existing on-disk format × new config:
compressionCodec(incl.PASS_THROUGH)isLegacyRevertTargetForFixedByteSv)Change detection compares canonical specs on both sides: the stored side is already canonical (V7
headers persist
CodecPipelineExecutor.getCanonicalSpec()), and the configured side is canonicalized byrunning it through
CodecPipelineExecutor.create(...)— nevertoDslString()or the raw config string —so semantically identical specs (e.g. differently-spelled defaults) never trigger a rewrite, and an
unchanged config is always a no-op.
V7 detection is positive (
reader.getCodecSpec() != null), not inferred from a null compression type; alegacy raw reader returning a null
ChunkCompressionTypenow fails loudly instead of silently skipping.Gate removal (all remaining sites)
ForwardIndexType.validate— gate replaced byvalidateCodecSpec(...), run only for enabled forwardindexes: parses/validates the pipeline via the public
CodecPipelineExecutor.createentry point(unknown codec, transform ordering, per-codec type compatibility) and enforces the V7 writer's shape
constraints (single-value INT/LONG) for specs the legacy raw formats cannot serve. Precise errors
replace the generic gate message.
ForwardIndexType.shouldCreateIndex— gate removed; codecSpec configs flow to the creator factory(wired in the previous PR).
ForwardIndexType.createMutableIndex— gate removed. Matching the original Add codec pipeline framework for raw forward index encoding #18229 behavior, themutable (consuming) forward index builds the standard in-memory format and deliberately ignores
codecSpec: the spec applies when the consuming segment is converted/committed to an immutable
segment. Realtime tables with a codecSpec consume normally.
ForwardIndexHandler.computeOperations— the fail-fast guard from the previous PR is replaced by thereal decision logic above.
OpenStructIndexType/OpenStructColumnSplitter— kept as a deliberate rejection, reworded fromthe temporary gate message to
"codecSpec is not supported for OPEN_STRUCT key: %s". The originalAdd codec pipeline framework for raw forward index encoding #18229 never wired codecSpec into OPEN_STRUCT per-key child columns (the splitter builds its own child
forward configs with a fixed LZ4 raw compression and would silently discard a per-key codecSpec), so an
explicit rejection is the honest behavior rather than silent config loss.
Docs
FieldConfig.CompressionCodecconstants get "prefer codecSpec" guidance in the new comma-list syntax(
SNAPPY→"SNAPPY",ZSTANDARD→"ZSTD(3)",DELTA→"DELTA,LZ4"with the on-disk-semanticscaveat, etc.);
getCompressionCodec()documents that it remains the only way to expressMV_ENTRY_DICTand the CLP family.TableConfigUtilscomment updated to the final behavior (codecSpec is validated on the resolvedForwardIndexConfigviaIndexType.validate, sonoDictionaryColumns-resolved RAW columns work).Tests
ForwardIndexHandlerTest: V7 no-op on unchanged canonical spec; V7 spec-change rewrite; V7compression-only spec rewritten back to legacy raw; V7→legacy
compressionCodecrollback with fullvalue verification; legacy→equivalent codecSpec no-op; legacy→different compression-only codecSpec
rewrite; legacy
DELTA/DELTADELTA→ V7DELTA,LZ4/DELTADELTA,LZ4migration reload preserving allvalues across chunks.
TableConfigUtilsTest: gate-rejection test replaced bytestCodecSpecValidation— accepts valid specs(compression-only on any RAW column incl. STRING/MV, transform chains on SV INT/LONG,
noDictionaryColumns-resolved RAW), rejects invalid ones with precise errors (unknown codec, transformafter packing transform, V7-requiring specs on MV or non-INT/LONG columns).
ForwardIndexTypeTest: mutable-index gate test replaced — a codecSpec config now builds the standardmutable forward index for realtime consumption.
ForwardIndexCreatorFactoryTest:shouldCreateIndexgate test flipped to acceptance.OpenStructIndexTypeTest/OpenStructColumnSplitterTest: assertions updated to the permanentrejection message.
Deliberately excluded
CompressionCodecMigratorand its tests (present in the original Add codec pipeline framework for raw forward index encoding #18229) are dropped from the seriesentirely — legacy
DELTA/DELTADELTAcolumns migrate through the normal reload path instead, coveredby
testLegacyTransformMigrationReloadPreservesValues.series adds it.
The final slice (integration tests + design doc) follows this PR but adds no production code.
Why master stays safe with only this merged
This PR is the gate-opener, so unlike the earlier slices it does activate the feature — safety comes
from the pipeline being complete underneath it:
the previous five PRs; this PR only removes the gates and adds the reload logic.
codecSpecfollow the exact pre-series codepaths (the legacy compression-change comparison is byte-for-byte the old logic), and reload of a
segment with an unchanged config is a no-op.
codecSpecto a legacycompressionCodec(or an equivalent compression-only spec) rewrites segments back to the legacy formats readable by
pre-V7 servers.
conversion.
operator explicitly configures a V7-requiring codecSpec, and older servers cannot read them — the
standard guidance (finish the server rollout before adopting V7-requiring specs) is unchanged from
Add codec pipeline framework for raw forward index encoding #18229.
Verification
Result: all tests pass. The stack root is synced with master, so this branch includes the #19282
chunk-caching fix that
testLegacyTransformMigrationReloadPreservesValuesdepends on (verified: a523-test batch across the codec suite at the chain tip runs green, including both migration variants
and
ForwardIndexHandlerContextTest).Stack (split of #18229)
Each PR is based on its predecessor's branch; GitHub retargets the next PR as each merges.