Skip to main content

MetadataEntry

Enum MetadataEntry 

Source
pub enum MetadataEntry {
Show 15 variants CatalogDdl { payload: Vec<u8>, }, CatalogDdlAudited { payload: Vec<u8>, auth_user_id: String, auth_user_name: String, sql_text: String, }, Batch { entries: Vec<MetadataEntry>, }, TopologyChange(TopologyChange), RoutingChange(RoutingChange), ClusterVersionBump { from: u16, to: u16, }, DescriptorLeaseGrant(DescriptorLease), DescriptorLeaseRelease { node_id: u64, descriptor_ids: Vec<DescriptorId>, }, DescriptorDrainStart { descriptor_id: DescriptorId, up_to_version: u64, expires_at: Hlc, }, DescriptorDrainEnd { descriptor_id: DescriptorId, }, CaTrustChange { add_ca_cert: Option<Vec<u8>>, remove_ca_fingerprint: Option<[u8; 32]>, }, SurrogateAlloc { hwm: u32, }, JoinTokenTransition { token_hash: [u8; 32], transition: JoinTokenTransitionKind, ts_ms: u64, }, MigrationCheckpoint { migration_id: String, phase: MigrationPhaseTag, attempt: u32, payload: MigrationCheckpointPayload, crc32c: u32, ts_ms: u64, }, MigrationAbort { migration_id: String, reason: String, compensations: Vec<Compensation>, },
}
Expand description

An entry in the replicated metadata log.

Every mutation to cluster-wide state — DDL, topology, routing, descriptor leases, cluster version bumps — is encoded as one of these variants, proposed against the metadata Raft group, and applied on every node by a crate::metadata_group::applier::MetadataApplier.

The CatalogDdl variant is the single wire shape for every DDL mutation. Its payload is an opaque, host-serialized nodedb::control::catalog_entry::CatalogEntry value — the nodedb-cluster crate is deliberately ignorant of the host’s per-DDL-object struct shapes. This keeps the cluster crate layering-clean and makes adding new DDL object types on the host side a zero-wire-change operation.

Variants§

§

CatalogDdl

Single generic DDL entry carrying an opaque host-side payload. Produced by every pgwire DDL handler via nodedb::control::metadata_proposer::propose_catalog_entry.

Fields

§payload: Vec<u8>
§

CatalogDdlAudited

DDL entry with attached audit context. Produced by pgwire DDL handlers that have the authenticated identity + raw statement text bound at the call site (every CREATE, ALTER, DROP, GRANT, REVOKE path). Applied identically to CatalogDdl on every node; additionally, the production applier fsync- appends an audit record to the audit segment WAL with the authenticated user, HLC at commit, descriptor versions before

  • after, and the raw SQL — exactly what J.4 requires.

Carries its own payload so legacy proposers (internal lease and descriptor-drain flows that have no SQL text) can keep using the plain CatalogDdl variant without synthesizing fake audit context.

Fields

§payload: Vec<u8>
§auth_user_id: String

Authenticated user id at propose time.

§auth_user_name: String

Authenticated username at propose time.

§sql_text: String

Raw SQL statement as the client sent it. Not parsed here — the cluster crate is opaque to SQL syntax. Persisted on every replica so post-hoc audit queries don’t depend on the proposing node still being alive.

§

Batch

Atomic batch of metadata entries proposed by a transactional DDL session (BEGIN; CREATE ...; CREATE ...; COMMIT;). The applier unpacks and applies each sub-entry in order at a single raft log index, so either all commit or none do.

Fields

§

TopologyChange(TopologyChange)

§

RoutingChange(RoutingChange)

§

ClusterVersionBump

Fields

§from: u16
§to: u16
§

DescriptorLeaseGrant(DescriptorLease)

§

DescriptorLeaseRelease

Fields

§node_id: u64
§descriptor_ids: Vec<DescriptorId>
§

DescriptorDrainStart

Begin draining leases on a descriptor. While a drain entry is active, any acquire_descriptor_lease at version <= up_to_version must be rejected cluster-wide so the in-flight DDL that bumps the version can make progress.

expires_at is the HLC at which this drain entry is considered stale and ignored by is_draining checks on read. Acts as a TTL that prevents a crashed proposer from leaving an orphaned drain that blocks the cluster forever.

Fields

§descriptor_id: DescriptorId
§up_to_version: u64
§expires_at: Hlc
§

DescriptorDrainEnd

End draining on a descriptor. Emitted explicitly on drain timeout so the cluster can make progress. On the happy path (successful Put* apply), the host-side applier clears drain implicitly — this variant is the escape hatch for the failure path.

Fields

§descriptor_id: DescriptorId
§

CaTrustChange

Cluster-wide CA trust mutation (L.4). Proposed by nodedb rotate-ca --stage (to add a new CA) and nodedb rotate-ca --finalize --remove <fp> (to drop an old CA). Applied on every node by MetadataCommitApplier: writes or deletes data_dir/tls/ca.d/<fp_hex>.crt and triggers a live rebuild of the rustls server + client configs so the new trust set takes effect without restart.

add_ca_cert and remove_ca_fingerprint are independent: the --stage form sets add_ca_cert = Some(new_ca_der) + remove_ca_fingerprint = None; --finalize flips both. A single entry carrying both performs the cutover atomically once the operator has confirmed every node has reissued.

Fields

§add_ca_cert: Option<Vec<u8>>

DER-encoded CA certificate to add to the trust set. None when this entry only removes.

§remove_ca_fingerprint: Option<[u8; 32]>

SHA-256 fingerprint of the CA to remove from the trust set. None when this entry only adds.

§

SurrogateAlloc

Advance the cluster-wide surrogate high-watermark to hwm.

Proposed by the metadata-group leader whenever the local SurrogateRegistry flush threshold trips (every 1024 allocations or 200 ms, whichever comes first). Applied on every node by the host-side MetadataCommitApplier which calls SurrogateRegistry::restore_hwm(hwm) — idempotent and monotonic, so out-of-order replay or duplicate delivery are both safe. Followers must never allocate surrogates locally; they only advance their in-memory HWM via these log entries.

Fields

§hwm: u32
§

JoinTokenTransition

Join-token lifecycle transition (L.4). Proposed by the bootstrap-listener handler on every state change so that all Raft peers can enforce single-use token semantics even after a crash-restart cycle.

token_hash is the SHA-256 of the token hex string — the raw token is never stored in the log. transition encodes the direction: Register for first issuance, BeginInFlight when a joiner presents the token, MarkConsumed when the bundle is delivered, RevertInFlight when the dead-man timer fires, and MarkExpired / MarkAborted for the terminal states.

Fields

§token_hash: [u8; 32]
§ts_ms: u64

Unix-ms timestamp at the time of the proposal.

§

MigrationCheckpoint

Crash-safe migration phase checkpoint. Persisted on every phase transition; on coordinator restart, recovery scans the MigrationStateTable and resumes from the latest committed checkpoint. Apply is idempotent on (migration_id, phase, attempt) — duplicate delivery is a no-op. CRC32C mismatch is fatal.

Fields

§migration_id: String

Hyphenated UUID string (zerompk does not serialize uuid::Uuid).

§attempt: u32
§crc32c: u32
§ts_ms: u64
§

MigrationAbort

Replicated migration abort with ordered compensations. Each compensation is applied in order; any failure is fatal (no warn-and-continue). On success, the migration’s row in MigrationStateTable is deleted.

Fields

§migration_id: String
§reason: String
§compensations: Vec<Compensation>

Trait Implementations§

Source§

impl Clone for MetadataEntry

Source§

fn clone(&self) -> MetadataEntry

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 MetadataEntry

Source§

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

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

impl<'de> Deserialize<'de> for MetadataEntry

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<'__msgpack_de> FromMessagePack<'__msgpack_de> for MetadataEntry

Source§

fn read<R: Read<'__msgpack_de>>(reader: &mut R) -> Result<Self, Error>
where Self: Sized,

Reads the MessagePack representation of this value from the provided reader.
Source§

impl PartialEq for MetadataEntry

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for MetadataEntry

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl ToMessagePack for MetadataEntry

Source§

fn write<W: Write>(&self, writer: &mut W) -> Result<(), Error>

Writes the MessagePack representation of this value into the provided writer.
Source§

impl Eq for MetadataEntry

Source§

impl StructuralPartialEq for MetadataEntry

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

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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<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
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> FromMessagePackOwned for T
where T: for<'a> FromMessagePack<'a>,

Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,