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: u64The 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
impl Transaction
Source§impl Transaction
impl Transaction
Sourcepub fn prune_updated_fields_from_indices(
indices: &mut [IndexMetadata],
updated_fragments: &[Fragment],
fields_modified: &[u32],
)
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
impl Transaction
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>)>
Sourcepub fn logical_index_segments(indices: &[IndexMetadata]) -> LogicalIndexSegments
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.
Sourcepub fn apply_mem_wal_index_coverage(
final_indices: &mut [IndexMetadata],
segments_before: &LogicalIndexSegments,
read_version_state: Option<ReadVersionState<'_>>,
new_version: u64,
) -> Result<()>
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.
Sourcepub fn withdraw_coverage_invalidated_after_build(
indices: &mut [IndexMetadata],
changed: &[String],
new_version: u64,
) -> Result<()>
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.
Sourcepub fn build_manifest(
&self,
current_manifest: Option<&Manifest>,
current_indices: Vec<IndexMetadata>,
transaction_file_path: &str,
config: &ManifestBuildConfig,
) -> Result<(Manifest, Vec<IndexMetadata>)>
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.
Sourcepub 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>)>
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
impl Clone for Transaction
Source§fn clone(&self) -> Transaction
fn clone(&self) -> Transaction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Transaction
impl Debug for Transaction
Source§impl DeepSizeOf for Transaction
impl DeepSizeOf for Transaction
fn deep_size_of_children(&self, __context: &mut Context) -> usize
fn deep_size_of(&self) -> usize
Source§impl From<&Transaction> for Transaction
impl From<&Transaction> for Transaction
Source§fn from(value: &Transaction) -> Self
fn from(value: &Transaction) -> Self
Source§impl From<&Transaction> for Transaction
impl From<&Transaction> for Transaction
Source§fn from(value: &Transaction) -> Self
fn from(value: &Transaction) -> Self
Source§impl PartialEq for Transaction
impl PartialEq for Transaction
impl StructuralPartialEq for Transaction
Source§impl TryFrom<Transaction> for Transaction
impl TryFrom<Transaction> for Transaction
Auto Trait Implementations§
impl !RefUnwindSafe for Transaction
impl !UnwindSafe for Transaction
impl Freeze for Transaction
impl Send for Transaction
impl Sync for Transaction
impl Unpin for Transaction
impl UnsafeUnpin for Transaction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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