long maxUnsafeAutoIdTimestamp() { return Long.parseLong(shard.getEngine().commitStats().getUserData().get(Engine.MAX_UNSAFE_AUTO_ID_TIMESTAMP_COMMIT_ID)); }
/** get commits stats for the last commit */ public final CommitStats commitStats() { return new CommitStats(getLastCommittedSegmentInfos()); }
@Override public void readFrom(StreamInput in) throws IOException { shardRouting = new ShardRouting(in); commonStats = new CommonStats(in); commitStats = CommitStats.readOptionalCommitStatsFrom(in); statePath = in.readString(); dataPath = in.readString(); isCustomDataPath = in.readBoolean(); if (in.getVersion().onOrAfter(Version.V_6_0_0_alpha1)) { seqNoStats = in.readOptionalWriteable(SeqNoStats::new); } }
private PreSyncedFlushResponse performPreSyncedFlush(PreShardSyncedFlushRequest request) { IndexShard indexShard = indicesService.indexServiceSafe(request.shardId().getIndex()).getShard(request.shardId().id()); FlushRequest flushRequest = new FlushRequest().force(false).waitIfOngoing(true); logger.trace("{} performing pre sync flush", request.shardId()); indexShard.flush(flushRequest); final CommitStats commitStats = indexShard.commitStats(); final Engine.CommitId commitId = commitStats.getRawCommitId(); logger.trace("{} pre sync flush done. commit id {}, num docs {}", request.shardId(), commitId, commitStats.getNumDocs()); return new PreSyncedFlushResponse(commitId, commitStats.getNumDocs(), commitStats.syncId()); }
public static CommitStats readCommitStatsFrom(StreamInput in) throws IOException { CommitStats commitStats = new CommitStats(); commitStats.readFrom(in); return commitStats; }
private void assertSameSyncIdSameDocs() { Map<String, Long> docsOnShards = new HashMap<>(); final Collection<NodeAndClient> nodesAndClients = nodes.values(); for (NodeAndClient nodeAndClient : nodesAndClients) { IndicesService indexServices = getInstance(IndicesService.class, nodeAndClient.name); for (IndexService indexService : indexServices) { for (IndexShard indexShard : indexService) { CommitStats commitStats = indexShard.commitStats(); if (commitStats != null) { // null if the engine is closed or if the shard is recovering String syncId = commitStats.getUserData().get(Engine.SYNC_COMMIT_ID); if (syncId != null) { long liveDocsOnShard = commitStats.getNumDocs(); if (docsOnShards.get(syncId) != null) { assertThat("sync id is equal but number of docs does not match on node " + nodeAndClient.name + ". expected " + docsOnShards.get(syncId) + " but got " + liveDocsOnShard, docsOnShards.get(syncId), equalTo(liveDocsOnShard)); } else { docsOnShards.put(syncId, liveDocsOnShard); } } } } } } }
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(Fields.ROUTING) .field(Fields.STATE, shardRouting.state()) .field(Fields.PRIMARY, shardRouting.primary()) .field(Fields.NODE, shardRouting.currentNodeId()) .field(Fields.RELOCATING_NODE, shardRouting.relocatingNodeId()) .endObject(); commonStats.toXContent(builder, params); if (commitStats != null) { commitStats.toXContent(builder, params); } if (seqNoStats != null) { seqNoStats.toXContent(builder, params); } builder.startObject(Fields.SHARD_PATH); builder.field(Fields.STATE_PATH, statePath); builder.field(Fields.DATA_PATH, dataPath); builder.field(Fields.IS_CUSTOM_DATA_PATH, isCustomDataPath); builder.endObject(); return builder; }
private PreSyncedFlushResponse performPreSyncedFlush(PreShardSyncedFlushRequest request) { IndexShard indexShard = indicesService.indexServiceSafe(request.shardId().getIndex()).getShard(request.shardId().id()); FlushRequest flushRequest = new FlushRequest().force(false).waitIfOngoing(true); logger.trace("{} performing pre sync flush", request.shardId()); indexShard.flush(flushRequest); final CommitStats commitStats = indexShard.commitStats(); final Engine.CommitId commitId = commitStats.getRawCommitId(); logger.trace("{} pre sync flush done. commit id {}, num docs {}", request.shardId(), commitId, commitStats.getNumDocs()); return new PreSyncedFlushResponse(commitId, commitStats.getNumDocs(), commitStats.syncId()); }
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(Fields.ROUTING) .field(Fields.STATE, shardRouting.state()) .field(Fields.PRIMARY, shardRouting.primary()) .field(Fields.NODE, shardRouting.currentNodeId()) .field(Fields.RELOCATING_NODE, shardRouting.relocatingNodeId()) .endObject(); commonStats.toXContent(builder, params); if (commitStats != null) { commitStats.toXContent(builder, params); } builder.startObject(Fields.SHARD_PATH); builder.field(Fields.STATE_PATH, statePath); builder.field(Fields.DATA_PATH, dataPath); builder.field(Fields.IS_CUSTOM_DATA_PATH, isCustomDataPath); builder.endObject(); return builder; }
long maxUnsafeAutoIdTimestamp() { return Long.parseLong(shard.getEngine().commitStats().getUserData().get(InternalEngine.MAX_UNSAFE_AUTO_ID_TIMESTAMP_COMMIT_ID)); }
private PreSyncedFlushResponse performPreSyncedFlush(PreShardSyncedFlushRequest request) { IndexShard indexShard = indicesService.indexServiceSafe(request.shardId().getIndex()).getShard(request.shardId().id()); FlushRequest flushRequest = new FlushRequest().force(false).waitIfOngoing(true); logger.trace("{} performing pre sync flush", request.shardId()); indexShard.flush(flushRequest); final CommitStats commitStats = indexShard.commitStats(); final Engine.CommitId commitId = commitStats.getRawCommitId(); logger.trace("{} pre sync flush done. commit id {}, num docs {}", request.shardId(), commitId, commitStats.getNumDocs()); return new PreSyncedFlushResponse(commitId, commitStats.getNumDocs(), commitStats.syncId()); }
/** get commits stats for the last commit */ public final CommitStats commitStats() { return new CommitStats(getLastCommittedSegmentInfos()); }
@Override public void readFrom(StreamInput in) throws IOException { shardRouting = new ShardRouting(in); commonStats = new CommonStats(in); commitStats = CommitStats.readOptionalCommitStatsFrom(in); statePath = in.readString(); dataPath = in.readString(); isCustomDataPath = in.readBoolean(); }
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(Fields.ROUTING) .field(Fields.STATE, shardRouting.state()) .field(Fields.PRIMARY, shardRouting.primary()) .field(Fields.NODE, shardRouting.currentNodeId()) .field(Fields.RELOCATING_NODE, shardRouting.relocatingNodeId()) .endObject(); commonStats.toXContent(builder, params); if (commitStats != null) { commitStats.toXContent(builder, params); } builder.startObject(Fields.SHARD_PATH); builder.field(Fields.STATE_PATH, statePath); builder.field(Fields.DATA_PATH, dataPath); builder.field(Fields.IS_CUSTOM_DATA_PATH, isCustomDataPath); builder.endObject(); return builder; }
long maxUnsafeAutoIdTimestamp() { return Long.parseLong(shard.getEngine().commitStats().getUserData().get(Engine.MAX_UNSAFE_AUTO_ID_TIMESTAMP_COMMIT_ID)); }
/** get commits stats for the last commit */ public CommitStats commitStats() { return new CommitStats(getLastCommittedSegmentInfos()); }
@Override public void readFrom(StreamInput in) throws IOException { shardRouting = readShardRoutingEntry(in); commonStats = CommonStats.readCommonStats(in); commitStats = CommitStats.readOptionalCommitStatsFrom(in); statePath = in.readString(); dataPath = in.readString(); isCustomDataPath = in.readBoolean(); }
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(Fields.ROUTING) .field(Fields.STATE, shardRouting.state()) .field(Fields.PRIMARY, shardRouting.primary()) .field(Fields.NODE, shardRouting.currentNodeId()) .field(Fields.RELOCATING_NODE, shardRouting.relocatingNodeId()) .endObject(); commonStats.toXContent(builder, params); if (commitStats != null) { commitStats.toXContent(builder, params); } if (seqNoStats != null) { seqNoStats.toXContent(builder, params); } builder.startObject(Fields.SHARD_PATH); builder.field(Fields.STATE_PATH, statePath); builder.field(Fields.DATA_PATH, dataPath); builder.field(Fields.IS_CUSTOM_DATA_PATH, isCustomDataPath); builder.endObject(); return builder; }
table.addCell(commitStats == null ? null : commitStats.getUserData().get(Engine.SYNC_COMMIT_ID));
/** get commits stats for the last commit */ public CommitStats commitStats() { return new CommitStats(getLastCommittedSegmentInfos()); }