Skip to content

Commit

Permalink
HBASE-28588 Remove deprecated methods in WAL
Browse files Browse the repository at this point in the history
  • Loading branch information
2005hithlj committed May 13, 2024
1 parent ca34010 commit f3e1bd6
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -686,12 +686,6 @@ public void abortCacheFlush(byte[] encodedRegionName) {
this.sequenceIdAccounting.abortCacheFlush(encodedRegionName);
}

@Override
public long getEarliestMemStoreSeqNum(byte[] encodedRegionName) {
// Used by tests. Deprecated as too subtle for general usage.
return this.sequenceIdAccounting.getLowestSequenceId(encodedRegionName);
}

@Override
public long getEarliestMemStoreSeqNum(byte[] encodedRegionName, byte[] familyName) {
// This method is used by tests and for figuring if we should flush or not because our
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,6 @@ public WALCoprocessorHost getCoprocessorHost() {
return coprocessorHost;
}

@Override
public long getEarliestMemStoreSeqNum(byte[] encodedRegionName) {
return HConstants.NO_SEQNUM;
}

@Override
public long getEarliestMemStoreSeqNum(byte[] encodedRegionName, byte[] familyName) {
return HConstants.NO_SEQNUM;
Expand Down
10 changes: 0 additions & 10 deletions hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WAL.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,6 @@ default void sync(long txid, boolean forceSync) throws IOException {
/** Returns Coprocessor host. */
WALCoprocessorHost getCoprocessorHost();

/**
* Gets the earliest unflushed sequence id in the memstore for the region.
* @param encodedRegionName The region to get the number for.
* @return The earliest/lowest/oldest sequence id if present, HConstants.NO_SEQNUM if absent.
* @deprecated Since version 1.2.0. Removing because not used and exposes subtle internal
* workings. Use {@link #getEarliestMemStoreSeqNum(byte[], byte[])}
*/
@Deprecated
long getEarliestMemStoreSeqNum(byte[] encodedRegionName);

/**
* Gets the earliest unflushed sequence id in the memstore for the store.
* @param encodedRegionName The region to get the number for.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ public void testSelectiveFlushWhenEnabled() throws IOException {
MemStoreSize cf3MemstoreSize = region.getStore(FAMILY3).getMemStoreSize();

// Get the overall smallest LSN in the region's memstores.
long smallestSeqInRegionCurrentMemstore =
getWAL(region).getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes());
long smallestSeqInRegionCurrentMemstore = getWAL(region)
.getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes(), FAMILY1);

// The overall smallest LSN in the region's memstores should be the same as
// the LSN of the smallest edit in CF1
Expand Down Expand Up @@ -193,8 +193,8 @@ public void testSelectiveFlushWhenEnabled() throws IOException {
cf2MemstoreSize = region.getStore(FAMILY2).getMemStoreSize();
cf3MemstoreSize = region.getStore(FAMILY3).getMemStoreSize();
totalMemstoreSize = region.getMemStoreDataSize();
smallestSeqInRegionCurrentMemstore =
getWAL(region).getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes());
smallestSeqInRegionCurrentMemstore = getWAL(region)
.getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes(), FAMILY2);

// We should have cleared out only CF1, since we chose the flush thresholds
// and number of puts accordingly.
Expand Down Expand Up @@ -231,8 +231,8 @@ public void testSelectiveFlushWhenEnabled() throws IOException {
cf2MemstoreSize = region.getStore(FAMILY2).getMemStoreSize();
cf3MemstoreSize = region.getStore(FAMILY3).getMemStoreSize();
totalMemstoreSize = region.getMemStoreDataSize();
smallestSeqInRegionCurrentMemstore =
getWAL(region).getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes());
smallestSeqInRegionCurrentMemstore = getWAL(region)
.getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes(), FAMILY3);

// CF1 and CF2, both should be absent.
assertEquals(0, cf1MemstoreSize.getDataSize());
Expand All @@ -242,6 +242,7 @@ public void testSelectiveFlushWhenEnabled() throws IOException {
// CF3 shouldn't have been touched.
assertEquals(cf3MemstoreSize, oldCF3MemstoreSize);
assertEquals(totalMemstoreSize, cf3MemstoreSize.getDataSize());
assertEquals(smallestSeqInRegionCurrentMemstore, smallestSeqCF3);

// What happens when we hit the memstore limit, but we are not able to find
// any Column Family above the threshold?
Expand Down Expand Up @@ -313,8 +314,8 @@ public void testSelectiveFlushWhenNotEnabled() throws IOException {
cf2MemstoreSize = region.getStore(FAMILY2).getMemStoreSize();
cf3MemstoreSize = region.getStore(FAMILY3).getMemStoreSize();
totalMemstoreSize = region.getMemStoreDataSize();
long smallestSeqInRegionCurrentMemstore =
region.getWAL().getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes());
long smallestSeqInRegionCurrentMemstore = region.getWAL()
.getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes(), FAMILY1);

// Everything should have been cleared
assertEquals(0, cf1MemstoreSize.getDataSize());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ public void testSelectiveFlushWithEager() throws IOException {
MemStoreSize cf3MemstoreSizePhaseI = region.getStore(FAMILY3).getMemStoreSize();

// Get the overall smallest LSN in the region's memstores.
long smallestSeqInRegionCurrentMemstorePhaseI =
getWAL(region).getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes());
long smallestSeqInRegionCurrentMemstorePhaseI = getWAL(region)
.getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes(), FAMILY1);

String s = "\n\n----------------------------------\n"
+ "Upon initial insert and before any flush, size of CF1 is:" + cf1MemstoreSizePhaseI
Expand Down Expand Up @@ -224,8 +224,8 @@ public void testSelectiveFlushWithEager() throws IOException {
MemStoreSize cf2MemstoreSizePhaseII = region.getStore(FAMILY2).getMemStoreSize();
MemStoreSize cf3MemstoreSizePhaseII = region.getStore(FAMILY3).getMemStoreSize();

long smallestSeqInRegionCurrentMemstorePhaseII =
getWAL(region).getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes());
long smallestSeqInRegionCurrentMemstorePhaseII = getWAL(region)
.getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes(), FAMILY1);
// Find the smallest LSNs for edits wrt to each CF.
long smallestSeqCF1PhaseII = region.getOldestSeqIdOfStore(FAMILY1);
long smallestSeqCF2PhaseII = region.getOldestSeqIdOfStore(FAMILY2);
Expand Down Expand Up @@ -280,8 +280,8 @@ public void testSelectiveFlushWithEager() throws IOException {
MemStoreSize cf2MemstoreSizePhaseIV = region.getStore(FAMILY2).getMemStoreSize();
MemStoreSize cf3MemstoreSizePhaseIV = region.getStore(FAMILY3).getMemStoreSize();

long smallestSeqInRegionCurrentMemstorePhaseIV =
getWAL(region).getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes());
long smallestSeqInRegionCurrentMemstorePhaseIV = getWAL(region)
.getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes(), FAMILY3);
long smallestSeqCF1PhaseIV = region.getOldestSeqIdOfStore(FAMILY1);
long smallestSeqCF2PhaseIV = region.getOldestSeqIdOfStore(FAMILY2);
long smallestSeqCF3PhaseIV = region.getOldestSeqIdOfStore(FAMILY3);
Expand Down Expand Up @@ -318,8 +318,8 @@ public void testSelectiveFlushWithEager() throws IOException {
MemStoreSize cf1MemstoreSizePhaseV = region.getStore(FAMILY1).getMemStoreSize();
MemStoreSize cf2MemstoreSizePhaseV = region.getStore(FAMILY2).getMemStoreSize();
MemStoreSize cf3MemstoreSizePhaseV = region.getStore(FAMILY3).getMemStoreSize();
long smallestSeqInRegionCurrentMemstorePhaseV =
getWAL(region).getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes());
long smallestSeqInRegionCurrentMemstorePhaseV = getWAL(region)
.getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes(), FAMILY1);

assertEquals(0, cf1MemstoreSizePhaseV.getDataSize());
assertEquals(MutableSegment.DEEP_OVERHEAD, cf1MemstoreSizePhaseV.getHeapSize());
Expand Down Expand Up @@ -405,8 +405,8 @@ public void testSelectiveFlushWithIndexCompaction() throws IOException {
MemStoreSize cf2MemstoreSizePhaseI = region.getStore(FAMILY2).getMemStoreSize();
MemStoreSize cf3MemstoreSizePhaseI = region.getStore(FAMILY3).getMemStoreSize();
// Get the overall smallest LSN in the region's memstores.
long smallestSeqInRegionCurrentMemstorePhaseI =
getWAL(region).getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes());
long smallestSeqInRegionCurrentMemstorePhaseI = getWAL(region)
.getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes(), FAMILY1);

/*------------------------------------------------------------------------------*/
/* PHASE I - validation */
Expand Down Expand Up @@ -458,8 +458,8 @@ public void testSelectiveFlushWithIndexCompaction() throws IOException {
MemStoreSize cf1MemstoreSizePhaseII = region.getStore(FAMILY1).getMemStoreSize();
MemStoreSize cf2MemstoreSizePhaseII = region.getStore(FAMILY2).getMemStoreSize();
MemStoreSize cf3MemstoreSizePhaseII = region.getStore(FAMILY3).getMemStoreSize();
long smallestSeqInRegionCurrentMemstorePhaseII =
getWAL(region).getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes());
long smallestSeqInRegionCurrentMemstorePhaseII = getWAL(region)
.getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes(), FAMILY1);
// Find the smallest LSNs for edits wrt to each CF.
long smallestSeqCF3PhaseII = region.getOldestSeqIdOfStore(FAMILY3);
long totalMemstoreSizePhaseII = region.getMemStoreDataSize();
Expand Down Expand Up @@ -531,8 +531,8 @@ public void testSelectiveFlushWithIndexCompaction() throws IOException {
MemStoreSize cf1MemstoreSizePhaseIV = region.getStore(FAMILY1).getMemStoreSize();
MemStoreSize cf2MemstoreSizePhaseIV = region.getStore(FAMILY2).getMemStoreSize();
MemStoreSize cf3MemstoreSizePhaseIV = region.getStore(FAMILY3).getMemStoreSize();
long smallestSeqInRegionCurrentMemstorePhaseIV =
getWAL(region).getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes());
long smallestSeqInRegionCurrentMemstorePhaseIV = getWAL(region)
.getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes(), FAMILY3);
long smallestSeqCF3PhaseIV = region.getOldestSeqIdOfStore(FAMILY3);

/*------------------------------------------------------------------------------*/
Expand Down Expand Up @@ -563,8 +563,8 @@ public void testSelectiveFlushWithIndexCompaction() throws IOException {
MemStoreSize cf1MemstoreSizePhaseV = region.getStore(FAMILY1).getMemStoreSize();
MemStoreSize cf2MemstoreSizePhaseV = region.getStore(FAMILY2).getMemStoreSize();
MemStoreSize cf3MemstoreSizePhaseV = region.getStore(FAMILY3).getMemStoreSize();
long smallestSeqInRegionCurrentMemstorePhaseV =
getWAL(region).getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes());
long smallestSeqInRegionCurrentMemstorePhaseV = getWAL(region)
.getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes(), FAMILY1);
long totalMemstoreSizePhaseV = region.getMemStoreDataSize();

/*------------------------------------------------------------------------------*/
Expand Down Expand Up @@ -683,8 +683,8 @@ public void testSelectiveFlushAndWALinDataCompaction() throws IOException {

MemStoreSize cf2MemstoreSizePhaseII = region.getStore(FAMILY2).getMemStoreSize();

long smallestSeqInRegionCurrentMemstorePhaseII =
region.getWAL().getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes());
long smallestSeqInRegionCurrentMemstorePhaseII = region.getWAL()
.getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes(), FAMILY1);
long smallestSeqCF1PhaseII = region.getOldestSeqIdOfStore(FAMILY1);
long smallestSeqCF2PhaseII = region.getOldestSeqIdOfStore(FAMILY2);
long smallestSeqCF3PhaseII = region.getOldestSeqIdOfStore(FAMILY3);
Expand Down Expand Up @@ -713,8 +713,8 @@ public void testSelectiveFlushAndWALinDataCompaction() throws IOException {
region.put(createPut(2, i));
}

long smallestSeqInRegionCurrentMemstorePhaseIII =
region.getWAL().getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes());
long smallestSeqInRegionCurrentMemstorePhaseIII = region.getWAL()
.getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes(), FAMILY1);
long smallestSeqCF1PhaseIII = region.getOldestSeqIdOfStore(FAMILY1);
long smallestSeqCF2PhaseIII = region.getOldestSeqIdOfStore(FAMILY2);
long smallestSeqCF3PhaseIII = region.getOldestSeqIdOfStore(FAMILY3);
Expand All @@ -731,8 +731,8 @@ public void testSelectiveFlushAndWALinDataCompaction() throws IOException {
cms3.flushInMemory();
region.flush(false);

long smallestSeqInRegionCurrentMemstorePhaseIV =
region.getWAL().getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes());
long smallestSeqInRegionCurrentMemstorePhaseIV = region.getWAL()
.getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes(), FAMILY1);
long smallestSeqCF1PhaseIV = region.getOldestSeqIdOfStore(FAMILY1);
long smallestSeqCF2PhaseIV = region.getOldestSeqIdOfStore(FAMILY2);
long smallestSeqCF3PhaseIV = region.getOldestSeqIdOfStore(FAMILY3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ public void testUnflushedSeqIdTrackingWithAsyncWal() throws IOException, Interru
}, startHoldingForAppend, closeFinished, holdAppend);

// now check the region's unflushed seqIds.
long seqId = wal.getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes());
long seqId = wal.getEarliestMemStoreSeqNum(region.getRegionInfo().getEncodedNameAsBytes(), b);
assertEquals("Found seqId for the region which is already closed", HConstants.NO_SEQNUM,
seqId);
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public void run() {
assertEquals("Region did not flush?", 1, region.getStoreFileList(new byte[][] { b }).size());

// now check the region's unflushed seqIds.
long seqId = log.getEarliestMemStoreSeqNum(hri.getEncodedNameAsBytes());
long seqId = log.getEarliestMemStoreSeqNum(hri.getEncodedNameAsBytes(), b);
assertEquals("Found seqId for the region which is already flushed", HConstants.NO_SEQNUM,
seqId);

Expand Down

0 comments on commit f3e1bd6

Please sign in to comment.