Skip to content
Permalink
Browse files
Merge branch 'trunk' into OAK-9734
  • Loading branch information
FrancoisZhang committed Mar 23, 2022
2 parents e495392 + 871ce1b commit c044634bd85b5ca73c4ac423a8ac82d00fabb1bd
Showing 15 changed files with 882 additions and 198 deletions.
@@ -94,7 +94,12 @@ public void markWorkingIndexes(Set<String> updatedIndexPaths) {
}
}
if (meter != null) {
meter.mark(indexes.size());
// indexes.size() gives us the number of remaining corrupt indices.
// meter.mark(indexes.size()) increments the current meter count by indexes.size(). We don't want that here.
// We actually want to set the the meter count to indexes.size(), the api doesn't seem to support that.
// So we instead add indexes.size() - meter.getCount() , which will always be <= 0. So this effectively will reduce the meter count
// by number of indexes fixed in this call.
meter.mark(indexes.size() - meter.getCount());
}
}

@@ -21,9 +21,16 @@

import java.util.Calendar;
import java.util.Collections;
import java.util.HashSet;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

import org.apache.jackrabbit.oak.stats.Clock;
import org.apache.jackrabbit.oak.stats.DefaultStatisticsProvider;
import org.apache.jackrabbit.oak.stats.MeterStats;
import org.apache.jackrabbit.oak.stats.StatsOptions;
import org.junit.After;
import org.junit.Test;

import static org.junit.Assert.*;
@@ -32,6 +39,12 @@ public class TrackingCorruptIndexHandlerTest {

private TrackingCorruptIndexHandler handler = new TrackingCorruptIndexHandler();
private Clock clock = new Clock.Virtual();
private final ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor();

@After
public void cleanup() {
scheduledExecutorService.shutdown();
}

@Test
public void basics() throws Exception{
@@ -51,6 +64,25 @@ public void basics() throws Exception{
assertFalse(handler.getCorruptIndexData("async").containsKey("/oak:index/foo"));
}

@Test
public void testCorruptCounter() {
MeterStats meter = new DefaultStatisticsProvider(scheduledExecutorService).
getMeter(TrackingCorruptIndexHandler.CORRUPT_INDEX_METER_NAME, StatsOptions.METRICS_ONLY);

handler.setMeterStats(meter);
handler.setClock(clock);
handler.indexUpdateFailed("async", "/oak:index/foo", new Exception());
assertEquals(1, meter.getCount());
handler.indexUpdateFailed("async", "/oak:index/bar", new Exception());
assertEquals(2, meter.getCount());

HashSet<String> set = new HashSet<>();
set.add("/oak:index/foo");
handler.markWorkingIndexes(set);

assertEquals(1, meter.getCount());
}

@Test
public void disbaled() throws Exception{
handler.setClock(clock);
@@ -161,6 +161,13 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>oak-commons</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
@@ -52,19 +52,36 @@ public class FlatFileNodeStoreBuilder {
* System property name for sort strategy. This takes precedence over {@link #OAK_INDEXER_TRAVERSE_WITH_SORT}.
* Allowed values are the values from enum {@link SortStrategyType}
*/
static final String OAK_INDEXER_SORT_STRATEGY_TYPE = "oak.indexer.sortStrategyType";
public static final String OAK_INDEXER_SORT_STRATEGY_TYPE = "oak.indexer.sortStrategyType";
public static final String OAK_INDEXER_SORTED_FILE_PATH = "oak.indexer.sortedFilePath";


/**
* Default value for {@link #PROP_THREAD_POOL_SIZE}
*/
static final String DEFAULT_NUMBER_OF_DATA_DUMP_THREADS = "4";
static final int DEFAULT_NUMBER_OF_DATA_DUMP_THREADS = 4;
/**
* System property for specifying number of threads for parallel download when using {@link MultithreadedTraverseWithSortStrategy}
*/
static final String PROP_THREAD_POOL_SIZE = "oak.indexer.dataDumpThreadPoolSize";

/**
* Default value for {@link #PROP_MERGE_THREAD_POOL_SIZE}
*/
static final int DEFAULT_NUMBER_OF_MERGE_TASK_THREADS = 1;
/**
* System property for specifying number of threads for parallel merge when using {@link MultithreadedTraverseWithSortStrategy}
*/
static final String PROP_MERGE_THREAD_POOL_SIZE = "oak.indexer.mergeTaskThreadPoolSize";

/**
* Default value for {@link #PROP_MERGE_TASK_BATCH_SIZE}
*/
static final int DEFAULT_NUMBER_OF_FILES_PER_MERGE_TASK = 64;
/**
* System property for specifying number of files for batch merge task when using {@link MultithreadedTraverseWithSortStrategy}
*/
static final String PROP_MERGE_TASK_BATCH_SIZE = "oak.indexer.mergeTaskBatchSize";

/**
* Value of this system property indicates max memory that should be used if jmx based memory monitoring is not available.
*/

0 comments on commit c044634

Please sign in to comment.