Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
3.0.0-alpha-2, 2.4.9
-
None
-
Reviewed
Description
As HBASE-26465 said, reference count implementation in MemStoreLABImpl is flawed because its checking and increasing or decreasing is not done in atomicity and it ignores state checking when there is illegal state in reference count(eg. increasing or decreasing when the resource is already freed) , just as following incScannerCount and decScannerCount methods illustrated, and this flawed implementation has shield the bugs HBASE-26465 and HBASE-26488.
public void incScannerCount() { this.openScannerCount.incrementAndGet(); } public void decScannerCount() { int count = this.openScannerCount.decrementAndGet(); if (this.closed.get() && count == 0) { recycleChunks(); } }
We could Introduce RefCnt into MemStoreLABImpl to replace its flawed reference count implementation, so checking and increasing or decreasing is done in atomicity and if there is illegal state in reference count, it would throw exception rather than continue using the corrupt data to cause some subtle bugs, and meanwhile, the code is more simpler.
Attachments
Issue Links
- links to