Skip to content

Commit 4a2f448

Browse files
committed
Expand on comments.
1 parent 43aa8f8 commit 4a2f448

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

crates/core/src/sync_local.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ impl<'a> SyncOperation<'a> {
114114
if self.data_tables.contains(&table_name) {
115115
let quoted = quote_internal_name(type_name, false);
116116

117-
// is_err() is essentially a NULL check here
117+
// is_err() is essentially a NULL check here.
118+
// NULL data means no PUT operations found, so we delete the row.
118119
if data.is_err() {
119120
// DELETE
120121
let delete_statement = self
@@ -190,6 +191,7 @@ impl<'a> SyncOperation<'a> {
190191
"\
191192
-- 1. Filter oplog by the ops added but not applied yet (oplog b).
192193
-- We do not do any DISTINCT operation here, since that introduces a temp b-tree.
194+
-- We filter out duplicates using the GROUP BY below.
193195
WITH updated_rows AS (
194196
SELECT b.row_type, b.row_id FROM ps_buckets AS buckets
195197
CROSS JOIN ps_oplog AS b ON b.bucket = buckets.id
@@ -224,6 +226,7 @@ SELECT
224226
"\
225227
-- 1. Filter oplog by the ops added but not applied yet (oplog b).
226228
-- We do not do any DISTINCT operation here, since that introduces a temp b-tree.
229+
-- We filter out duplicates using the GROUP BY below.
227230
WITH
228231
involved_buckets (id) AS MATERIALIZED (
229232
SELECT id FROM ps_buckets WHERE ?1 IS NULL

0 commit comments

Comments
 (0)