This Jira is created to implement DoubleBuffer in OzoneManager to flush transactions to OM DB.
We propose using an implementation similar to the HDFS EditsDoubleBuffer. We shall flush RocksDB transactions in batches, instead of current way of using rocksdb.put() after every operation. At a given time only one batch will be outstanding for flush while newer transactions are accumulated in memory to be flushed later.
In DoubleBuffer it will have 2 buffers one is currentBuffer, and the other is readyBuffer. We add entry to current buffer, and we check if another flush call is outstanding. If not, we flush to disk Otherwise we add entries to otherBuffer while sync is happening.
In this if sync is happening, we shall add new requests to other buffer and when we can sync we use RocksDB batch commit to sync to disk, instead of rocksdb put.
Note: If flush to disk is failed on any OM, we shall terminate the OzoneManager, so that OM DB’s will not diverge. Flush failure should be considered as catastrophic failure.
Scope of this Jira is to add DoubleBuffer implementation, integrating to current OM will be done in further jira's.