Skip to content

Commit

Permalink
ODX-964 fixing UT errors after resolving conflicts
Browse files Browse the repository at this point in the history
Change-Id: I4577a1d230c372eb4b27c6ec2be87483897b21c9
  • Loading branch information
Wellington Chevreuil authored and Josh Elser committed Dec 22, 2021
1 parent 05a0434 commit 0b52d03
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ public final StoreFileWriter createWriter(CreateStoreFileWriterParams params) th
.withOutputDir(outputDir).withBloomType(ctx.getBloomFilterType())
.withMaxKeyCount(params.maxKeyCount()).withFavoredNodes(ctx.getFavoredNodes())
.withFileContext(hFileContext).withShouldDropCacheBehind(params.shouldDropBehind())
.withCompactedFilesSupplier(ctx.getCompactedFilesSupplier());
.withCompactedFilesSupplier(ctx.getCompactedFilesSupplier())
.withComparator(ctx.getComparator());
return builder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ public static StoreFileTracker create(Configuration conf, boolean isPrimaryRepli
ColumnFamilyDescriptorBuilder fDescBuilder =
ColumnFamilyDescriptorBuilder.newBuilder(Bytes.toBytes(family));
StoreContext ctx = StoreContext.getBuilder().withColumnFamilyDescriptor(fDescBuilder.build())
.withRegionFileSystem(regionFs).build();
.withRegionFileSystem(regionFs)
.withFamilyStoreDirectoryPath(regionFs.getStoreDir(family))
.build();
return StoreFileTrackerFactory.create(conf, isPrimaryReplica, ctx);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private void compaction(final String tableName, final int flushes,
}
}
long curt = System.currentTimeMillis();
long waitTime = 5000;
long waitTime = 15000;
long endt = curt + waitTime;
CompactionState state = getCompactionState(stateSource, master, admin, table);
while (state == CompactionState.NONE && curt < endt) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
*/
package org.apache.hadoop.hbase.regionserver;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.CellComparatorImpl;
import org.apache.hadoop.hbase.HBaseClassTestRule;
Expand Down Expand Up @@ -65,11 +67,13 @@ public void testCustomParts() throws Exception {
DummyCompactionPolicy.class.getName());
conf.set(DefaultStoreEngine.DEFAULT_STORE_FLUSHER_CLASS_KEY,
DummyStoreFlusher.class.getName());
HRegion mockRegion = Mockito.mock(HRegion.class);
HStore mockStore = Mockito.mock(HStore.class);
HRegion mockRegion = mock(HRegion.class);
HStore mockStore = mock(HStore.class);
mockStore.conf = conf;
Mockito.when(mockStore.getRegionInfo()).thenReturn(RegionInfoBuilder.FIRST_META_REGIONINFO);
Mockito.when(mockStore.getHRegion()).thenReturn(mockRegion);
when(mockStore.getRegionInfo()).thenReturn(RegionInfoBuilder.FIRST_META_REGIONINFO);
when(mockStore.getHRegion()).thenReturn(mockRegion);
StoreContext context = new StoreContext.Builder().build();
when(mockStore.getStoreContext()).thenReturn(context);
StoreEngine<?, ?, ?, ?> se =
StoreEngine.create(mockStore, conf, CellComparatorImpl.COMPARATOR);
Assert.assertTrue(se instanceof DefaultStoreEngine);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ private void testMinorCompactionWithDelete(Delete delete, int expectedResultsAft
// Check that we did compact
assertTrue("Number of store files should go down", numFiles1 > numFiles2);
// Check that it was a minor compaction.
assertTrue("Was not supposed to be a major compaction", numFiles2 > 1);
assertTrue("Was not supposed to be a major compaction",
!compaction.get().getRequest().isMajor());

// Make sure that we have only deleted family2 from secondRowBytes
result = r.get(new Get(secondRowBytes).addColumn(fam2, col2).setMaxVersions(100));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ private static TestStoreEngine createEngine(Configuration conf) throws Exception
when(store.getRegionInfo()).thenReturn(RegionInfoBuilder.FIRST_META_REGIONINFO);
when(store.getHRegion()).thenReturn(region);
CellComparatorImpl kvComparator = mock(CellComparatorImpl.class);
StoreContext context = new StoreContext.Builder().build();
when(store.getStoreContext()).thenReturn(context);
return (TestStoreEngine) StoreEngine.create(store, conf, kvComparator);
}

Expand Down

0 comments on commit 0b52d03

Please sign in to comment.