|
@@ -38,6 +38,7 @@ public class SegmentsStats implements Streamable, ToXContent {
|
|
|
private long count;
|
|
|
private long memoryInBytes;
|
|
|
private long indexWriterMemoryInBytes;
|
|
|
+ private long indexWriterMaxMemoryInBytes;
|
|
|
private long versionMapMemoryInBytes;
|
|
|
|
|
|
public SegmentsStats() {
|
|
@@ -53,6 +54,10 @@ public class SegmentsStats implements Streamable, ToXContent {
|
|
|
this.indexWriterMemoryInBytes += indexWriterMemoryInBytes;
|
|
|
}
|
|
|
|
|
|
+ public void addIndexWriterMaxMemoryInBytes(long indexWriterMaxMemoryInBytes) {
|
|
|
+ this.indexWriterMaxMemoryInBytes += indexWriterMaxMemoryInBytes;
|
|
|
+ }
|
|
|
+
|
|
|
public void addVersionMapMemoryInBytes(long versionMapMemoryInBytes) {
|
|
|
this.versionMapMemoryInBytes += versionMapMemoryInBytes;
|
|
|
}
|
|
@@ -63,6 +68,7 @@ public class SegmentsStats implements Streamable, ToXContent {
|
|
|
}
|
|
|
add(mergeStats.count, mergeStats.memoryInBytes);
|
|
|
addIndexWriterMemoryInBytes(mergeStats.indexWriterMemoryInBytes);
|
|
|
+ addIndexWriterMaxMemoryInBytes(mergeStats.indexWriterMaxMemoryInBytes);
|
|
|
addVersionMapMemoryInBytes(mergeStats.versionMapMemoryInBytes);
|
|
|
}
|
|
|
|
|
@@ -95,6 +101,17 @@ public class SegmentsStats implements Streamable, ToXContent {
|
|
|
return new ByteSizeValue(indexWriterMemoryInBytes);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Maximum memory index writer may use before it must write buffered documents to a new segment.
|
|
|
+ */
|
|
|
+ public long getIndexWriterMaxMemoryInBytes() {
|
|
|
+ return this.indexWriterMaxMemoryInBytes;
|
|
|
+ }
|
|
|
+
|
|
|
+ public ByteSizeValue getIndexWriterMaxMemory() {
|
|
|
+ return new ByteSizeValue(indexWriterMaxMemoryInBytes);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Estimation of the memory usage by version map
|
|
|
*/
|
|
@@ -118,6 +135,7 @@ public class SegmentsStats implements Streamable, ToXContent {
|
|
|
builder.field(Fields.COUNT, count);
|
|
|
builder.byteSizeField(Fields.MEMORY_IN_BYTES, Fields.MEMORY, memoryInBytes);
|
|
|
builder.byteSizeField(Fields.INDEX_WRITER_MEMORY_IN_BYTES, Fields.INDEX_WRITER_MEMORY, indexWriterMemoryInBytes);
|
|
|
+ builder.byteSizeField(Fields.INDEX_WRITER_MAX_MEMORY_IN_BYTES, Fields.INDEX_WRITER_MAX_MEMORY, indexWriterMaxMemoryInBytes);
|
|
|
builder.byteSizeField(Fields.VERSION_MAP_MEMORY_IN_BYTES, Fields.VERSION_MAP_MEMORY, versionMapMemoryInBytes);
|
|
|
builder.endObject();
|
|
|
return builder;
|
|
@@ -130,6 +148,8 @@ public class SegmentsStats implements Streamable, ToXContent {
|
|
|
static final XContentBuilderString MEMORY_IN_BYTES = new XContentBuilderString("memory_in_bytes");
|
|
|
static final XContentBuilderString INDEX_WRITER_MEMORY = new XContentBuilderString("index_writer_memory");
|
|
|
static final XContentBuilderString INDEX_WRITER_MEMORY_IN_BYTES = new XContentBuilderString("index_writer_memory_in_bytes");
|
|
|
+ static final XContentBuilderString INDEX_WRITER_MAX_MEMORY = new XContentBuilderString("index_writer_max_memory");
|
|
|
+ static final XContentBuilderString INDEX_WRITER_MAX_MEMORY_IN_BYTES = new XContentBuilderString("index_writer_max_memory_in_bytes");
|
|
|
static final XContentBuilderString VERSION_MAP_MEMORY = new XContentBuilderString("version_map_memory");
|
|
|
static final XContentBuilderString VERSION_MAP_MEMORY_IN_BYTES = new XContentBuilderString("version_map_memory_in_bytes");
|
|
|
}
|
|
@@ -142,6 +162,9 @@ public class SegmentsStats implements Streamable, ToXContent {
|
|
|
indexWriterMemoryInBytes = in.readLong();
|
|
|
versionMapMemoryInBytes = in.readLong();
|
|
|
}
|
|
|
+ if (in.getVersion().onOrAfter(Version.V_1_4_0)) {
|
|
|
+ indexWriterMaxMemoryInBytes = in.readLong();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -152,5 +175,8 @@ public class SegmentsStats implements Streamable, ToXContent {
|
|
|
out.writeLong(indexWriterMemoryInBytes);
|
|
|
out.writeLong(versionMapMemoryInBytes);
|
|
|
}
|
|
|
+ if (out.getVersion().onOrAfter(Version.V_1_4_0)) {
|
|
|
+ out.writeLong(indexWriterMaxMemoryInBytes);
|
|
|
+ }
|
|
|
}
|
|
|
-}
|
|
|
+}
|