Generalize indexing schema versions - #1284
Conversation
690e775 to
ec0cb6b
Compare
ec0cb6b to
ab31afa
Compare
ab31afa to
609617b
Compare
609617b to
22bce59
Compare
09425ae to
f90f1aa
Compare
|
Pushed d3ff605, which changes the design in one substantive way and fixes five defects. I rewrote the PR description to match. Summary of the delta for anyone who already reviewed:
The breaking changes are gone. The earlier revision broke three things that I had not called out:
All three now accept the legacy name, and the logs emit both the new key and the deprecated alias. Defects fixed. The README and the decoder interface both promised a default to the latest version that the earlier revision had removed; the behaviour is back and both texts are now format neutral. This PR had also added a duplicate decoder section to the JSON gem README that named a class which does not exist. The indexer extension memoized into a name its own One limitation stays open. |
d3ff605 to
986f6cb
Compare
986f6cb to
57d43a4
Compare
The pipeline now treats `schema_version` as optional, so an ingestion format with no versions (such as protobuf) can omit it. Each ingestion adapter decides what a missing version means. The JSON adapter uses the latest available JSON schema version, and still validates the event against that version, so a malformed event still fails. This removes the breaking changes the previous revision introduced: - `Converters.upsert_event_for` accepts `__schema_version`, the legacy `__json_schema_version`, or neither. An existing generated project keeps working with no edit to `shared_factories.rb`. - The JSON adapter claims and reads the legacy `json_schema_version` envelope key, so a direct caller of `Indexer#processor.process` needs no edit. - The latency log and the warehouse dump log emit `schema_version` and also the deprecated alias `json_schema_version`, so existing dashboards keep working. - The version selection log keeps its JSON-specific field names to match its JSON-specific message type `ElasticGraphMissingJSONSchemaVersion`. It also fixes four defects found in review: - `elasticgraph-indexer/README.md` and `indexing_event_decoder.rb` promised a default to the latest version that the code no longer had. Both texts are now format neutral, and the JSON gem documents its own behaviour. - A duplicate "Indexing Event Decoder" section in the JSON gem README named a class that does not exist. Removed. - `IndexerExtension#ingestion_adapters` memoized into the shared name `@ingestion_adapters` while calling `super`, which assigned the same name. - `select_schema_version` sorted the available versions on every event. The warehouse dumper uses the fixed S3 key segment `unversioned` in place of `v<version>` for a version-less format, so the segment count stays the same.
57d43a4 to
4efc9a6
Compare
Why
The shared indexing pipeline required
json_schema_version, even though other ingestion formats may have no JSON schemas or version numbers. This PR introduces an optional, format-neutralschema_versionand keeps version resolution inside each ingestion adapter.What
Adapters return a normalized event alongside the record preparer. Operations, latency logs, and warehouse partitions use the schema version actually selected for that event. The JSON adapter accepts both version keys, gives
schema_versionprecedence, and rejects invalid values such asfalse. These rules apply equally to direct processor calls and decoded payloads.Decoders identify their format with
ingestion_format. The JSON decoder stampsjson, and untagged events remain compatible with existing JSON callers. A schema version no longer doubles as a format discriminator, so tagged formats route independently of adapter order and version presence. An explicitly different format is rejected even when JSON is the only installed adapter.The schema version is optional
Each adapter decides what an absent version means. JSON selects the latest available schema; an unavailable requested version selects the closest available schema. Both validation and record preparation use that selected version.
JSON events with missing versions still enter a versioned warehouse partition after resolution. Formats without versions use the fixed
unversionedS3 key segment. Publishers should keep sending explicit JSON schema versions and indexers should retain historical artifacts: replaying unversioned JSON after a schema change can behave differently.Backward compatibility
json_schema_version; JSON schema artifacts retain their existing version const.__schema_version, legacy__json_schema_version, or neither. Generic-key precedence matches ingestion, and invalid values remain available for validation.json_schema_versionalias. Both names report the selected version; fallback logs retain their existing requested and selected JSON-version fields.Review fixes
Version normalization now has one owner: the JSON adapter. This fixes conflicting-key precedence between decoded and direct events, false versions being treated as absent, and legacy versions disappearing downstream. Processor failures are correlated through normalized operation events, so datastore errors still identify all operations for the failed event.
Regression coverage exercises legacy, versionless, and fallback events through the warehouse pipeline; multiple adapters in both orders; selected-schema field preparation; and failures after normalization.
Risk
This changes the adapter result contract introduced earlier in the stack: successful results now require
event:. Downstream logs and warehouse partitions report the selected schema version instead of an unavailable requested version. Optional JSON versions still tie interpretation to the indexer's installed schema; the upgrade guide documents that tradeoff.Testing
No manual deployment testing. Automated regressions cover the ingestion boundaries and the full repository suite validates the combined stack.
Stack
Current PR is marked with
->.