Skip to content

Commit 17360f5

Browse files
committed
graph: Allow remove followed by remove in write batches
If subgraphs delete entities without checking if they exist, we get two removes in a row. In the database, the second remove would just lead to a query that changes nothing. We'll do the same when putting a write batch together. Fixes #5449
1 parent 63b2a5c commit 17360f5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

graph/src/components/store/write.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ impl RowGroup {
439439
// clamping an old version
440440
match (&*prev_row, &row) {
441441
(Insert { end: None, .. } | Overwrite { end: None, .. }, Insert { .. })
442-
| (Remove { .. }, Overwrite { .. } | Remove { .. })
442+
| (Remove { .. }, Overwrite { .. })
443443
| (
444444
Insert { end: Some(_), .. } | Overwrite { end: Some(_), .. },
445445
Overwrite { .. } | Remove { .. },
@@ -450,6 +450,11 @@ impl RowGroup {
450450
row
451451
))
452452
}
453+
(Remove { .. }, Remove { .. }) => {
454+
// Ignore the new row, since prev_row is already a
455+
// delete. This can happen when subgraphs delete
456+
// entities without checking if they even exist
457+
}
453458
(
454459
Insert { end: Some(_), .. } | Overwrite { end: Some(_), .. } | Remove { .. },
455460
Insert { .. },

0 commit comments

Comments
 (0)