HBASE-23590 : Update maxStoreFileRefCount to maxCompactedStoreFileRefCount for auto region recovery based on old reader references

Signed-off-by: Anoop Sam John <anoopsamjohn@apache.org>
This commit is contained in:
Viraj Jasani 2020-01-01 21:57:03 +05:30
parent 5a0dd574a6
commit 17652a7b32
No known key found for this signature in database
GPG Key ID: E906DFF511D3E5DB
18 changed files with 108 additions and 90 deletions

View File

@ -366,8 +366,8 @@ public class RegionLoad implements RegionMetrics {
} }
@Override @Override
public int getMaxStoreFileRefCount() { public int getMaxCompactedStoreFileRefCount() {
return metrics.getMaxStoreFileRefCount(); return metrics.getMaxCompactedStoreFileRefCount();
} }
/** /**

View File

@ -150,8 +150,8 @@ public interface RegionMetrics {
int getStoreRefCount(); int getStoreRefCount();
/** /**
* @return the max reference count for any store file among all stores files * @return the max reference count for any store file among all compacted stores files
* of this region * of this region
*/ */
int getMaxStoreFileRefCount(); int getMaxCompactedStoreFileRefCount();
} }

View File

@ -65,7 +65,7 @@ public final class RegionMetricsBuilder {
.setStoreCount(regionLoadPB.getStores()) .setStoreCount(regionLoadPB.getStores())
.setStoreFileCount(regionLoadPB.getStorefiles()) .setStoreFileCount(regionLoadPB.getStorefiles())
.setStoreRefCount(regionLoadPB.getStoreRefCount()) .setStoreRefCount(regionLoadPB.getStoreRefCount())
.setMaxStoreFileRefCount(regionLoadPB.getMaxStoreFileRefCount()) .setMaxCompactedStoreFileRefCount(regionLoadPB.getMaxCompactedStoreFileRefCount())
.setStoreFileSize(new Size(regionLoadPB.getStorefileSizeMB(), Size.Unit.MEGABYTE)) .setStoreFileSize(new Size(regionLoadPB.getStorefileSizeMB(), Size.Unit.MEGABYTE))
.setStoreSequenceIds(regionLoadPB.getStoreCompleteSequenceIdList().stream() .setStoreSequenceIds(regionLoadPB.getStoreCompleteSequenceIdList().stream()
.collect(Collectors.toMap( .collect(Collectors.toMap(
@ -112,7 +112,7 @@ public final class RegionMetricsBuilder {
.setStores(regionMetrics.getStoreCount()) .setStores(regionMetrics.getStoreCount())
.setStorefiles(regionMetrics.getStoreFileCount()) .setStorefiles(regionMetrics.getStoreFileCount())
.setStoreRefCount(regionMetrics.getStoreRefCount()) .setStoreRefCount(regionMetrics.getStoreRefCount())
.setMaxStoreFileRefCount(regionMetrics.getMaxStoreFileRefCount()) .setMaxCompactedStoreFileRefCount(regionMetrics.getMaxCompactedStoreFileRefCount())
.setStorefileSizeMB((int) regionMetrics.getStoreFileSize().get(Size.Unit.MEGABYTE)) .setStorefileSizeMB((int) regionMetrics.getStoreFileSize().get(Size.Unit.MEGABYTE))
.addAllStoreCompleteSequenceId(toStoreSequenceId(regionMetrics.getStoreSequenceId())) .addAllStoreCompleteSequenceId(toStoreSequenceId(regionMetrics.getStoreSequenceId()))
.setStoreUncompressedSizeMB( .setStoreUncompressedSizeMB(
@ -128,7 +128,7 @@ public final class RegionMetricsBuilder {
private int storeCount; private int storeCount;
private int storeFileCount; private int storeFileCount;
private int storeRefCount; private int storeRefCount;
private int maxStoreFileRefCount; private int maxCompactedStoreFileRefCount;
private long compactingCellCount; private long compactingCellCount;
private long compactedCellCount; private long compactedCellCount;
private Size storeFileSize = Size.ZERO; private Size storeFileSize = Size.ZERO;
@ -161,8 +161,8 @@ public final class RegionMetricsBuilder {
this.storeRefCount = value; this.storeRefCount = value;
return this; return this;
} }
public RegionMetricsBuilder setMaxStoreFileRefCount(int value) { public RegionMetricsBuilder setMaxCompactedStoreFileRefCount(int value) {
this.maxStoreFileRefCount = value; this.maxCompactedStoreFileRefCount = value;
return this; return this;
} }
public RegionMetricsBuilder setCompactingCellCount(long value) { public RegionMetricsBuilder setCompactingCellCount(long value) {
@ -235,7 +235,7 @@ public final class RegionMetricsBuilder {
storeCount, storeCount,
storeFileCount, storeFileCount,
storeRefCount, storeRefCount,
maxStoreFileRefCount, maxCompactedStoreFileRefCount,
compactingCellCount, compactingCellCount,
compactedCellCount, compactedCellCount,
storeFileSize, storeFileSize,
@ -259,7 +259,7 @@ public final class RegionMetricsBuilder {
private final int storeCount; private final int storeCount;
private final int storeFileCount; private final int storeFileCount;
private final int storeRefCount; private final int storeRefCount;
private final int maxStoreFileRefCount; private final int maxCompactedStoreFileRefCount;
private final long compactingCellCount; private final long compactingCellCount;
private final long compactedCellCount; private final long compactedCellCount;
private final Size storeFileSize; private final Size storeFileSize;
@ -280,7 +280,7 @@ public final class RegionMetricsBuilder {
int storeCount, int storeCount,
int storeFileCount, int storeFileCount,
int storeRefCount, int storeRefCount,
int maxStoreFileRefCount, int maxCompactedStoreFileRefCount,
final long compactingCellCount, final long compactingCellCount,
long compactedCellCount, long compactedCellCount,
Size storeFileSize, Size storeFileSize,
@ -301,7 +301,7 @@ public final class RegionMetricsBuilder {
this.storeCount = storeCount; this.storeCount = storeCount;
this.storeFileCount = storeFileCount; this.storeFileCount = storeFileCount;
this.storeRefCount = storeRefCount; this.storeRefCount = storeRefCount;
this.maxStoreFileRefCount = maxStoreFileRefCount; this.maxCompactedStoreFileRefCount = maxCompactedStoreFileRefCount;
this.compactingCellCount = compactingCellCount; this.compactingCellCount = compactingCellCount;
this.compactedCellCount = compactedCellCount; this.compactedCellCount = compactedCellCount;
this.storeFileSize = Preconditions.checkNotNull(storeFileSize); this.storeFileSize = Preconditions.checkNotNull(storeFileSize);
@ -341,8 +341,8 @@ public final class RegionMetricsBuilder {
} }
@Override @Override
public int getMaxStoreFileRefCount() { public int getMaxCompactedStoreFileRefCount() {
return maxStoreFileRefCount; return maxCompactedStoreFileRefCount;
} }
@Override @Override
@ -433,8 +433,8 @@ public final class RegionMetricsBuilder {
this.getStoreFileCount()); this.getStoreFileCount());
Strings.appendKeyValue(sb, "storeRefCount", Strings.appendKeyValue(sb, "storeRefCount",
this.getStoreRefCount()); this.getStoreRefCount());
Strings.appendKeyValue(sb, "maxStoreFileRefCount", Strings.appendKeyValue(sb, "maxCompactedStoreFileRefCount",
this.getMaxStoreFileRefCount()); this.getMaxCompactedStoreFileRefCount());
Strings.appendKeyValue(sb, "uncompressedStoreFileSize", Strings.appendKeyValue(sb, "uncompressedStoreFileSize",
this.getUncompressedStoreFileSize()); this.getUncompressedStoreFileSize());
Strings.appendKeyValue(sb, "lastMajorCompactionTimestamp", Strings.appendKeyValue(sb, "lastMajorCompactionTimestamp",

View File

@ -360,7 +360,7 @@ public final class ServerMetricsBuilder {
int storeCount = 0; int storeCount = 0;
int storeFileCount = 0; int storeFileCount = 0;
int storeRefCount = 0; int storeRefCount = 0;
int maxStoreFileRefCount = 0; int maxCompactedStoreFileRefCount = 0;
long uncompressedStoreFileSizeMB = 0; long uncompressedStoreFileSizeMB = 0;
long storeFileSizeMB = 0; long storeFileSizeMB = 0;
long memStoreSizeMB = 0; long memStoreSizeMB = 0;
@ -376,8 +376,9 @@ public final class ServerMetricsBuilder {
storeCount += r.getStoreCount(); storeCount += r.getStoreCount();
storeFileCount += r.getStoreFileCount(); storeFileCount += r.getStoreFileCount();
storeRefCount += r.getStoreRefCount(); storeRefCount += r.getStoreRefCount();
int currentMaxStoreFileRefCount = r.getMaxStoreFileRefCount(); int currentMaxCompactedStoreFileRefCount = r.getMaxCompactedStoreFileRefCount();
maxStoreFileRefCount = Math.max(maxStoreFileRefCount, currentMaxStoreFileRefCount); maxCompactedStoreFileRefCount = Math.max(maxCompactedStoreFileRefCount,
currentMaxCompactedStoreFileRefCount);
uncompressedStoreFileSizeMB += r.getUncompressedStoreFileSize().get(Size.Unit.MEGABYTE); uncompressedStoreFileSizeMB += r.getUncompressedStoreFileSize().get(Size.Unit.MEGABYTE);
storeFileSizeMB += r.getStoreFileSize().get(Size.Unit.MEGABYTE); storeFileSizeMB += r.getStoreFileSize().get(Size.Unit.MEGABYTE);
memStoreSizeMB += r.getMemStoreSize().get(Size.Unit.MEGABYTE); memStoreSizeMB += r.getMemStoreSize().get(Size.Unit.MEGABYTE);
@ -399,7 +400,8 @@ public final class ServerMetricsBuilder {
Strings.appendKeyValue(sb, "numberOfStores", storeCount); Strings.appendKeyValue(sb, "numberOfStores", storeCount);
Strings.appendKeyValue(sb, "numberOfStorefiles", storeFileCount); Strings.appendKeyValue(sb, "numberOfStorefiles", storeFileCount);
Strings.appendKeyValue(sb, "storeRefCount", storeRefCount); Strings.appendKeyValue(sb, "storeRefCount", storeRefCount);
Strings.appendKeyValue(sb, "maxStoreFileRefCount", maxStoreFileRefCount); Strings.appendKeyValue(sb, "maxCompactedStoreFileRefCount",
maxCompactedStoreFileRefCount);
Strings.appendKeyValue(sb, "storefileUncompressedSizeMB", uncompressedStoreFileSizeMB); Strings.appendKeyValue(sb, "storefileUncompressedSizeMB", uncompressedStoreFileSizeMB);
Strings.appendKeyValue(sb, "storefileSizeMB", storeFileSizeMB); Strings.appendKeyValue(sb, "storefileSizeMB", storeFileSizeMB);
if (uncompressedStoreFileSizeMB != 0) { if (uncompressedStoreFileSizeMB != 0) {

View File

@ -1891,19 +1891,25 @@ possible configurations would overwhelm and obscure the important.
<name>hbase.regions.recovery.store.file.ref.count</name> <name>hbase.regions.recovery.store.file.ref.count</name>
<value>-1</value> <value>-1</value>
<description> <description>
Very large ref count on a file indicates Very large number of ref count on a compacted
that it is a ref leak on that object. Such files store file indicates that it is a ref leak
can not be removed even after it is invalidated on that object(compacted store file).
via compaction. Only way to recover in such Such files can not be removed after
scenario is to reopen the region which can it is invalidated via compaction.
release all resources, like the refcount, leases, etc. Only way to recover in such scenario is to
This config represents Store files Ref Count threshold reopen the region which can release
value considered for reopening regions. all resources, like the refcount,
Any region with store files ref count > this value leases, etc. This config represents Store files Ref
would be eligible for reopening by master. Count threshold value considered for reopening
Default value -1 indicates this feature is turned off. regions. Any region with compacted store files
Only positive integer value should be provided to enable ref count > this value would be eligible for
this feature. reopening by master. Here, we get the max
refCount among all refCounts on all
compacted away store files that belong to a
particular region. Default value -1 indicates
this feature is turned off. Only positive
integer value should be provided to
enable this feature.
</description> </description>
</property> </property>
</configuration> </configuration>

View File

@ -233,7 +233,7 @@ public interface MetricsRegionServerSource extends BaseSource, JvmPauseMonitorSo
String STOREFILE_COUNT_DESC = "Number of Store Files"; String STOREFILE_COUNT_DESC = "Number of Store Files";
String STORE_REF_COUNT = "storeRefCount"; String STORE_REF_COUNT = "storeRefCount";
String STORE_REF_COUNT_DESC = "Store reference count"; String STORE_REF_COUNT_DESC = "Store reference count";
String MAX_STORE_FILE_REF_COUNT = "maxStoreFileRefCount"; String MAX_COMPACTED_STORE_FILE_REF_COUNT = "maxCompactedStoreFileRefCount";
String MEMSTORE_SIZE = "memStoreSize"; String MEMSTORE_SIZE = "memStoreSize";
String MEMSTORE_SIZE_DESC = "Size of the memstore"; String MEMSTORE_SIZE_DESC = "Size of the memstore";
String STOREFILE_SIZE = "storeFileSize"; String STOREFILE_SIZE = "storeFileSize";

View File

@ -160,7 +160,7 @@ public interface MetricsRegionWrapper {
/** /**
* @return the max number of references active on any store file among * @return the max number of references active on any store file among
* all store files that belong to this region * all compacted store files that belong to this region
*/ */
long getMaxStoreFileRefCount(); long getMaxCompactedStoreFileRefCount();
} }

View File

@ -218,9 +218,10 @@ public class MetricsRegionSourceImpl implements MetricsRegionSource {
MetricsRegionServerSource.STORE_REF_COUNT), MetricsRegionServerSource.STORE_REF_COUNT),
this.regionWrapper.getStoreRefCount()); this.regionWrapper.getStoreRefCount());
mrb.addGauge(Interns.info( mrb.addGauge(Interns.info(
regionNamePrefix + MetricsRegionServerSource.MAX_STORE_FILE_REF_COUNT, regionNamePrefix + MetricsRegionServerSource.MAX_COMPACTED_STORE_FILE_REF_COUNT,
MetricsRegionServerSource.MAX_STORE_FILE_REF_COUNT), MetricsRegionServerSource.MAX_COMPACTED_STORE_FILE_REF_COUNT),
this.regionWrapper.getMaxStoreFileRefCount()); this.regionWrapper.getMaxCompactedStoreFileRefCount()
);
mrb.addGauge(Interns.info( mrb.addGauge(Interns.info(
regionNamePrefix + MetricsRegionServerSource.MEMSTORE_SIZE, regionNamePrefix + MetricsRegionServerSource.MEMSTORE_SIZE,
MetricsRegionServerSource.MEMSTORE_SIZE_DESC), MetricsRegionServerSource.MEMSTORE_SIZE_DESC),

View File

@ -100,7 +100,7 @@ public class TestMetricsRegionSourceImpl {
} }
@Override @Override
public long getMaxStoreFileRefCount() { public long getMaxCompactedStoreFileRefCount() {
return 0; return 0;
} }

View File

@ -151,10 +151,10 @@ message RegionLoad {
optional int32 store_ref_count = 21 [default = 0]; optional int32 store_ref_count = 21 [default = 0];
/** /**
* The max number of references active on single store file among all store files * The max number of references active on single store file among all compacted store files
* that belong to given region * that belong to given region
*/ */
optional int32 max_store_file_ref_count = 22 [default = 0]; optional int32 max_compacted_store_file_ref_count = 22 [default = 0];
} }
message UserLoad { message UserLoad {

View File

@ -147,10 +147,10 @@ message RegionLoad {
optional int32 store_ref_count = 21 [default = 0]; optional int32 store_ref_count = 21 [default = 0];
/** /**
* The max number of references active on single store file among all store files * The max number of references active on single store file among all compacted store files
* that belong to given region * that belong to given region
*/ */
optional int32 max_store_file_ref_count = 22 [default = 0]; optional int32 max_compacted_store_file_ref_count = 22 [default = 0];
} }
message UserLoad { message UserLoad {

View File

@ -130,17 +130,18 @@ public class RegionsRecoveryChore extends ScheduledChore {
for (ServerMetrics serverMetrics : serverMetricsMap.values()) { for (ServerMetrics serverMetrics : serverMetricsMap.values()) {
Map<byte[], RegionMetrics> regionMetricsMap = serverMetrics.getRegionMetrics(); Map<byte[], RegionMetrics> regionMetricsMap = serverMetrics.getRegionMetrics();
for (RegionMetrics regionMetrics : regionMetricsMap.values()) { for (RegionMetrics regionMetrics : regionMetricsMap.values()) {
// For each region, each store file can have different ref counts // For each region, each compacted store file can have different ref counts
// We need to find maximum of all such ref counts and if that max count // We need to find maximum of all such ref counts and if that max count of compacted
// is beyond a threshold value, we should reopen the region. // store files is beyond a threshold value, we should reopen the region.
// Here, we take max ref count of all store files and not the cumulative // Here, we take max ref count of all compacted store files and not the cumulative
// count of all store files // count of all compacted store files
final int maxStoreFileRefCount = regionMetrics.getMaxStoreFileRefCount(); final int maxCompactedStoreFileRefCount = regionMetrics
.getMaxCompactedStoreFileRefCount();
if (maxStoreFileRefCount > storeFileRefCountThreshold) { if (maxCompactedStoreFileRefCount > storeFileRefCountThreshold) {
final byte[] regionName = regionMetrics.getRegionName(); final byte[] regionName = regionMetrics.getRegionName();
prepareTableToReopenRegionsMap(tableToReopenRegionsMap, regionName, prepareTableToReopenRegionsMap(tableToReopenRegionsMap, regionName,
maxStoreFileRefCount); maxCompactedStoreFileRefCount);
} }
} }
} }

View File

@ -1660,7 +1660,7 @@ public class HRegionServer extends HasThread implements
int stores = 0; int stores = 0;
int storefiles = 0; int storefiles = 0;
int storeRefCount = 0; int storeRefCount = 0;
int maxStoreFileRefCount = 0; int maxCompactedStoreFileRefCount = 0;
int storeUncompressedSizeMB = 0; int storeUncompressedSizeMB = 0;
int storefileSizeMB = 0; int storefileSizeMB = 0;
int memstoreSizeMB = (int) (r.getMemStoreDataSize() / 1024 / 1024); int memstoreSizeMB = (int) (r.getMemStoreDataSize() / 1024 / 1024);
@ -1676,8 +1676,9 @@ public class HRegionServer extends HasThread implements
storefiles += store.getStorefilesCount(); storefiles += store.getStorefilesCount();
int currentStoreRefCount = store.getStoreRefCount(); int currentStoreRefCount = store.getStoreRefCount();
storeRefCount += currentStoreRefCount; storeRefCount += currentStoreRefCount;
int currentMaxStoreFileRefCount = store.getMaxStoreFileRefCount(); int currentMaxCompactedStoreFileRefCount = store.getMaxCompactedStoreFileRefCount();
maxStoreFileRefCount = Math.max(maxStoreFileRefCount, currentMaxStoreFileRefCount); maxCompactedStoreFileRefCount = Math.max(maxCompactedStoreFileRefCount,
currentMaxCompactedStoreFileRefCount);
storeUncompressedSizeMB += (int) (store.getStoreSizeUncompressed() / 1024 / 1024); storeUncompressedSizeMB += (int) (store.getStoreSizeUncompressed() / 1024 / 1024);
storefileSizeMB += (int) (store.getStorefilesSize() / 1024 / 1024); storefileSizeMB += (int) (store.getStorefilesSize() / 1024 / 1024);
//TODO: storefileIndexSizeKB is same with rootLevelIndexSizeKB? //TODO: storefileIndexSizeKB is same with rootLevelIndexSizeKB?
@ -1706,7 +1707,7 @@ public class HRegionServer extends HasThread implements
.setStores(stores) .setStores(stores)
.setStorefiles(storefiles) .setStorefiles(storefiles)
.setStoreRefCount(storeRefCount) .setStoreRefCount(storeRefCount)
.setMaxStoreFileRefCount(maxStoreFileRefCount) .setMaxCompactedStoreFileRefCount(maxCompactedStoreFileRefCount)
.setStoreUncompressedSizeMB(storeUncompressedSizeMB) .setStoreUncompressedSizeMB(storeUncompressedSizeMB)
.setStorefileSizeMB(storefileSizeMB) .setStorefileSizeMB(storefileSizeMB)
.setMemStoreSizeMB(memstoreSizeMB) .setMemStoreSizeMB(memstoreSizeMB)

View File

@ -2779,18 +2779,19 @@ public class HStore implements Store, HeapSize, StoreConfigInformation, Propagat
} }
/** /**
* @return get maximum ref count of storeFile among all HStore Files * @return get maximum ref count of storeFile among all compacted HStore Files
* for the HStore * for the HStore
*/ */
public int getMaxStoreFileRefCount() { public int getMaxCompactedStoreFileRefCount() {
OptionalInt maxStoreFileRefCount = this.storeEngine.getStoreFileManager() OptionalInt maxCompactedStoreFileRefCount = this.storeEngine.getStoreFileManager()
.getStorefiles() .getCompactedfiles()
.stream() .stream()
.filter(sf -> sf.getReader() != null) .filter(sf -> sf.getReader() != null)
.filter(HStoreFile::isHFile) .filter(HStoreFile::isHFile)
.mapToInt(HStoreFile::getRefCount) .mapToInt(HStoreFile::getRefCount)
.max(); .max();
return maxStoreFileRefCount.isPresent() ? maxStoreFileRefCount.getAsInt() : 0; return maxCompactedStoreFileRefCount.isPresent()
? maxCompactedStoreFileRefCount.getAsInt() : 0;
} }
void reportArchivedFilesForQuota(List<? extends StoreFile> archivedFiles, List<Long> fileSizes) { void reportArchivedFilesForQuota(List<? extends StoreFile> archivedFiles, List<Long> fileSizes) {

View File

@ -49,7 +49,7 @@ public class MetricsRegionWrapperImpl implements MetricsRegionWrapper, Closeable
private Runnable runnable; private Runnable runnable;
private long numStoreFiles; private long numStoreFiles;
private long storeRefCount; private long storeRefCount;
private long maxStoreFileRefCount; private long maxCompactedStoreFileRefCount;
private long memstoreSize; private long memstoreSize;
private long storeFileSize; private long storeFileSize;
private long maxStoreFileAge; private long maxStoreFileAge;
@ -127,8 +127,8 @@ public class MetricsRegionWrapperImpl implements MetricsRegionWrapper, Closeable
} }
@Override @Override
public long getMaxStoreFileRefCount() { public long getMaxCompactedStoreFileRefCount() {
return maxStoreFileRefCount; return maxCompactedStoreFileRefCount;
} }
@Override @Override
@ -234,7 +234,7 @@ public class MetricsRegionWrapperImpl implements MetricsRegionWrapper, Closeable
public void run() { public void run() {
long tempNumStoreFiles = 0; long tempNumStoreFiles = 0;
int tempStoreRefCount = 0; int tempStoreRefCount = 0;
int tempMaxStoreFileRefCount = 0; int tempMaxCompactedStoreFileRefCount = 0;
long tempMemstoreSize = 0; long tempMemstoreSize = 0;
long tempStoreFileSize = 0; long tempStoreFileSize = 0;
long tempMaxStoreFileAge = 0; long tempMaxStoreFileAge = 0;
@ -249,9 +249,9 @@ public class MetricsRegionWrapperImpl implements MetricsRegionWrapper, Closeable
tempNumStoreFiles += store.getStorefilesCount(); tempNumStoreFiles += store.getStorefilesCount();
int currentStoreRefCount = store.getStoreRefCount(); int currentStoreRefCount = store.getStoreRefCount();
tempStoreRefCount += currentStoreRefCount; tempStoreRefCount += currentStoreRefCount;
int currentMaxStoreFileRefCount = store.getMaxStoreFileRefCount(); int currentMaxCompactedStoreFileRefCount = store.getMaxCompactedStoreFileRefCount();
tempMaxStoreFileRefCount = Math.max(tempMaxStoreFileRefCount, tempMaxCompactedStoreFileRefCount = Math.max(tempMaxCompactedStoreFileRefCount,
currentMaxStoreFileRefCount); currentMaxCompactedStoreFileRefCount);
tempMemstoreSize += store.getMemStoreSize().getDataSize(); tempMemstoreSize += store.getMemStoreSize().getDataSize();
tempStoreFileSize += store.getStorefilesSize(); tempStoreFileSize += store.getStorefilesSize();
OptionalLong storeMaxStoreFileAge = store.getMaxStoreFileAge(); OptionalLong storeMaxStoreFileAge = store.getMaxStoreFileAge();
@ -279,7 +279,7 @@ public class MetricsRegionWrapperImpl implements MetricsRegionWrapper, Closeable
numStoreFiles = tempNumStoreFiles; numStoreFiles = tempNumStoreFiles;
storeRefCount = tempStoreRefCount; storeRefCount = tempStoreRefCount;
maxStoreFileRefCount = tempMaxStoreFileRefCount; maxCompactedStoreFileRefCount = tempMaxCompactedStoreFileRefCount;
memstoreSize = tempMemstoreSize; memstoreSize = tempMemstoreSize;
storeFileSize = tempStoreFileSize; storeFileSize = tempStoreFileSize;
maxStoreFileAge = tempMaxStoreFileAge; maxStoreFileAge = tempMaxStoreFileAge;

View File

@ -214,7 +214,7 @@ public class TestRegionsRecoveryChore {
Mockito.verify(hMaster, Mockito.times(0)).reopenRegions(Mockito.any(), Mockito.anyList(), Mockito.verify(hMaster, Mockito.times(0)).reopenRegions(Mockito.any(), Mockito.anyList(),
Mockito.anyLong(), Mockito.anyLong()); Mockito.anyLong(), Mockito.anyLong());
// default maxStoreFileRefCount is -1 (no regions to be reopened using AM) // default maxCompactedStoreFileRefCount is -1 (no regions to be reopened using AM)
Mockito.verify(hMaster, Mockito.times(0)).getAssignmentManager(); Mockito.verify(hMaster, Mockito.times(0)).getAssignmentManager();
Mockito.verify(assignmentManager, Mockito.times(0)) Mockito.verify(assignmentManager, Mockito.times(0))
.getRegionInfo(Mockito.any()); .getRegionInfo(Mockito.any());
@ -380,7 +380,7 @@ public class TestRegionsRecoveryChore {
return serverMetrics; return serverMetrics;
} }
private static RegionMetrics getRegionMetrics(byte[] regionName, int storeRefCount) { private static RegionMetrics getRegionMetrics(byte[] regionName, int compactedStoreRefCount) {
RegionMetrics regionMetrics = new RegionMetrics() { RegionMetrics regionMetrics = new RegionMetrics() {
@Override @Override
@ -480,12 +480,12 @@ public class TestRegionsRecoveryChore {
@Override @Override
public int getStoreRefCount() { public int getStoreRefCount() {
return storeRefCount; return compactedStoreRefCount;
} }
@Override @Override
public int getMaxStoreFileRefCount() { public int getMaxCompactedStoreFileRefCount() {
return storeRefCount; return compactedStoreRefCount;
} }
}; };

View File

@ -66,7 +66,7 @@ public class MetricsRegionWrapperStub implements MetricsRegionWrapper {
} }
@Override @Override
public long getMaxStoreFileRefCount() { public long getMaxCompactedStoreFileRefCount() {
return 0; return 0;
} }

View File

@ -2047,19 +2047,25 @@ A comma-separated list of
+ +
.Description .Description
Very large ref count on a file indicates Very large number of ref count on a compacted
that it is a ref leak on that object. Such files store file indicates that it is a ref leak
can not be removed even after it is invalidated on that object(compacted store file).
via compaction. Only way to recover in such Such files can not be removed after
scenario is to reopen the region which can it is invalidated via compaction.
release all resources, like the refcount, leases, etc. Only way to recover in such scenario is to
This config represents Store files Ref Count threshold reopen the region which can release
value considered for reopening regions. all resources, like the refcount,
Any region with store files ref count > this value leases, etc. This config represents Store files Ref
would be eligible for reopening by master. Count threshold value considered for reopening
Default value -1 indicates this feature is turned off. regions. Any region with compacted store files
Only positive integer value should be provided to enable ref count > this value would be eligible for
this feature. reopening by master. Here, we get the max
refCount among all refCounts on all
compacted away store files that belong to a
particular region. Default value -1 indicates
this feature is turned off. Only positive
integer value should be provided to
enable this feature.
+ +
.Default .Default