Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commitlog offset index #1671

Merged
merged 6 commits into from
Sep 24, 2024
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,182 changes: 1,220 additions & 962 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions crates/bindings/tests/snapshots/deps__duplicate_deps.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
source: crates/bindings/tests/deps.rs
expression: cargo tree -p spacetimedb -e no-dev -d --depth 0
---
syn v1.0.109
heck v0.4.1

syn v2.0.39
heck v0.5.0
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
source: crates/bindings/tests/deps.rs
expression: "cargo tree -p spacetimedb -f {lib} -e no-dev"
---
total crates: 60
total crates: 62
spacetimedb
├── bytemuck
├── derive_more
Expand All @@ -26,6 +26,12 @@ spacetimedb
│ ├── libc
│ ├── rand_chacha
│ │ ├── ppv_lite86
│ │ │ └── zerocopy
│ │ │ ├── byteorder
│ │ │ └── zerocopy_derive
│ │ │ ├── proc_macro2 (*)
│ │ │ ├── quote (*)
│ │ │ └── syn (*)
│ │ └── rand_core
│ │ └── getrandom (*)
│ └── rand_core (*)
Expand All @@ -42,10 +48,7 @@ spacetimedb
│ │ ├── itertools
│ │ │ └── either
│ │ └── nohash_hasher
│ └── syn
│ ├── proc_macro2 (*)
│ ├── quote (*)
│ └── unicode_ident
│ └── syn (*)
├── spacetimedb_bindings_sys
│ └── spacetimedb_primitives (*)
├── spacetimedb_lib
Expand All @@ -65,7 +68,7 @@ spacetimedb
│ │ │ ├── ahash
│ │ │ │ ├── cfg_if
│ │ │ │ ├── once_cell
│ │ │ │ └── zerocopy
│ │ │ │ └── zerocopy (*)
│ │ │ │ [build-dependencies]
│ │ │ │ └── version_check
│ │ │ └── allocator_api2
Expand Down
2 changes: 2 additions & 0 deletions crates/commitlog/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ bitflags.workspace = true
crc32c.workspace = true
itertools.workspace = true
log.workspace = true
memmap2 = "0.9.4"
serde = { workspace = true, optional = true }
spacetimedb-primitives.workspace = true
spacetimedb-sats.workspace = true
tempfile.workspace = true
thiserror.workspace = true

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions crates/commitlog/src/commitlog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ impl<R: Repo, T> Generic<R, T> {
} else {
let byte_offset = segment::Header::LEN as u64 + bytes_read;
debug!("truncating segment {segment} to {offset} at {byte_offset}");
let file = self.repo.open_segment(segment)?;
file.ftruncate(byte_offset)?;
let mut file = self.repo.open_segment(segment)?;
file.ftruncate(offset, byte_offset)?;
// Some filesystems require fsync after ftruncate.
file.fsync()?;
break;
Expand Down
Loading
Loading