Skip to content

Commit 88b9e98

Browse files
nyl3532016niuyulin
authored andcommitted
HBASE-25637 Rename method completeCompaction to refreshStoreSizeAndTotalBytes (#3023)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
1 parent 0487760 commit 88b9e98

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ protected HStore(final HRegion region, final ColumnFamilyDescriptor family,
303303
List<HStoreFile> hStoreFiles = loadStoreFiles(warmup);
304304
// Move the storeSize calculation out of loadStoreFiles() method, because the secondary read
305305
// replica's refreshStoreFiles() will also use loadStoreFiles() to refresh its store files and
306-
// update the storeSize in the completeCompaction(..) finally (just like compaction) , so
306+
// update the storeSize in the refreshStoreSizeAndTotalBytes() finally (just like compaction) , so
307307
// no need calculate the storeSize twice.
308308
this.storeSize.addAndGet(getStorefilesSize(hStoreFiles, sf -> true));
309309
this.totalUncompressedBytes.addAndGet(getTotalUncompressedBytes(hStoreFiles));
@@ -727,7 +727,7 @@ private void refreshStoreFilesInternal(Collection<StoreFileInfo> newFiles) throw
727727
region.getMVCC().advanceTo(this.getMaxSequenceId().getAsLong());
728728
}
729729

730-
completeCompaction(toBeRemovedStoreFiles);
730+
refreshStoreSizeAndTotalBytes();
731731
}
732732

733733
protected HStoreFile createStoreFileAndReader(final Path p) throws IOException {
@@ -1557,7 +1557,7 @@ protected List<HStoreFile> doCompaction(CompactionRequestImpl cr,
15571557
long outputBytes = getTotalSize(sfs);
15581558

15591559
// At this point the store will use new files for all new scanners.
1560-
completeCompaction(filesToCompact); // update store size.
1560+
refreshStoreSizeAndTotalBytes(); // update store size.
15611561

15621562
long now = EnvironmentEdgeManager.currentTime();
15631563
if (region.getRegionServerServices() != null
@@ -1783,7 +1783,7 @@ public void replayCompactionMarker(CompactionDescriptor compaction, boolean pick
17831783
LOG.info("Replaying compaction marker, replacing input files: " +
17841784
inputStoreFiles + " with output files : " + outputStoreFiles);
17851785
this.replaceStoreFiles(inputStoreFiles, outputStoreFiles);
1786-
this.completeCompaction(inputStoreFiles);
1786+
this.refreshStoreSizeAndTotalBytes();
17871787
}
17881788
}
17891789

@@ -1836,7 +1836,7 @@ public void compactRecentForTestingAssumingDefaultPolicy(int N) throws IOExcepti
18361836
this.getCoprocessorHost().postCompact(this, sf, null, null, null);
18371837
}
18381838
replaceStoreFiles(filesToCompact, Collections.singletonList(sf));
1839-
completeCompaction(filesToCompact);
1839+
refreshStoreSizeAndTotalBytes();
18401840
}
18411841
} finally {
18421842
synchronized (filesCompacting) {
@@ -2024,7 +2024,7 @@ private void removeUnneededFiles() throws IOException {
20242024
Collection<HStoreFile> newFiles = Collections.emptyList(); // No new files.
20252025
writeCompactionWalRecord(delSfs, newFiles);
20262026
replaceStoreFiles(delSfs, newFiles);
2027-
completeCompaction(delSfs);
2027+
refreshStoreSizeAndTotalBytes();
20282028
LOG.info("Completed removal of " + delSfs.size() + " unnecessary (expired) file(s) in "
20292029
+ this + "; total size is "
20302030
+ TraditionalBinaryPrefix.long2String(storeSize.get(), "", 1));
@@ -2066,10 +2066,8 @@ private void validateStoreFile(Path path) throws IOException {
20662066

20672067
/**
20682068
* Update counts.
2069-
* @param compactedFiles list of files that were compacted
20702069
*/
2071-
protected void completeCompaction(Collection<HStoreFile> compactedFiles)
2072-
// Rename this method! TODO.
2070+
protected void refreshStoreSizeAndTotalBytes()
20732071
throws IOException {
20742072
this.storeSize.set(0L);
20752073
this.totalUncompressedBytes.set(0L);

hbase-server/src/test/java/org/apache/hadoop/hbase/TestIOFencing.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import static org.junit.Assert.assertTrue;
2222

2323
import java.io.IOException;
24-
import java.util.Collection;
2524
import java.util.List;
2625
import java.util.concurrent.CountDownLatch;
2726
import java.util.concurrent.atomic.AtomicInteger;
@@ -38,7 +37,6 @@
3837
import org.apache.hadoop.hbase.regionserver.HRegion;
3938
import org.apache.hadoop.hbase.regionserver.HRegionServer;
4039
import org.apache.hadoop.hbase.regionserver.HStore;
41-
import org.apache.hadoop.hbase.regionserver.HStoreFile;
4240
import org.apache.hadoop.hbase.regionserver.Region;
4341
import org.apache.hadoop.hbase.regionserver.RegionServerServices;
4442
import org.apache.hadoop.hbase.regionserver.compactions.CompactionContext;
@@ -210,14 +208,14 @@ protected BlockCompactionsInCompletionHStore(HRegion region, ColumnFamilyDescrip
210208
}
211209

212210
@Override
213-
protected void completeCompaction(Collection<HStoreFile> compactedFiles) throws IOException {
211+
protected void refreshStoreSizeAndTotalBytes() throws IOException {
214212
try {
215213
r.compactionsWaiting.countDown();
216214
r.compactionsBlocked.await();
217215
} catch (InterruptedException ex) {
218216
throw new IOException(ex);
219217
}
220-
super.completeCompaction(compactedFiles);
218+
super.refreshStoreSizeAndTotalBytes();
221219
}
222220
}
223221

0 commit comments

Comments
 (0)