Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/types/src/restate_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl SemanticRestateVersion {
Self(semver::Version::parse("0.0.0-unknown").unwrap())
}

pub fn new(major: u64, minor: u64, patch: u64) -> Self {
pub const fn new(major: u64, minor: u64, patch: u64) -> Self {
Self(semver::Version::new(major, minor, patch))
}

Expand Down
3 changes: 2 additions & 1 deletion crates/types/src/schema/metadata/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ use crate::{Version, Versioned, identifiers};
/// Serializable data structure representing the schema registry
///
/// Do not leak the representation as this data structure, as it strictly depends on SchemaUpdater, SchemaRegistry and the Admin API.
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[derive(derive_more::Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(from = "serde_hacks::Schema", into = "serde_hacks::Schema")]
#[debug("Schema(version: {version})")]
pub struct Schema {
/// This gets bumped on each update.
version: Version,
Expand Down
11 changes: 11 additions & 0 deletions crates/wal-protocol/src/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use std::ops::RangeInclusive;

use restate_types::identifiers::{LeaderEpoch, PartitionId, PartitionKey};
use restate_types::logs::{Keys, Lsn};
use restate_types::schema::Schema;
use restate_types::time::MillisSinceEpoch;
use restate_types::{GenerationalNodeId, SemanticRestateVersion};

Expand Down Expand Up @@ -62,3 +63,13 @@ pub struct PartitionDurability {
/// Timestamp which the durability point was updated
pub modification_time: MillisSinceEpoch,
}

/// Consistently store schema across partition replicas.
///
/// Since v1.6.0.
#[derive(Debug, Clone)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct UpsertSchema {
pub partition_key_range: Keys,
pub schema: Schema,
}
Comment on lines +72 to +75
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A nice little optimization is to break the version from schema, and only deserialize the schema if the version is eligible for the update.

struct UpsertSchema {
  pub partition_key_range: Keys,
  pub version: Version,
  pub schema_raw: Bytes,
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a great idea

Copy link
Contributor Author

@muhamadazmy muhamadazmy Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed to streamline this optimisation as part of Envelope v2

Loading
Loading