HBASE-26068 The last assertion in TestHStore.testRefreshStoreFilesNotChanged is wrong (#3461)

Signed-off-by: Yulin Niu <niuyulin@apache.org
This commit is contained in:
Duo Zhang 2021-07-07 14:34:42 +08:00
parent bde5d98338
commit 1ba03cae4b
1 changed files with 10 additions and 26 deletions

View File

@ -161,11 +161,6 @@ public class TestHStore {
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
private static final String DIR = TEST_UTIL.getDataTestDir("TestStore").toString(); private static final String DIR = TEST_UTIL.getDataTestDir("TestStore").toString();
/**
* Setup
* @throws IOException
*/
@Before @Before
public void setUp() throws IOException { public void setUp() throws IOException {
qualifiers.clear(); qualifiers.clear();
@ -245,7 +240,6 @@ public class TestHStore {
/** /**
* Test we do not lose data if we fail a flush and then close. * Test we do not lose data if we fail a flush and then close.
* Part of HBase-10466 * Part of HBase-10466
* @throws Exception
*/ */
@Test @Test
public void testFlushSizeSizing() throws Exception { public void testFlushSizeSizing() throws Exception {
@ -347,7 +341,7 @@ public class TestHStore {
testDeleteExpiredStoreFiles(1); testDeleteExpiredStoreFiles(1);
} }
/* /**
* @param minVersions the MIN_VERSIONS for the column family * @param minVersions the MIN_VERSIONS for the column family
*/ */
public void testDeleteExpiredStoreFiles(int minVersions) throws Exception { public void testDeleteExpiredStoreFiles(int minVersions) throws Exception {
@ -472,9 +466,9 @@ public class TestHStore {
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
private static final int BLOCKSIZE_SMALL = 8192; private static final int BLOCKSIZE_SMALL = 8192;
/** /**
* Test for hbase-1686. * Test for hbase-1686.
* @throws IOException
*/ */
@Test @Test
public void testEmptyStoreFile() throws IOException { public void testEmptyStoreFile() throws IOException {
@ -512,7 +506,6 @@ public class TestHStore {
/** /**
* Getting data from memstore only * Getting data from memstore only
* @throws IOException
*/ */
@Test @Test
public void testGet_FromMemStoreOnly() throws IOException { public void testGet_FromMemStoreOnly() throws IOException {
@ -567,7 +560,6 @@ public class TestHStore {
/** /**
* Getting data from files only * Getting data from files only
* @throws IOException
*/ */
@Test @Test
public void testGet_FromFilesOnly() throws IOException { public void testGet_FromFilesOnly() throws IOException {
@ -606,7 +598,6 @@ public class TestHStore {
/** /**
* Getting data from memstore and files * Getting data from memstore and files
* @throws IOException
*/ */
@Test @Test
public void testGet_FromMemStoreAndFiles() throws IOException { public void testGet_FromMemStoreAndFiles() throws IOException {
@ -735,7 +726,7 @@ public class TestHStore {
public FaultyFileSystem() { public FaultyFileSystem() {
super(new LocalFileSystem()); super(new LocalFileSystem());
System.err.println("Creating faulty!"); LOG.info("Creating faulty!");
} }
@Override @Override
@ -774,7 +765,7 @@ public class TestHStore {
@Override @Override
public synchronized void write(byte[] buf, int offset, int length) throws IOException { public synchronized void write(byte[] buf, int offset, int length) throws IOException {
System.err.println("faulty stream write at pos " + getPos()); LOG.info("faulty stream write at pos " + getPos());
injectFault(); injectFault();
super.write(buf, offset, length); super.write(buf, offset, length);
} }
@ -795,13 +786,9 @@ public class TestHStore {
/** /**
* Generate a list of KeyValues for testing based on given parameters * Generate a list of KeyValues for testing based on given parameters
* @param timestamps
* @param numRows
* @param qualifier
* @param family
* @return the rows key-value list * @return the rows key-value list
*/ */
List<Cell> getKeyValueSet(long[] timestamps, int numRows, private List<Cell> getKeyValueSet(long[] timestamps, int numRows,
byte[] qualifier, byte[] family) { byte[] qualifier, byte[] family) {
List<Cell> kvList = new ArrayList<>(); List<Cell> kvList = new ArrayList<>();
for (int i=1;i<=numRows;i++) { for (int i=1;i<=numRows;i++) {
@ -1028,7 +1015,7 @@ public class TestHStore {
assertEquals(0, this.store.getStorefilesCount()); assertEquals(0, this.store.getStorefilesCount());
// add some data, flush // add some data, flush
this.store.add(new KeyValue(row, family, qf1, 1, (byte[])null), null); this.store.add(new KeyValue(row, family, qf1, 1, (byte[]) null), null);
flush(1); flush(1);
// add one more file // add one more file
addStoreFile(); addStoreFile();
@ -1043,17 +1030,16 @@ public class TestHStore {
// call second time // call second time
spiedStore.refreshStoreFiles(); spiedStore.refreshStoreFiles();
//ensure that replaceStoreFiles is not called if files are not refreshed // ensure that replaceStoreFiles is not called, i.e, the times does not change, if files are not
verify(spiedStore, times(0)).replaceStoreFiles(null, null); // refreshed,
verify(spiedStore, times(1)).replaceStoreFiles(any(), any());
} }
private long countMemStoreScanner(StoreScanner scanner) { private long countMemStoreScanner(StoreScanner scanner) {
if (scanner.currentScanners == null) { if (scanner.currentScanners == null) {
return 0; return 0;
} }
return scanner.currentScanners.stream() return scanner.currentScanners.stream().filter(s -> !s.isFileScanner()).count();
.filter(s -> !s.isFileScanner())
.count();
} }
@Test @Test
@ -1469,8 +1455,6 @@ public class TestHStore {
* may change the versionedList. And the first InMemoryFlushRunnable will use the chagned * may change the versionedList. And the first InMemoryFlushRunnable will use the chagned
* versionedList to remove the corresponding segments. * versionedList to remove the corresponding segments.
* In short, there will be some segements which isn't in merge are removed. * In short, there will be some segements which isn't in merge are removed.
* @throws IOException
* @throws InterruptedException
*/ */
@Test @Test
public void testRunDoubleMemStoreCompactors() throws IOException, InterruptedException { public void testRunDoubleMemStoreCompactors() throws IOException, InterruptedException {