Skip to content

Commit 29c406b

Browse files
committed
add back old doc values
Signed-off-by: Anthony Leong <aj.leong623@gmail.com>
1 parent e2a5574 commit 29c406b

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

server/src/main/java/org/opensearch/index/shard/IndexingStats.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ public void writeTo(StreamOutput out) throws IOException {
164164
private long maxLastIndexRequestTimestamp;
165165

166166
Stats() {
167-
docStatusStats = null;
167+
docStatusStats = new DocStatusStats();
168+
//docStatusStats = null;
168169
}
169170

170171
/**
@@ -203,7 +204,7 @@ public Stats(StreamInput in) throws IOException {
203204
} else {
204205
maxLastIndexRequestTimestamp = 0L;
205206
}
206-
if (in.getVersion().onOrAfter(Version.V_2_11_0) && in.getVersion().onOrBefore(Version.V_3_3_0)) {
207+
if (in.getVersion().onOrAfter(Version.V_2_11_0) /*&& in.getVersion().onOrBefore(Version.V_3_3_0)*/) {
207208
docStatusStats = in.readOptionalWriteable(DocStatusStats::new);
208209
} else {
209210
docStatusStats = null;
@@ -442,7 +443,7 @@ public void writeTo(StreamOutput out) throws IOException {
442443
if (out.getVersion().onOrAfter(Version.V_3_2_0)) {
443444
out.writeLong(maxLastIndexRequestTimestamp);
444445
}
445-
if (out.getVersion().onOrAfter(Version.V_2_11_0) && out.getVersion().onOrBefore(Version.V_3_3_0)) {
446+
if (out.getVersion().onOrAfter(Version.V_2_11_0)/* && out.getVersion().onOrBefore(Version.V_3_3_0)*/) {
446447
out.writeOptionalWriteable(docStatusStats);
447448
}
448449
}
@@ -542,6 +543,12 @@ public Builder isThrottled(boolean throttled) {
542543
return this;
543544
}
544545

546+
// To be removed soon
547+
public Builder docStatusStats(DocStatusStats stats) {
548+
this.docStatusStats = stats;
549+
return this;
550+
}
551+
545552
public Builder maxLastIndexRequestTimestamp(long timestamp) {
546553
this.maxLastIndexRequestTimestamp = timestamp;
547554
return this;

server/src/main/java/org/opensearch/index/shard/InternalIndexingStats.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ static class StatsHolder {
154154
private final MaxMetric maxLastIndexRequestTimestamp = new MaxMetric();
155155

156156
IndexingStats.Stats stats(boolean isThrottled, long currentThrottleMillis) {
157+
// DocStatusStats is used here
157158
return new IndexingStats.Stats.Builder().indexCount(indexMetric.count())
158159
.indexTimeInMillis(TimeUnit.NANOSECONDS.toMillis(indexMetric.sum()))
159160
.indexCurrent(indexCurrent.count())
@@ -164,6 +165,7 @@ IndexingStats.Stats stats(boolean isThrottled, long currentThrottleMillis) {
164165
.noopUpdateCount(noopUpdates.count())
165166
.isThrottled(isThrottled)
166167
.throttleTimeInMillis(TimeUnit.MILLISECONDS.toMillis(currentThrottleMillis))
168+
.docStatusStats(new IndexingStats.Stats.DocStatusStats())
167169
.maxLastIndexRequestTimestamp(maxLastIndexRequestTimestamp.get())
168170
.build();
169171
}

server/src/main/java/org/opensearch/indices/IndicesService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,7 @@ public void addDocStatusStats(final DocStatusStats stats) {
14091409
*/
14101410
@Deprecated(since = "3.4.0")
14111411
public void addDocStatusStats(final org.opensearch.index.shard.IndexingStats.Stats.DocStatusStats stats) {
1412-
1412+
oldShardsStats.indexingStats.getTotal().getDocStatusStats().add(stats);
14131413
}
14141414

14151415
/**

0 commit comments

Comments
 (0)