FoundationDB / fdb-record-layer

A record-oriented store built on FoundationDB
Apache License 2.0
575 stars 102 forks source link

Building idempotent index in SNAPSHOT level may cause issue with split records #1093

Open nblintao opened 3 years ago

nblintao commented 3 years ago

See https://github.com/FoundationDB/fdb-record-layer/pull/1079/files#r552215921

alecgrieser commented 3 years ago

@ScottDugas Did you have a proposed way in which snapshot isolation level index build scans could cause problems with split records? I don't really see it as the main implication of using SNAPSHOT isolation level reads is that if new records are inserted in the range being scanned, we don't fail the index build transaction. The range being scanned uses Record Layer primary keys, not FDB keys, so I don't see how a split record (or non-split record) at the boundaries could cause problems. Intermediate records all get read conflict ranges added to them to protect against "phantom" index entries being written (or, in other words, to protect against the indexed records within the range changing), and those conflict ranges cover all keys that could be used for that key (regardless of whether it's split or not), so I think we'd protected if (1) the record changes from split to unspilt, (2) the record changes from unspilt to split, or (3) the record changes the number of split points it has.

There is still #959, I suppose, but that's a problem with more than just index builds.