Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
*/
class OnlineIndexerIndexFromIndexTest extends OnlineIndexerTest {

private void populateData(final long numRecords, final long numOtherRecords) {
private void populateDataSimpleAndOther(final long numRecords, final long numOtherRecords) {
openSimpleMetaData();
List<TestRecords1Proto.MySimpleRecord> simpleRecords = LongStream.range(0, numRecords).mapToObj(val ->
TestRecords1Proto.MySimpleRecord.newBuilder()
Expand Down Expand Up @@ -177,7 +177,7 @@ void testNonIdempotentIndexFromIndex(boolean reverseScan) {
Index tgtIndex = new Index("tgt_index", field("num_value_3_indexed").ungrouped(), IndexTypes.SUM);
FDBRecordStoreTestBase.RecordMetaDataHook hook = myHook(srcIndex, tgtIndex);

populateData(numRecords, otherRecords);
populateDataSimpleAndOther(numRecords, otherRecords);

openSimpleMetaData(hook);
buildIndexClean(srcIndex);
Expand Down Expand Up @@ -208,7 +208,7 @@ void testCanBuildNonIdempotentIndexFromIndexOnNewStoreWithOldFormatVersionInInde
Index tgtIndex = new Index("tgt_index", field("num_value_3_indexed").ungrouped(), IndexTypes.SUM);
FDBRecordStoreTestBase.RecordMetaDataHook hook = myHook(srcIndex, tgtIndex);

populateData(numRecords, otherRecords);
populateDataSimpleAndOther(numRecords, otherRecords);

openSimpleMetaData(hook);
buildIndexClean(srcIndex);
Expand Down Expand Up @@ -244,7 +244,7 @@ void testNonIdempotentIndexFromIndexOldFormatFallback(boolean reverseScan) {
Index tgtIndex = new Index("tgt_index", field("num_value_3_indexed").ungrouped(), IndexTypes.SUM);
FDBRecordStoreTestBase.RecordMetaDataHook hook = myHook(srcIndex, tgtIndex);

populateData(numRecords, otherRecords);
populateDataSimpleAndOther(numRecords, otherRecords);

openSimpleMetaData(hook);
buildIndexClean(srcIndex);
Expand Down Expand Up @@ -277,7 +277,7 @@ void testNonIdempotentIndexFromIndexOldFormatNoFallback() {
Index tgtIndex = new Index("tgt_index", field("num_value_3_indexed").ungrouped(), IndexTypes.SUM);
FDBRecordStoreTestBase.RecordMetaDataHook hook = myHook(srcIndex, tgtIndex);

populateData(numRecords, otherRecords);
populateDataSimpleAndOther(numRecords, otherRecords);

openSimpleMetaData(hook);
buildIndexClean(srcIndex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.apple.foundationdb.record.metadata.expressions.GroupingKeyExpression;
import com.apple.foundationdb.synchronizedsession.SynchronizedSessionLockedException;
import com.apple.test.BooleanSource;
import com.apple.test.SuperSlow;
import com.apple.test.Tags;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -663,22 +664,26 @@ void testSingleTargetCompletion() {
assertEquals(numRecords, timer.getCount(FDBStoreTimer.Counts.ONLINE_INDEX_BUILDER_RECORDS_INDEXED));
}

// uncomment to compare
// @Test
@Test
@SuperSlow
void benchMarkMultiTarget() {
// Expected to run in a nightly test. To run in intellij, add "-Ptests.nightly=true" to the run configuration
// (As in `:fdb-record-layer-core:test --tests "com.apple.foundationdb.record.provider.foundationdb.OnlineIndexerMultiTargetTest.benchMarkMultiTarget" -Ptests.nightly=true`)
// compare single target build to multi target index building
final FDBStoreTimer singleTimer = new FDBStoreTimer();
final FDBStoreTimer multiTimer = new FDBStoreTimer();
final int numRecords = 5555;
final int populateChunkSize = 5555;
final int numRecords = 5 * populateChunkSize;
for (int i = 0; i < 5; i++) {
populateData(populateChunkSize, i * populateChunkSize);
}

List<Index> indexes = new ArrayList<>();
indexes.add(new Index("indexA", field("num_value_2"), EmptyKeyExpression.EMPTY, IndexTypes.VALUE, IndexOptions.UNIQUE_OPTIONS));
indexes.add(new Index("indexB", field("num_value_3_indexed"), IndexTypes.VALUE));
indexes.add(new Index("indexC", field("num_value_unique"), EmptyKeyExpression.EMPTY, IndexTypes.VALUE, IndexOptions.UNIQUE_OPTIONS));
indexes.add(new Index("indexD", new GroupingKeyExpression(EmptyKeyExpression.EMPTY, 0), IndexTypes.COUNT));

populateData(numRecords);

FDBRecordStoreTestBase.RecordMetaDataHook hook = allIndexesHook(indexes);

long startSingle = System.currentTimeMillis();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,12 @@ protected void scrubAndValidate(List<Index> indexes) {
}

protected void populateData(final long numRecords) {
populateData(numRecords, 0L);
}

protected void populateData(final long numRecords, final long start) {
openSimpleMetaData();
List<TestRecords1Proto.MySimpleRecord> records = LongStream.range(0, numRecords).mapToObj(val ->
List<TestRecords1Proto.MySimpleRecord> records = LongStream.range(start, start + numRecords).mapToObj(val ->
TestRecords1Proto.MySimpleRecord.newBuilder()
.setRecNo(val)
.setNumValue2((int)val * 19)
Expand Down
Loading