SnapshotShardsService depends on the RepositoriesService not the SnapshotsService, no need to have this indirection.
This commit is contained in:
parent
6aaee8aa0a
commit
790765d3f9
|
@ -495,8 +495,9 @@ public class Node implements Closeable {
|
|||
RepositoriesService repositoryService = repositoriesModule.getRepositoryService();
|
||||
SnapshotsService snapshotsService = new SnapshotsService(settings, clusterService,
|
||||
clusterModule.getIndexNameExpressionResolver(), repositoryService, threadPool);
|
||||
SnapshotShardsService snapshotShardsService = new SnapshotShardsService(settings, clusterService, snapshotsService, threadPool,
|
||||
transportService, indicesService, actionModule.getActionFilters(), clusterModule.getIndexNameExpressionResolver());
|
||||
SnapshotShardsService snapshotShardsService = new SnapshotShardsService(settings, clusterService, repositoryService,
|
||||
threadPool, transportService, indicesService, actionModule.getActionFilters(),
|
||||
clusterModule.getIndexNameExpressionResolver());
|
||||
TransportNodesSnapshotsStatus nodesSnapshotsStatus = new TransportNodesSnapshotsStatus(threadPool, clusterService,
|
||||
transportService, snapshotShardsService, actionModule.getActionFilters());
|
||||
RestoreService restoreService = new RestoreService(clusterService, repositoryService, clusterModule.getAllocationService(),
|
||||
|
|
|
@ -65,6 +65,7 @@ import org.elasticsearch.index.snapshots.IndexShardSnapshotStatus;
|
|||
import org.elasticsearch.index.snapshots.IndexShardSnapshotStatus.Stage;
|
||||
import org.elasticsearch.indices.IndicesService;
|
||||
import org.elasticsearch.repositories.IndexId;
|
||||
import org.elasticsearch.repositories.RepositoriesService;
|
||||
import org.elasticsearch.repositories.Repository;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TransportException;
|
||||
|
@ -99,7 +100,7 @@ public class SnapshotShardsService extends AbstractLifecycleComponent implements
|
|||
|
||||
private final IndicesService indicesService;
|
||||
|
||||
private final SnapshotsService snapshotsService;
|
||||
private final RepositoriesService repositoriesService;
|
||||
|
||||
private final TransportService transportService;
|
||||
|
||||
|
@ -114,11 +115,11 @@ public class SnapshotShardsService extends AbstractLifecycleComponent implements
|
|||
private final SnapshotStateExecutor snapshotStateExecutor = new SnapshotStateExecutor();
|
||||
private final UpdateSnapshotStatusAction updateSnapshotStatusHandler;
|
||||
|
||||
public SnapshotShardsService(Settings settings, ClusterService clusterService, SnapshotsService snapshotsService,
|
||||
public SnapshotShardsService(Settings settings, ClusterService clusterService, RepositoriesService repositoriesService,
|
||||
ThreadPool threadPool, TransportService transportService, IndicesService indicesService,
|
||||
ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
|
||||
this.indicesService = indicesService;
|
||||
this.snapshotsService = snapshotsService;
|
||||
this.repositoriesService = repositoriesService;
|
||||
this.transportService = transportService;
|
||||
this.clusterService = clusterService;
|
||||
this.threadPool = threadPool;
|
||||
|
@ -361,7 +362,7 @@ public class SnapshotShardsService extends AbstractLifecycleComponent implements
|
|||
throw new IndexShardSnapshotFailedException(shardId, "shard didn't fully recover yet");
|
||||
}
|
||||
|
||||
final Repository repository = snapshotsService.getRepositoriesService().repository(snapshot.getRepository());
|
||||
final Repository repository = repositoriesService.repository(snapshot.getRepository());
|
||||
try {
|
||||
// we flush first to make sure we get the latest writes snapshotted
|
||||
try (Engine.IndexCommitRef snapshotRef = indexShard.acquireLastIndexCommit(true)) {
|
||||
|
|
|
@ -1468,8 +1468,4 @@ public class SnapshotsService extends AbstractLifecycleComponent implements Clus
|
|||
protected void doClose() {
|
||||
clusterService.removeApplier(this);
|
||||
}
|
||||
|
||||
public RepositoriesService getRepositoriesService() {
|
||||
return repositoriesService;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -903,7 +903,7 @@ public class SnapshotResiliencyTests extends ESTestCase {
|
|||
final RecoverySettings recoverySettings = new RecoverySettings(settings, clusterSettings);
|
||||
final ActionFilters actionFilters = new ActionFilters(emptySet());
|
||||
snapshotShardsService = new SnapshotShardsService(
|
||||
settings, clusterService, snapshotsService, threadPool,
|
||||
settings, clusterService, repositoriesService, threadPool,
|
||||
transportService, indicesService, actionFilters, indexNameExpressionResolver);
|
||||
final ShardStateAction shardStateAction = new ShardStateAction(
|
||||
clusterService, transportService, allocationService,
|
||||
|
|
Loading…
Reference in New Issue