Skip to content

Commit 438663b

Browse files
authored
Merge pull request #14 from superfly/somtochi/clear-version-cache
Clear db_version cache on commit/rollback
2 parents 8b0b67d + ddb804a commit 438663b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

core/rs/core/src/commit.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,14 @@ pub unsafe fn commit_or_rollback_reset(ext_data: *mut crsql_ExtData) {
4242
let mut table_infos = unsafe {
4343
mem::ManuallyDrop::new(Box::from_raw((*ext_data).tableInfos as *mut Vec<TableInfo>))
4444
};
45-
ordinals.clear();
4645

46+
let mut last_db_versions: mem::ManuallyDrop<Box<BTreeMap<Vec<u8>, i64>>> =
47+
mem::ManuallyDrop::new(Box::from_raw(
48+
(*ext_data).lastDbVersions as *mut BTreeMap<Vec<u8>, i64>,
49+
));
50+
51+
last_db_versions.clear();
52+
ordinals.clear();
4753
for tbl_info in table_infos.iter_mut() {
4854
tbl_info.clear_cl_cache();
4955
}

core/rs/core/src/db_version.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ pub fn insert_db_version(
217217
insert_db_vrsn: i64,
218218
) -> Result<(), ResultCode> {
219219
unsafe {
220-
// we can get a more recent db_versio
220+
// we can get a more recent db_version
221221
let mut last_db_versions: mem::ManuallyDrop<Box<BTreeMap<Vec<u8>, i64>>> =
222222
mem::ManuallyDrop::new(Box::from_raw(
223223
(*ext_data).lastDbVersions as *mut BTreeMap<Vec<u8>, i64>,

0 commit comments

Comments
 (0)