Amend HBASE-20704 Sometimes some compacted storefiles are not archived on region close
Forward port small logging improvements from branch-1 version of this change.
This commit is contained in:
parent
3de02d57f6
commit
7ab77518a2
|
@ -2634,7 +2634,7 @@ public class HStore implements Store, HeapSize, StoreConfigInformation, Propagat
|
|||
if (storeClosing && !file.isCompactedAway()) {
|
||||
String msg =
|
||||
"Region closing but StoreFile is in compacted list but not compacted away: " +
|
||||
file.getPath().getName();
|
||||
file.getPath();
|
||||
throw new IllegalStateException(msg);
|
||||
}
|
||||
|
||||
|
@ -2642,8 +2642,8 @@ public class HStore implements Store, HeapSize, StoreConfigInformation, Propagat
|
|||
//and remove compacted storefiles from the region directory
|
||||
if (file.isCompactedAway() && (!file.isReferencedInReads() || storeClosing)) {
|
||||
if (storeClosing && file.isReferencedInReads()) {
|
||||
LOG.debug("Region closing but StoreFile still has references: {}",
|
||||
file.getPath().getName());
|
||||
LOG.warn("Region closing but StoreFile still has references: file={}, refCount={}",
|
||||
file.getPath(), r.getRefCount());
|
||||
}
|
||||
// Even if deleting fails we need not bother as any new scanners won't be
|
||||
// able to use the compacted file as the status is already compactedAway
|
||||
|
@ -2658,13 +2658,13 @@ public class HStore implements Store, HeapSize, StoreConfigInformation, Propagat
|
|||
storeFileSizes.add(length);
|
||||
} else {
|
||||
LOG.info("Can't archive compacted file " + file.getPath()
|
||||
+ " because of either isCompactedAway = " + file.isCompactedAway()
|
||||
+ " or file has reference, isReferencedInReads = " + file.isReferencedInReads()
|
||||
+ ", skipping for now.");
|
||||
+ " because of either isCompactedAway=" + file.isCompactedAway()
|
||||
+ " or file has reference, isReferencedInReads=" + file.isReferencedInReads()
|
||||
+ ", refCount=" + r.getRefCount() + ", skipping for now.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
String msg = "Exception while trying to close the compacted store file " +
|
||||
file.getPath().getName();
|
||||
file.getPath();
|
||||
if (storeClosing) {
|
||||
msg = "Store is closing. " + msg;
|
||||
}
|
||||
|
|
|
@ -161,6 +161,14 @@ public class StoreFileReader {
|
|||
!isCompaction, reader.hasMVCCInfo(), readPt, scannerOrder, canOptimizeForNonNullColumn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the ref count associated with the reader whenever a scanner associated with the
|
||||
* reader is opened.
|
||||
*/
|
||||
int getRefCount() {
|
||||
return refCount.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the scanner has started reading with this reader. We need to increment the ref
|
||||
* count so reader is not close until some object is holding the lock
|
||||
|
|
Loading…
Reference in New Issue