Skip to main content

Transaction

Struct Transaction 

Source
pub struct Transaction {
    pub read_version: u64,
    pub uuid: String,
    pub operation: Operation,
    pub tag: Option<String>,
    pub transaction_properties: Option<Arc<HashMap<String, String>>>,
}
Expand description

A change to a dataset that can be retried

This contains enough information to be able to build the next manifest, given the current manifest.

Fields§

§read_version: u64

The version of the table this transaction is based off of. If this is the first transaction, this should be 0.

§uuid: String§operation: Operation§tag: Option<String>§transaction_properties: Option<Arc<HashMap<String, String>>>

Implementations§

Source§

impl Transaction

Source

pub fn new_from_version(read_version: u64, operation: Operation) -> Self

Source

pub fn new(read_version: u64, operation: Operation, tag: Option<String>) -> Self

Source§

impl Transaction

Source

pub fn prune_updated_fields_from_indices( indices: &mut [IndexMetadata], updated_fragments: &[Fragment], fields_modified: &[u32], )

If an operation modifies one or more fields in a fragment then we need to remove that fragment from any indices that cover one of the modified fields.

Source§

impl Transaction

Source

pub async fn restore_old_manifest( object_store: &ObjectStore, commit_handler: &dyn CommitHandler, base_path: &Path, version: u64, config: &ManifestBuildConfig, tx_path: &str, current_manifest: &Manifest, ) -> Result<(Manifest, Vec<IndexMetadata>)>

Source

pub fn logical_index_segments(indices: &[IndexMetadata]) -> LogicalIndexSegments

Every non-system logical index, mapped to what determines its coverage.

A logical index may be backed by several physical segments, so “did this index change” is a question about the whole set. Sorted by UUID so the two sides compare positionally.

Source

pub fn apply_mem_wal_index_coverage( final_indices: &mut [IndexMetadata], segments_before: &LogicalIndexSegments, read_version_state: Option<ReadVersionState<'_>>, new_version: u64, ) -> Result<()>

Apply MemWAL index-coverage rules once the final index list is known.

Coverage records that a base-table index contains the rows a compaction copied in, and the WAL pod retires SSTables against it.

It is derived, not reported. An index covering every fragment live at the transaction’s read version holds every row compaction had copied in by then, so it is caught up to that version’s compacted_sstables. That is the only proof available: nothing maps a generation to the fragments its rows landed in, so covering the table as the transaction read it is how an index shows it covered those rows. Fragments appended since are a later gap.

Deriving rather than transmitting means no claim can go stale between inspection and commit, the answer survives rebase (read_version is fixed for a transaction’s life), and any operation can earn coverage – an ordinary reindex that fully covers no longer has to throw its work away and wait for a repair.

Only meaningful once catch-up is required, where a missing entry means “not caught up” and the SSTables stay. A legacy table reads a missing entry as “fully caught up”, so this leaves it untouched rather than making the table look more covered than it is.

Source

pub fn withdraw_coverage_invalidated_after_build( indices: &mut [IndexMetadata], changed: &[String], new_version: u64, ) -> Result<()>

Drop coverage for indices a post-build_manifest step narrowed.

The derivation runs while the manifest is being built, but the index list is not final there: migrate_indices can recalculate a segment’s fragment bitmap and keep its UUID, so an index can narrow after its position was decided. It reports which ones it touched rather than the caller re-snapshotting every bitmap to find out. Only ever removes.

Source

pub fn build_manifest( &self, current_manifest: Option<&Manifest>, current_indices: Vec<IndexMetadata>, transaction_file_path: &str, config: &ManifestBuildConfig, ) -> Result<(Manifest, Vec<IndexMetadata>)>

Create a new manifest from the current manifest and the transaction.

current_manifest should only be None if the dataset does not yet exist.

Source

pub fn build_manifest_with_read_version( &self, current_manifest: Option<&Manifest>, current_indices: Vec<IndexMetadata>, transaction_file_path: &str, config: &ManifestBuildConfig, read_version_state: Option<ReadVersionState<'_>>, ) -> Result<(Manifest, Vec<IndexMetadata>)>

Self::build_manifest with the version this transaction read.

Supplied by the commit path, which already materializes that version. None where there is none to read – dataset creation and detached commits – in which case no index can be shown to cover it and coverage is left as the invalidation rules put it.

Trait Implementations§

Source§

impl Clone for Transaction

Source§

fn clone(&self) -> Transaction

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 Transaction

Source§

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

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

impl DeepSizeOf for Transaction

Source§

fn deep_size_of_children(&self, __context: &mut Context) -> usize

Source§

fn deep_size_of(&self) -> usize

Source§

impl From<&Transaction> for Transaction

Source§

fn from(value: &Transaction) -> Self

Converts to this type from the input type.
Source§

impl From<&Transaction> for Transaction

Source§

fn from(value: &Transaction) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Transaction

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Transaction

Source§

impl TryFrom<Transaction> for Transaction

Source§

type Error = Error

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

fn try_from(message: Transaction) -> Result<Self>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

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<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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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 = !

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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