Repository navigation
data-plane: view storage fixes from the live demo (cache charge, label columns, RFC 3339 times, format 4) - #871
Merged
Merged
Conversation
…e segment dictionary (#865) A view window read back from its file was charged Batch::memory_bytes, which counts the segment's shared text dictionary once per text column (about 5.9 MB per window against 0.4-1.6 MB real), so the 2 GiB window cache held about 360 windows and thrashed. Both paths now charge window_batch_bytes (plus a read-back window's mapped state columns), and ViewStore::bytes counts each live segment dictionary once. Demo replay, minutes 6-12: hit ratio 0.808 -> 0.988, cold reads 55.2 -> 3.8 MB/s.
…ty (#869) A view text column whose every row holds its series identity's label of the column's name is no longer written: the fragment marks it IDENTITY_LABEL and a read rebuilds it from the identity column's keys through a per-segment label-value array (counted once per segment). View file format version 3; older segments are set aside at startup. The writer looks each identity up once per segment. Demo replay, minutes 6-12: view bytes written 19.14 -> 17.17 GB/h, view files 3.82 -> 3.24 GB; cold-read parity suites unchanged.
…API does (#868) time, start and end are parsed as Prometheus' parseTime does: Unix seconds with an optional fraction, else RFC 3339 (as Go's time.Parse(RFC3339Nano) accepts it), Prometheus' min/max time strings forwarded, an empty time meaning now, and anything else refused with Prometheus' 400 text. RFC 3339 instant and range queries (as vmalert sends them) are answered from the plan, with the same answers as their Unix-seconds forms.
View file format 4: each (view, window) fragment is zstd level 1 compressed, and DDSketch and exact state columns are stored in a lossless compact form (state_codec.rs) and rebuilt byte for byte into the mapped layout on read; text keys are varint deltas. Formats 2 and 3 are set aside at startup. Demo segments re-encoded: 7.23 GB -> 0.94 GB (DDSketch 1 s 160 -> 17 B/row, counter 72 -> 7.4, sum 40 -> 3.2). Cold reads of pages not in memory 2-5x faster; page-cache-resident window decode 1-3 ms slower per 10k rows. Review fixes: exact cache charge for rebuilt DDSketch and label columns, write-size cap, per-thread zstd contexts.
series_ids::intern is intern_pairs, CacheStats has no loads (the tier's cold_reads counts decodes), and decode_fragment takes the columnar bytes; cargo fmt.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Review first
feat/tiered-view-storage(fix(data_plane): charge a read-back view window its own bytes, not the segment dictionary #865, feat(data_plane): read view label columns back from the series identity #869, fix(data_plane): read query times as RFC 3339 too, as the Prometheus API does #868, data-plane: compact, compressed view fragments (format 4) #866), ported tomain. Each is its own commit, so the PR can be read commit by commit.*.stale) and are not read: a data plane upgraded to this build starts its views empty.mainwere resolved by hand (see "Port notes"). An independent review of the port found no bugs; its one doc fix is the last commit.Why
The live demo showed four problems in the view store and the query API:
job/region/… label texts, though they follow from the series identity (feat(data_plane): read view label columns back from the series identity #869).timeas RFC 3339; the data plane planned only Unix seconds and forwarded everything else to its fallback store (fix(data_plane): read query times as RFC 3339 too, as the Prometheus API does #868).What
window_batch_bytes+ its state bytes; each segment dictionary counted once in the view bytesIDENTITY_LABEL), rebuilt on read from the identity keys; format 3time/start/endaccepted as Unix seconds or RFC 3339; emptytime= now; an unparsable time is a 400, as in PrometheusInterfaces
Port notes
ViewFiles::appendonmaincreates the active segment lazily. The labels-by-identity cache from feat(data_plane): read view label columns back from the series identity #869 is therefore built in a local map when no segment is active, and that map becomes the new segment's.prometheus.rskeepsmain's crate-private visibility and its upper bound on the range step.mainhas since changed were adapted:series_ids::internis nowintern_pairs,CacheStats::loadsis replaced by the tier'scold_reads, anddecode_fragmenttakes the columnar bytes.main's test of the old directory layout is not part of this port.Tests
Run on this branch (changed parts only):
cargo fmt --check;cargo clippy -p data_plane --all-targets -D warnings;cargo test -p data_plane --libfor store, persist, segment, window_cache, series_ids, state_codec and prometheus; and--testview_cache_charge, view_tiering, view_persistence, view_cold_allocations, view_memory, ingest_shards, time_params, server and no_forward.ingest_shards::a_shard_running_ahead_does_not_close_windows_earlyfailed once in the first run (a 422 at t=30) and passed in 3 reruns on this branch and onmain: a timing flake, not caused by this change.