Package org.elasticsearch.index.gateway

Examples of org.elasticsearch.index.gateway.IndexShardGatewayService$RecoveryListener


    @Override protected ShardGatewaySnapshotResponse newShardResponse() {
        return new ShardGatewaySnapshotResponse();
    }

    @Override protected ShardGatewaySnapshotResponse shardOperation(ShardGatewaySnapshotRequest request) throws ElasticSearchException {
        IndexShardGatewayService shardGatewayService = indicesService.indexServiceSafe(request.index())
                .shardInjectorSafe(request.shardId()).getInstance(IndexShardGatewayService.class);
        shardGatewayService.snapshot("api");
        return new ShardGatewaySnapshotResponse(request.index(), request.shardId());
    }
View Full Code Here


        } else {
            if (shardRouting.relocatingNodeId() == null) {
                // we are the first primary, recover from the gateway
                // if its post api allocation, the index should exists
                boolean indexShouldExists = indexShardRouting.allocatedPostApi();
                IndexShardGatewayService shardGatewayService = indexService.shardInjector(shardId).getInstance(IndexShardGatewayService.class);
                shardGatewayService.recover(indexShouldExists, new IndexShardGatewayService.RecoveryListener() {
                    @Override public void onRecoveryDone() {
                        shardStateAction.shardStarted(shardRouting, "after recovery from gateway");
                    }

                    @Override public void onIgnoreRecovery(String reason) {
View Full Code Here

                shardStatus.peerRecoveryStatus = new PeerRecoveryStatus(stage, peerRecoveryStatus.startTime(), peerRecoveryStatus.time(),
                        peerRecoveryStatus.phase1TotalSize(), peerRecoveryStatus.phase1ExistingTotalSize(),
                        peerRecoveryStatus.currentFilesSize(), peerRecoveryStatus.currentTranslogOperations());
            }

            IndexShardGatewayService gatewayService = indexService.shardInjector(request.shardId()).getInstance(IndexShardGatewayService.class);
            org.elasticsearch.index.gateway.RecoveryStatus gatewayRecoveryStatus = gatewayService.recoveryStatus();
            if (gatewayRecoveryStatus != null) {
                GatewayRecoveryStatus.Stage stage;
                switch (gatewayRecoveryStatus.stage()) {
                    case INIT:
                        stage = GatewayRecoveryStatus.Stage.INIT;
                        break;
                    case INDEX:
                        stage = GatewayRecoveryStatus.Stage.INDEX;
                        break;
                    case TRANSLOG:
                        stage = GatewayRecoveryStatus.Stage.TRANSLOG;
                        break;
                    case DONE:
                        stage = GatewayRecoveryStatus.Stage.DONE;
                        break;
                    default:
                        stage = GatewayRecoveryStatus.Stage.INIT;
                }
                shardStatus.gatewayRecoveryStatus = new GatewayRecoveryStatus(stage, gatewayRecoveryStatus.startTime(), gatewayRecoveryStatus.time(),
                        gatewayRecoveryStatus.index().totalSize(), gatewayRecoveryStatus.index().reusedTotalSize(), gatewayRecoveryStatus.index().currentFilesSize(), gatewayRecoveryStatus.translog().currentTranslogOperations());
            }
        }

        if (request.snapshot) {
            IndexShardGatewayService gatewayService = indexService.shardInjector(request.shardId()).getInstance(IndexShardGatewayService.class);
            SnapshotStatus snapshotStatus = gatewayService.snapshotStatus();
            if (snapshotStatus != null) {
                GatewaySnapshotStatus.Stage stage;
                switch (snapshotStatus.stage()) {
                    case DONE:
                        stage = GatewaySnapshotStatus.Stage.DONE;
View Full Code Here

            }
        } else {
            // we are the first primary, recover from the gateway
            // if its post api allocation, the index should exists
            boolean indexShouldExists = indexShardRouting.primaryAllocatedPostApi();
            IndexShardGatewayService shardGatewayService = indexService.shardInjectorSafe(shardId).getInstance(IndexShardGatewayService.class);
            shardGatewayService.recover(indexShouldExists, new IndexShardGatewayService.RecoveryListener() {
                @Override
                public void onRecoveryDone() {
                    shardStateAction.shardStarted(shardRouting, indexMetaData.getUUID(), "after recovery from gateway");
                }
View Full Code Here

        if (state == null) {
            state = recoveryTarget.recoveryState(indexShard);
        }

        if (state == null) {
            IndexShardGatewayService gatewayService =
                    indexService.shardInjector(request.shardId().id()).getInstance(IndexShardGatewayService.class);
            state = gatewayService.recoveryState();
        }

        shardRecoveryResponse.recoveryState(state);
        return shardRecoveryResponse;
    }
View Full Code Here

TOP

Related Classes of org.elasticsearch.index.gateway.IndexShardGatewayService$RecoveryListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.