From f6399bc9dd31001cfbe38105df5d9cb211d12bea Mon Sep 17 00:00:00 2001 From: Lucas Meier Date: Wed, 24 Jul 2024 22:41:46 -0700 Subject: [PATCH] Fix: index events according to their local row id We use this row id as a watermark, and update it after every ingestion of an event. Previously, we were iterating over things in an undefined order, and effectively sometimes ingesting events out of order, causing bad things to happen to the watermark, leading to much FUN. --- crates/util/cometindex/src/indexer.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/util/cometindex/src/indexer.rs b/crates/util/cometindex/src/indexer.rs index 733df4c71b..27e58acb83 100644 --- a/crates/util/cometindex/src/indexer.rs +++ b/crates/util/cometindex/src/indexer.rs @@ -239,6 +239,8 @@ GROUP BY events.type, blocks.height, tx_results.tx_hash +ORDER BY + events.rowid ASC "#, ) .bind(watermark)