Skip to content

Commit ebfbbef

Browse files
authored
Merge pull request #45 from powersync-ja/fix-remove
Revert optimization breaking deletes
2 parents cd6f12e + c6b8790 commit ebfbbef

File tree

7 files changed

+18
-17
lines changed

7 files changed

+18
-17
lines changed

Cargo.lock

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ inherits = "release"
2424
inherits = "wasm"
2525

2626
[workspace.package]
27-
version = "0.3.4"
27+
version = "0.3.5"
2828
edition = "2021"
2929
authors = ["JourneyApps"]
3030
keywords = ["sqlite", "powersync"]

android/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
}
77

88
group = "co.powersync"
9-
version = "0.3.4"
9+
version = "0.3.5"
1010
description = "PowerSync Core SQLite Extension"
1111

1212
repositories {

android/src/prefab/prefab.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"name": "powersync_sqlite_core",
33
"schema_version": 2,
44
"dependencies": [],
5-
"version": "0.3.4"
5+
"version": "0.3.5"
66
}

crates/core/src/operations.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ FROM json_each(?) e",
7575
// operations when last_applied_op = 0.
7676
// We do still need to do the "supersede_statement" step for this case, since a REMOVE
7777
// operation can supersede another PUT operation we're syncing at the same time.
78-
let mut last_applied_op = bucket_statement.column_int64(1)?;
78+
let mut is_empty = bucket_statement.column_int64(1)? == 0;
7979

8080
// Statement to supersede (replace) operations with the same key.
8181
// language=SQLite
@@ -134,11 +134,12 @@ INSERT OR IGNORE INTO ps_updated_rows(row_type, row_id) VALUES(?1, ?2)",
134134
add_checksum = add_checksum.wrapping_add(supersede_checksum);
135135
op_checksum = op_checksum.wrapping_sub(supersede_checksum);
136136

137-
if superseded_op <= last_applied_op {
138-
// Superseded an operation previously applied - we cannot skip removes
139-
// For initial sync, last_applied_op = 0, so this is always false.
140-
// For subsequent sync, this is only true if the row was previously
141-
// synced, not when it was first synced in the current batch.
137+
// Superseded an operation, only skip if the bucket was empty
138+
// Previously this checked "superseded_op <= last_applied_op".
139+
// However, that would not account for a case where a previous
140+
// PUT operation superseded the original PUT operation in this
141+
// same batch, in which case superseded_op is not accurate for this.
142+
if !is_empty {
142143
superseded = true;
143144
}
144145
}
@@ -225,7 +226,7 @@ WHERE bucket = ?1",
225226
clear_statement2.exec()?;
226227

227228
add_checksum = 0;
228-
last_applied_op = 0;
229+
is_empty = true;
229230
op_checksum = 0;
230231
}
231232
}

powersync-sqlite-core.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'powersync-sqlite-core'
3-
s.version = '0.3.4'
3+
s.version = '0.3.5'
44
s.summary = 'PowerSync SQLite Extension'
55
s.description = <<-DESC
66
PowerSync extension for SQLite.

tool/build_xcframework.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ function createXcframework() {
2828
<key>MinimumOSVersion</key>
2929
<string>11.0</string>
3030
<key>CFBundleVersion</key>
31-
<string>0.3.4</string>
31+
<string>0.3.5</string>
3232
<key>CFBundleShortVersionString</key>
33-
<string>0.3.4</string>
33+
<string>0.3.5</string>
3434
</dict>
3535
</plist>
3636
EOF

0 commit comments

Comments
 (0)