Skip to content
  • Maysam Yabandeh's avatar
    WritePrepared Txn: Duplicate Keys, Txn Part · 88d8b2a2
    Maysam Yabandeh authored
    Summary:
    This patch takes advantage of memtable being able to detect duplicate <key,seq> and returning TryAgain to handle duplicate keys in WritePrepared Txns. Through WriteBatchWithIndex's index it detects existence of at least a duplicate key in the write batch. If duplicate key was reported, it then pays the cost of counting the number of sub-patches by iterating over the write batch and pass it to DBImpl::Write. DB will make use of the provided batch_count to assign proper sequence numbers before sending them to the WAL. When later inserting the batch to the memtable, it increases the seq each time memtbale reports a duplicate (a sub-patch in our counting) and tries again.
    Closes https://github.com/facebook/rocksdb/pull/3455
    
    Differential Revision: D6873699
    
    Pulled By: maysamyabandeh
    
    fbshipit-source-id: db8487526c3a5dc1ddda0ea49f0f979b26ae648d
    88d8b2a2