HBASE-20470 [2.0.0RC1] has broken unit tests...

Fix test that depended upon flush being slow and one family only.
Fix MemStoreSize compare to allow passing alternate implementation
(needed when IMC was no longer default everywhere).
This commit is contained in:
Michael Stack 2018-04-21 08:37:25 -07:00
parent f4a39043e2
commit 1633d9d61d
3 changed files with 9 additions and 6 deletions

View File

@ -19,8 +19,6 @@
package org.apache.hadoop.hbase.coprocessor; package org.apache.hadoop.hbase.coprocessor;
import edu.umd.cs.findbugs.annotations.NonNull;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -199,7 +197,6 @@ public interface RegionObserver {
* @param scanner the scanner over existing data used in the memstore segments being compact * @param scanner the scanner over existing data used in the memstore segments being compact
* @return the scanner to use during in memory compaction. Must be non-null. * @return the scanner to use during in memory compaction. Must be non-null.
*/ */
@NonNull
default InternalScanner preMemStoreCompactionCompact( default InternalScanner preMemStoreCompactionCompact(
ObserverContext<RegionCoprocessorEnvironment> c, Store store, InternalScanner scanner) ObserverContext<RegionCoprocessorEnvironment> c, Store store, InternalScanner scanner)
throws IOException { throws IOException {

View File

@ -95,7 +95,10 @@ public class MemStoreSize {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || getClass() != obj.getClass()) { if (obj == null) {
return false;
}
if (!(obj instanceof MemStoreSize)) {
return false; return false;
} }
MemStoreSize other = (MemStoreSize) obj; MemStoreSize other = (MemStoreSize) obj;

View File

@ -391,8 +391,11 @@ public class TestPerColumnFamilyFlush {
// CF1 Should have been flushed // CF1 Should have been flushed
assertEquals(0, cf1MemstoreSize); assertEquals(0, cf1MemstoreSize);
// CF2 and CF3 shouldn't have been flushed. // CF2 and CF3 shouldn't have been flushed.
assertTrue(cf2MemstoreSize > 0); // TODO: This test doesn't allow for this case:
assertTrue(cf3MemstoreSize > 0); // " Since none of the CFs were above the size, flushing all."
// i.e. a flush happens before we get to here and its a flush-all.
assertTrue(cf2MemstoreSize >= 0);
assertTrue(cf3MemstoreSize >= 0);
assertEquals(totalMemstoreSize, cf2MemstoreSize + cf3MemstoreSize); assertEquals(totalMemstoreSize, cf2MemstoreSize + cf3MemstoreSize);
// Wait for the RS report to go across to the master, so that the master // Wait for the RS report to go across to the master, so that the master