Skip to main content

MergeEntry

Struct MergeEntry 

Source
pub struct MergeEntry {
    pub run_index: usize,
    pub key: DecoratedKey,
    pub clustering_key: Option<ClusteringKey>,
    pub timestamp: i64,
    pub row_data: RowData,
    pub complex_deletions: Vec<ComplexDeletion>,
    pub range_deletion: Option<RangeTombstone>,
    pub row_deletion: Option<(i64, i32)>,
    pub partition_deletion: Option<(i64, i32)>,
}
Expand description

Entry in the merge stream

Represents a single row from one of the input SSTables. This is the fundamental unit that flows through the merge heap.

Fields§

§run_index: usize

Which SSTable this came from (0 = newest)

§key: DecoratedKey

Partition key with token

§clustering_key: Option<ClusteringKey>

Clustering key (None for tables without clustering)

§timestamp: i64

Timestamp in microseconds since Unix epoch

§row_data: RowData

Row data (live cells or tombstone)

§complex_deletions: Vec<ComplexDeletion>

Complex (collection / UDT) deletion markers for the multi-cell columns of this (pk, ck) (issue #886 substrate).

Carried through the merge so the per-cell-path collection/UDT followup (#844) and shadow-before-purge (#887) can preserve collection/UDT deletion timestamps. reconcile_cluster unions and preserves these across a cluster, but reconciliation does not yet consult them and the writer does not yet apply them — defaults to empty, so output is byte-unchanged. Population (per-element reader emit) lands in #899.

§range_deletion: Option<RangeTombstone>

Range-deletion marker covering a span of clustering keys (issue #886 substrate).

A first-class slot so range tombstones can flow through the merge stream instead of being skipped by the parser; applying them to shadow covered cells is the follow-up #846. Carried (and timestamp-max-preserved) through reconcile_cluster but not yet consulted by reconciliation or the writer, so output is byte-unchanged. None when this entry carries no range deletion.

§row_deletion: Option<(i64, i32)>

Row-level deletion that COEXISTS with this entry’s surviving live cells (issue #932).

Some((deletion_time_micros, local_deletion_time_secs)) when a row tombstone whose timestamp is OLDER than the surviving cells must be kept alongside RowData::Live. RowData::Live has no row-deletion slot, so — mirroring the carry-only complex_deletions / range_deletion fields — the coexisting deletion rides here instead of forcing a RowData change across ~100 RowData::Live sites. reconcile_cluster folds it into the winning row deletion and re-attaches it to the emitted live entry; merge_entry_to_mutation emits it as Mutation::row_tombstone. Without this, a partial compaction that keeps newer cells would DROP the row deletion and let older cells of other columns (in SSTables not part of the compaction) resurrect. None for a row with no coexisting deletion.

§partition_deletion: Option<(i64, i32)>

Partition-level deletion (markedForDeleteAt µs, localDeletionTime s) carried by a synthetic partition-tombstone carrier entry (issue #1072).

Some(..) ONLY on the carrier entry the reader emits for a partition header that has a tombstone (empty RowData::Live, clustering_key: None). The merge extracts the MAX markedForDeleteAt across sources, applies it as the OUTERMOST per-cell <= shadow floor for the whole partition, and re-emits the surviving tombstone via merge_entry_to_mutation (→ Mutation::partition_tombstone). Without this a newer partition tombstone in one SSTable failed to shadow older live rows in another, resurrecting the deleted partition. None for every non-carrier entry.

Implementations§

Source§

impl MergeEntry

Source

pub fn new( run_index: usize, key: DecoratedKey, clustering_key: Option<ClusteringKey>, timestamp: i64, row_data: RowData, ) -> Self

Create a new merge entry.

The carry-only #886 substrate fields (complex_deletions, range_deletion) default to empty/None; attach them with with_complex_deletions / with_range_deletion once the reader emit surfaces them (#899).

Source

pub fn with_complex_deletions( self, complex_deletions: Vec<ComplexDeletion>, ) -> Self

Attach complex-deletion markers (issue #886 substrate; carry-only).

Source

pub fn with_row_deletion(self, deletion_time: i64, ldt: i32) -> Self

Attach a coexisting row-level deletion (issue #932).

deletion_time is markedForDeleteAt (microseconds); ldt is the localDeletionTime (GC-clock seconds, 0 = not surfaced). Used when a row’s surviving cells are newer than a row tombstone that must still be preserved so it keeps shadowing older cells in non-compacted SSTables.

Source

pub fn with_range_deletion(self, range_deletion: RangeTombstone) -> Self

Attach a range-deletion marker (issue #886 substrate; carry-only).

Source

pub fn with_partition_deletion(self, partition_deletion: (i64, i32)) -> Self

Attach a partition-level deletion (issue #1072).

deletion_time is markedForDeleteAt (microseconds); ldt is the localDeletionTime (GC-clock seconds). Marks this entry as the synthetic partition-tombstone carrier so the merge applies the partition floor and re-emits the surviving tombstone.

Source

pub fn is_metadata_only_no_op(&self) -> bool

True when this entry has NO writer-emittable content at all — an empty RowData::Live { cells: vec![] } with no row tombstone and no carried deletion metadata. Routing such an entry to the writer would create a PHANTOM live empty (pure-PK) row at timestamp 0 (DataWriter::merge_row_group treats a no-op mutation as a primary-key insert), so merge filters it.

Epic #899 Phase C: a COMPLEX DELETION is consumed by the writer (a real CellOperation::ComplexDeletion marker), so a complex-deletion-only entry is NOT a no-op.

Issue #933: a RANGE DELETION is now ALSO consumed by the compaction writer — merge_entry_to_mutation threads it onto the mutation’s range_tombstones, which the writer interleaves as on-disk bound markers AND uses to shadow covered same-partition rows. A range-deletion-only carrier is therefore NO LONGER a no-op and MUST reach the writer (dropping it would resurrect the covered rows it shadowed — roborev #959 High #2). In practice reconcile_cluster never emits a truly-empty entry (one with empty cells, no row tombstone, and no carried metadata reconciles to None), so this guard is now effectively unreachable but kept as a defensive phantom-row filter.

Source

pub fn is_partition_delete_carrier(&self) -> bool

True when this entry is a synthetic partition-tombstone carrier (issue #1072): an empty live row whose only payload is partition_deletion. Produced by [Self::build_merge_entry] from a reader PartitionDelete. Such an entry produces NO output row (it yields a Mutation::partition_tombstone, not a clustering row), so the merge must not count it toward output row counts — but it MUST reach the writer.

Trait Implementations§

Source§

impl Clone for MergeEntry

Available on crate feature write-support only.

Manual Clone (was #[derive(Clone)]) so the #1664 double-clone regression guard can count MergeEntry clones via a #[cfg(test)]-gated recorder. The clone is field-wise identical to the former derived clone (all 9 fields); in a production (non-test) build the record() call vanishes entirely, so this is a plain field-wise clone with ZERO added cost.

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MergeEntry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for MergeEntry

Source§

impl Ord for MergeEntry

Available on crate feature write-support only.

Ord implementation for min-heap routing ONLY (not LWW winner selection).

This orders entries so the heap yields them grouped by partition and clustering key. The actual equal-timestamp Delete-vs-Live winner is chosen in merge_partition_rows (timestamp → liveness → run_index), NOT here.

Order by:

  1. Token (ascending)
  2. Key bytes (ascending, for hash collisions)
  3. Clustering key (ascending, schema-aware)
  4. Run index (ascending) - stable routing tiebreak only
Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for MergeEntry

Source§

fn eq(&self, other: &MergeEntry) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for MergeEntry

Available on crate feature write-support only.
Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for MergeEntry

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more