Repository navigation
Minor code cleanup: store enums in Atomic<T> instead of integer atomics - #7920
Merged
Merged
Conversation
The runtime kept memory pressure in an AtomicU8 and converted it with casts and try_from().unwrap(). Derive NoUninit for MemoryPressure and store it in an atomic::Atomic instead. It is repr(u8), so the atomic is still lock-free. Signed-off-by: Ben Pfaff <blp@feldera.com>
The Delta input metrics kept the phase in an AtomicU64 and cast each DeltaPhase to u64 on store. Derive NoUninit for DeltaPhase and store it in an atomic::Atomic instead, as IcebergPhase does. Use repr(u8), since the repr no longer has to match an AtomicU64. Signed-off-by: Ben Pfaff <blp@feldera.com>
The NATS input metrics kept the retry state in an AtomicU64 and cast each RetryState to u64 on store. Derive NoUninit and Default for RetryState and store it in an atomic::Atomic instead, with repr(u8). The test snapshot now carries the enum, so the tests compare variants instead of casts. Signed-off-by: Ben Pfaff <blp@feldera.com>
Follow mode sets IcebergPhase::Follow, but the enum still marked it as reserved and dead code, and the phase gauge's help text still said "1 reserved for follow mode". Drop the stale attribute and comment, and make the help text and the metrics reference list 1=follow. Also use repr(u8), as for DeltaPhase. The gauge values do not change. Signed-off-by: Ben Pfaff <blp@feldera.com>
Contributor
|
LGTM. This is a refactor with no behaviour change: the gauge encodings stay the same, and the only user-visible change is the Iceberg help text, which
|
mihaibudiu
approved these changes
Nov 10, 2026
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.
Some enums were kept in integer atomics (
AtomicU8,AtomicU64) and converted withascasts on store andtry_from(...).unwrap()on load. This PR stores them inatomic::Atomic<T>with aNoUninitderive, asPipelineStateandIcebergPhasealready do. Each enum usesrepr(u8), so the atomic is a lock-freeAtomicU8.[dbsp]MemoryPressuretry_from(...).unwrap()on each load.dbspnow depends onatomic.[connectors]DeltaPhaseas u64casts.dbsp_connectorsnow depends onbytemuck.[connectors]RetryStateDefault(Healthy). The test snapshot now holds the enum.[iceberg]IcebergPhaseAtomic. Changes torepr(u8)and removes the stale "reserved" comment and#[allow(dead_code)]onFollow, which follow mode now uses.The gauge values do not change. The help text of
input_connector_iceberg_phasechanges from "0=loading_snapshot, 2=completed (1 reserved for follow mode)" to "0=loading_snapshot, 1=follow, 2=completed".metrics.mdhas the same edit.Describe Manual Test Plan
cargo check --testsfordbsp,dbsp_connectors(withwith-nats) andfeldera-iceberg.cargo test -p dbsp_connectors --features with-nats --lib nats::input::metrics: 2 passed.Checklist
Breaking Changes?
None.
feldera-typesonly adds aNoUninitderive toMemoryPressure.