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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["codegen", "examples", "performance_measurement", "performance_measur

[package]
name = "worktable"
version = "0.8.4"
version = "0.8.5"
edition = "2024"
authors = ["Handy-caT"]
license = "MIT"
Expand Down
1 change: 1 addition & 0 deletions src/index/unsized_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ where
if let Some(old) = self.inner.get_mut(idx) {
let old = std::mem::replace(old, value);
self.length += value_size;
self.removed_length += old.aligned_size();
return Some(old);
}

Expand Down
70 changes: 70 additions & 0 deletions tests/persistence/sync/many_strings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,73 @@ fn test_space_update_query_pk_sync() {
}
});
}

#[test]
fn test_space_update_query_pk_many_times_sync() {
let config = PersistenceConfig::new(
"tests/data/unsized_primary_and_other_sync/update_query_pk_many",
"tests/data/unsized_primary_and_other_sync/update_query_pk_many",
);

let runtime = tokio::runtime::Builder::new_multi_thread()
.worker_threads(2)
.enable_io()
.enable_time()
.build()
.unwrap();

runtime.block_on(async {
remove_dir_if_exists(
"tests/data/unsized_primary_and_other_sync/update_query_pk_many".to_string(),
)
.await;

let pk = {
let table = TestSyncWorkTable::load_from_file(config.clone())
.await
.unwrap();
let row = TestSyncRow {
another: 42,
field: "".to_string(),
id: "Some string before".to_string(),
};
table.insert(row.clone()).unwrap();
let row = TestSyncRow {
another: 43,
field: "".to_string(),
id: "Some string before 2".to_string(),
};
table.insert(row.clone()).unwrap();
table.wait_for_ops().await;
row.id
};
{
let table = TestSyncWorkTable::load_from_file(config.clone())
.await
.unwrap();
assert!(table.select(pk.clone()).is_some());
assert_eq!(table.select(pk.clone()).unwrap().another, 43);
for i in 0..512 {
let q = FieldAnotherByIdQuery {
field: "Some field value".to_string(),
another: i,
};
table
.update_field_another_by_id(q, pk.clone())
.await
.unwrap();
}

table.wait_for_ops().await;
}
{
let table = TestSyncWorkTable::load_from_file(config).await.unwrap();
assert!(table.select(pk.clone()).is_some());
assert_eq!(table.select(pk.clone()).unwrap().another, 511);
assert_eq!(
table.select(pk).unwrap().field,
"Some field value".to_string()
);
}
});
}
Loading