-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
Replication
-
Fully Compatible
-
Repl 2023-11-13
-
0
In TransactionOperations, we ensure we're not duplicating statement IDs by
1) Copying the unordered set containing the current set of IDs
2) Adding the IDs to that set and throwing an error if any are already there
3) Moving the new set to the old set.
This is expensive; on my workstation, about 800ns for a single insert (starting from an empty ID set), 450us for 512 inserts, and 300ms for 262,144 inserts. If we require that statement IDs increase monotonically, we can replace this with a very simple check and basically save it all. But we can also check and insert the statement IDs to one set and just remove the ones we added in the exception case.
Also if we don't remove it we should use an absl::btree_set instead of an unordered_set.