Class WALProcedureStore

java.lang.Object
org.apache.hadoop.hbase.procedure2.store.ProcedureStoreBase
org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore
All Implemented Interfaces:
ProcedureStore

@Deprecated @Private public class WALProcedureStore extends ProcedureStoreBase
Deprecated.
Since 2.3.0, will be removed in 4.0.0. Keep here only for rolling upgrading, now we use the new region based procedure store.
WAL implementation of the ProcedureStore.

When starting, the upper layer will first call start(int), then recoverLease(), then load(ProcedureLoader).

In recoverLease(), we will get the lease by closing all the existing wal files(by calling recoverFileLease), and creating a new wal writer. And we will also get the list of all the old wal files.

FIXME: notice that the current recover lease implementation is problematic, it can not deal with the races if there are two master both wants to acquire the lease...

In load(ProcedureLoader) method, we will load all the active procedures. See the comments of this method for more details.

The actual logging way is a bit like our FileSystem based WAL implementation as RS side. There is a slots, which is more like the ring buffer, and in the insert, update and delete methods we will put thing into the slots and wait. And there is a background sync thread(see the syncLoop() method) which get data from the slots and write them to the FileSystem, and notify the caller that we have finished.

TODO: try using disruptor to increase performance and simplify the logic?

The storeTracker keeps track of the modified procedures in the newest wal file, which is also the one being written currently. And the deleted bits in it are for all the procedures, not only the ones in the newest wal file. And when rolling a log, we will first store it in the trailer of the current wal file, and then reset its modified bits, so that it can start to track the modified procedures for the new wal file.

The holdingCleanupTracker is used to test whether we are safe to delete the oldest wal file. When there are log rolling and there are more than 1 wal files, we will make use of it. It will first be initialized to the oldest file's tracker(which is stored in the trailer), using the method ProcedureStoreTracker.resetTo(ProcedureStoreTracker, boolean), and then merge it with the tracker of every newer wal files, using the ProcedureStoreTracker.setDeletedIfModifiedInBoth(ProcedureStoreTracker). If we find out that all the modified procedures for the oldest wal file are modified or deleted in newer wal files, then we can delete it. This is because that, every time we call ProcedureStore.insert(Procedure[]) or ProcedureStore.update(Procedure), we will persist the full state of a Procedure, so the earlier wal records for this procedure can all be deleted.

See Also: