Skip to content
Open
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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/datastore/src/locking_tx_datastore/datastore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ impl Locking {
);

let (mut tables, blob_store) = committed_state.persistent_tables_and_blob_store();
let unflushed_snapshot = repo.create_snapshot(&mut tables, blob_store, tx_offset)?;
let unflushed_snapshot = repo.create_snapshot(&mut tables, blob_store.scan(), tx_offset)?;

Ok(Some((tx_offset, unflushed_snapshot)))
}
Expand Down
6 changes: 3 additions & 3 deletions crates/engine/src/relational_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4285,10 +4285,10 @@ mod tests {
let mut hard_linked_on = 0;
let mut hard_linked_off = 0;

let (snapshot, compress) = Snapshot::read_from_file(&snapshot_dir.snapshot_file(last_compress))?;
let (manifest, compress) = Snapshot::read_from_file(&snapshot_dir.snapshot_file(last_compress))?;
assert!(compress.is_compressed());
let repo = SnapshotRepository::object_repo(&snapshot_dir)?;
for (_, path) in snapshot.files(&repo) {
let snapshot = manifest.into_writable(&snapshot_dir)?;
for path in snapshot.file_paths() {
match path.metadata()?.nlink() {
0 => hard_linked_off += 1,
_ => hard_linked_on += 1,
Expand Down
33 changes: 33 additions & 0 deletions crates/paths/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,45 @@ path_type! {
/// `{data-dir}/replica/$replica_id/snapshots/$tx_offset.snapshot_dir/$tx_offset.snapshot_bsatn`
SnapshotFilePath: file
}

impl SnapshotFilePath {
pub fn snapshot_dir(&self) -> SnapshotDirPath {
SnapshotDirPath(
self.0
.parent()
.map(ToOwned::to_owned)
.expect("snapshot file must be in a directory"),
)
}
}

path_type! {
/// The objects directory for a snapshot.
/// `{data-dir}/replica/$replica_id/snapshots/$tx_offset.snapshot_dir/objects`
SnapshotObjectsPath: dir
}

impl SnapshotObjectsPath {
pub fn pages(&self) -> SnapshotPagesPath {
SnapshotPagesPath(self.0.join("pages"))
}

pub fn blobs(&self) -> SnapshotBlobsPath {
SnapshotBlobsPath(self.0.join("blobs"))
}
}
path_type! {
/// The pages directory within a [SnapshotObjectsPath]
/// `{data-dir}/replica/$replica_id/snapshots/$tx_offset.snapshot_dir/objects/pages`
SnapshotPagesPath: dir
}

path_type! {
/// The blobs directory within a [SnapshotObjectsPath]
/// `{data-dir}/replica/$replica_id/snapshots/$tx_offset.snapshot_dir/objects/blobs`
SnapshotBlobsPath: dir
}

path_type! {
/// The commit log directory. `{data-dir}/replica/$replica_id/clog`
CommitLogDir: dir
Expand Down
1 change: 1 addition & 0 deletions crates/snapshot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ spacetimedb-runtime = { path = "../runtime" }
anyhow.workspace = true
env_logger.workspace = true
pretty_assertions = { workspace = true, features = ["unstable"] }
proptest.workspace = true
rand.workspace = true

[lints]
Expand Down
8 changes: 8 additions & 0 deletions crates/snapshot/proptest-regressions/tests/versions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Seeds for failure cases proptest has generated in the past. It is
# automatically read and these particular cases re-run before any
# novel cases are generated.
#
# It is recommended to check this file in to source control so that
# everyone who runs the test benefits from these saved cases.
cc ed8aa5846ab7c2b3c3af2abef92c67fe65f84f971ccee9c1cabe667d554e6fd4 # shrinks to source_version = 2, offset = 0, hash = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], uses = 0
cc fd5da47bbaeaa778260719ea5d1115675ead43444848be5b82cf80c44d53f283 # shrinks to bytes = [], row = 0, offset = 0, compressed = false
Loading
Loading