diff --git a/Cargo.lock b/Cargo.lock index 496c444..8098639 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -205,7 +205,7 @@ checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" [[package]] name = "powersync_core" -version = "0.3.4" +version = "0.3.5" dependencies = [ "bytes", "num-derive", @@ -218,7 +218,7 @@ dependencies = [ [[package]] name = "powersync_loadable" -version = "0.3.4" +version = "0.3.5" dependencies = [ "powersync_core", "sqlite_nostd", @@ -226,7 +226,7 @@ dependencies = [ [[package]] name = "powersync_sqlite" -version = "0.3.4" +version = "0.3.5" dependencies = [ "cc", "powersync_core", @@ -331,7 +331,7 @@ checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" [[package]] name = "sqlite3" -version = "0.3.4" +version = "0.3.5" dependencies = [ "cc", ] diff --git a/Cargo.toml b/Cargo.toml index 6da5504..f5006c7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ inherits = "release" inherits = "wasm" [workspace.package] -version = "0.3.4" +version = "0.3.5" edition = "2021" authors = ["JourneyApps"] keywords = ["sqlite", "powersync"] diff --git a/android/build.gradle.kts b/android/build.gradle.kts index fd2bf07..b3eba33 100644 --- a/android/build.gradle.kts +++ b/android/build.gradle.kts @@ -6,7 +6,7 @@ plugins { } group = "co.powersync" -version = "0.3.4" +version = "0.3.5" description = "PowerSync Core SQLite Extension" repositories { diff --git a/android/src/prefab/prefab.json b/android/src/prefab/prefab.json index 322719d..d100475 100644 --- a/android/src/prefab/prefab.json +++ b/android/src/prefab/prefab.json @@ -2,5 +2,5 @@ "name": "powersync_sqlite_core", "schema_version": 2, "dependencies": [], - "version": "0.3.4" + "version": "0.3.5" } diff --git a/crates/core/src/operations.rs b/crates/core/src/operations.rs index 067365b..17dcb3f 100644 --- a/crates/core/src/operations.rs +++ b/crates/core/src/operations.rs @@ -75,7 +75,7 @@ FROM json_each(?) e", // operations when last_applied_op = 0. // We do still need to do the "supersede_statement" step for this case, since a REMOVE // operation can supersede another PUT operation we're syncing at the same time. - let mut last_applied_op = bucket_statement.column_int64(1)?; + let mut is_empty = bucket_statement.column_int64(1)? == 0; // Statement to supersede (replace) operations with the same key. // language=SQLite @@ -134,11 +134,12 @@ INSERT OR IGNORE INTO ps_updated_rows(row_type, row_id) VALUES(?1, ?2)", add_checksum = add_checksum.wrapping_add(supersede_checksum); op_checksum = op_checksum.wrapping_sub(supersede_checksum); - if superseded_op <= last_applied_op { - // Superseded an operation previously applied - we cannot skip removes - // For initial sync, last_applied_op = 0, so this is always false. - // For subsequent sync, this is only true if the row was previously - // synced, not when it was first synced in the current batch. + // Superseded an operation, only skip if the bucket was empty + // Previously this checked "superseded_op <= last_applied_op". + // However, that would not account for a case where a previous + // PUT operation superseded the original PUT operation in this + // same batch, in which case superseded_op is not accurate for this. + if !is_empty { superseded = true; } } @@ -225,7 +226,7 @@ WHERE bucket = ?1", clear_statement2.exec()?; add_checksum = 0; - last_applied_op = 0; + is_empty = true; op_checksum = 0; } } diff --git a/powersync-sqlite-core.podspec b/powersync-sqlite-core.podspec index bbe8622..29daafb 100644 --- a/powersync-sqlite-core.podspec +++ b/powersync-sqlite-core.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'powersync-sqlite-core' - s.version = '0.3.4' + s.version = '0.3.5' s.summary = 'PowerSync SQLite Extension' s.description = <<-DESC PowerSync extension for SQLite. diff --git a/tool/build_xcframework.sh b/tool/build_xcframework.sh index f2b2f42..f9724d7 100755 --- a/tool/build_xcframework.sh +++ b/tool/build_xcframework.sh @@ -28,9 +28,9 @@ function createXcframework() { MinimumOSVersion 11.0 CFBundleVersion - 0.3.4 + 0.3.5 CFBundleShortVersionString - 0.3.4 + 0.3.5 EOF