Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
bleskes committed Jul 13, 2018
1 parent 61adb14 commit ebd3998
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1873,7 +1873,7 @@ public IndexSearcher wrap(IndexSearcher searcher) throws EngineException {
wrapper,
new InternalEngineFactory(),
() -> {},
EMPTY_EVENT_LISTENER, false);
EMPTY_EVENT_LISTENER);

recoverShardFromStore(newShard);

Expand Down Expand Up @@ -2025,7 +2025,7 @@ public IndexSearcher wrap(IndexSearcher searcher) throws EngineException {
wrapper,
new InternalEngineFactory(),
() -> {},
EMPTY_EVENT_LISTENER, false);
EMPTY_EVENT_LISTENER);

recoverShardFromStore(newShard);

Expand Down Expand Up @@ -2508,7 +2508,7 @@ public void testReadSnapshotAndCheckIndexConcurrently() throws Exception {
.put(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey(), randomFrom("false", "true", "checksum", "fix")))
.build();
final IndexShard newShard = newShard(shardRouting, indexShard.shardPath(), indexMetaData,
null, indexShard.engineFactory, indexShard.getGlobalCheckpointSyncer(), EMPTY_EVENT_LISTENER, false);
null, indexShard.engineFactory, indexShard.getGlobalCheckpointSyncer(), EMPTY_EVENT_LISTENER);

Store.MetadataSnapshot storeFileMetaDatas = newShard.snapshotStoreMetadata();
assertTrue("at least 2 files, commit and data: " + storeFileMetaDatas.toString(), storeFileMetaDatas.size() > 1);
Expand Down Expand Up @@ -3015,7 +3015,7 @@ public void onShardInactive(IndexShard indexShard) {
markedInactive.set(true);
primaryRef.get().flush(new FlushRequest());
}
}, false);
});
primaryRef.set(primary);
recoverShardFromStore(primary);
for (int i = 0; i < 3; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void testRestoreSnapshotWithExistingFiles() throws IOException {
null,
new InternalEngineFactory(),
() -> {},
EMPTY_EVENT_LISTENER, false);
EMPTY_EVENT_LISTENER);

// restore the shard
recoverShardFromSnapshot(shard, snapshot, repository);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,7 @@ public synchronized IndexShard addReplicaWithExistingPath(final ShardPath shardP
RecoverySource.PeerRecoverySource.INSTANCE);

final IndexShard newReplica =
newShard(shardRouting, shardPath, indexMetaData, null, getEngineFactory(shardRouting), () -> {},
EMPTY_EVENT_LISTENER, false);
newShard(shardRouting, shardPath, indexMetaData, null, getEngineFactory(shardRouting), () -> {}, EMPTY_EVENT_LISTENER);
replicas.add(newReplica);
updateAllocationIDsOnPrimary();
return newReplica;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,6 @@ protected void allowShardFailures() {
failOnShardFailures.set(false);
}

/**
* re-enables default behavior to fail tests when shards created by this class fail
*/
protected void failOnShardFailures() {
failOnShardFailures.set(true);
}

public Settings threadPoolSettings() {
return Settings.EMPTY;
}
Expand Down Expand Up @@ -292,7 +285,7 @@ protected IndexShard newShard(ShardRouting routing, IndexMetaData indexMetaData,
final NodeEnvironment.NodePath nodePath = new NodeEnvironment.NodePath(createTempDir());
ShardPath shardPath = new ShardPath(false, nodePath.resolve(shardId), nodePath.resolve(shardId), shardId);
return newShard(routing, shardPath, indexMetaData, indexSearcherWrapper, engineFactory, globalCheckpointSyncer,
EMPTY_EVENT_LISTENER, false, listeners);
EMPTY_EVENT_LISTENER, listeners);
}

/**
Expand All @@ -303,15 +296,13 @@ protected IndexShard newShard(ShardRouting routing, IndexMetaData indexMetaData,
* @param indexSearcherWrapper an optional wrapper to be used during searchers
* @param globalCheckpointSyncer callback for syncing global checkpoints
* @param indexEventListener index even listener
* @param ignoreShardFailures true if shard failure should be ignored (otherwise an assertion will be thrown)
* @param listeners an optional set of listeners to add to the shard
*/
protected IndexShard newShard(ShardRouting routing, ShardPath shardPath, IndexMetaData indexMetaData,
@Nullable IndexSearcherWrapper indexSearcherWrapper,
@Nullable EngineFactory engineFactory,
Runnable globalCheckpointSyncer,
IndexEventListener indexEventListener, boolean ignoreShardFailures,
IndexingOperationListener... listeners) throws IOException {
IndexEventListener indexEventListener, IndexingOperationListener... listeners) throws IOException {
final Settings nodeSettings = Settings.builder().put("node.name", routing.currentNodeId()).build();
final IndexSettings indexSettings = new IndexSettings(indexMetaData, nodeSettings);
final IndexShard indexShard;
Expand Down Expand Up @@ -368,7 +359,7 @@ protected IndexShard reinitShard(IndexShard current, ShardRouting routing, Index
null,
current.engineFactory,
current.getGlobalCheckpointSyncer(),
EMPTY_EVENT_LISTENER, false, listeners);
EMPTY_EVENT_LISTENER, listeners);
}

/**
Expand Down

0 comments on commit ebd3998

Please sign in to comment.