Skip to content

Commit 9486be5

Browse files
threadcontext changes
Signed-off-by: Bharathwaj G <[email protected]>
1 parent e920b1f commit 9486be5

File tree

11 files changed

+21
-5
lines changed

11 files changed

+21
-5
lines changed

server/src/main/java/org/opensearch/index/codec/PerFieldMappingPostingFormatCodec.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import org.apache.lucene.codecs.DocValuesFormat;
3838
import org.apache.lucene.codecs.PostingsFormat;
3939
import org.apache.lucene.codecs.lucene90.Lucene90DocValuesFormat;
40+
//import org.apache.lucene.codecs.
4041
import org.apache.lucene.codecs.lucene95.Lucene95Codec;
4142
import org.opensearch.common.lucene.Lucene;
4243
import org.opensearch.index.mapper.CompletionFieldMapper;

server/src/main/java/org/opensearch/index/engine/InternalEngine.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,6 +1754,7 @@ public boolean maybeRefresh(String source) throws EngineException {
17541754
final boolean refresh(String source, SearcherScope scope, boolean block) throws EngineException {
17551755
// both refresh types will result in an internal refresh but only the external will also
17561756
// pass the new reader reference to the external reader manager.
1757+
System.out.println("======= REFRESH called =====");
17571758
final long localCheckpointBeforeRefresh = localCheckpointTracker.getProcessedCheckpoint();
17581759
boolean refreshed;
17591760
try {
@@ -1852,6 +1853,8 @@ public void flush(boolean force, boolean waitIfOngoing) throws EngineException {
18521853
// or (4) the local checkpoint information in the last commit is stale, which slows down future recoveries.
18531854
boolean hasUncommittedChanges = indexWriter.hasUncommittedChanges();
18541855
boolean shouldPeriodicallyFlush = shouldPeriodicallyFlush();
1856+
System.out.println("HAS UNCOMMITED CHANGES : " + hasUncommittedChanges);
1857+
System.out.println("shouldPeriodicallyFlush : " + shouldPeriodicallyFlush);
18551858
if (hasUncommittedChanges
18561859
|| force
18571860
|| shouldPeriodicallyFlush
@@ -2525,6 +2528,7 @@ protected void commitIndexWriter(final IndexWriter writer, final String translog
25252528
if (currentForceMergeUUID != null) {
25262529
commitData.put(FORCE_MERGE_UUID_KEY, currentForceMergeUUID);
25272530
}
2531+
System.out.println("committing writer with commit data [{}]" + commitData);
25282532
logger.trace("committing writer with commit data [{}]", commitData);
25292533
return commitData.entrySet().iterator();
25302534
});
@@ -2796,6 +2800,7 @@ public final long currentOngoingRefreshCheckpoint() {
27962800
* Refresh this engine **internally** iff the requesting seq_no is greater than the last refreshed checkpoint.
27972801
*/
27982802
protected final void refreshIfNeeded(String source, long requestingSeqNo) {
2803+
System.out.println("======= REFRESH If Needed called =====");
27992804
if (lastRefreshedCheckpoint() < requestingSeqNo) {
28002805
synchronized (refreshIfNeededMutex) {
28012806
if (lastRefreshedCheckpoint() < requestingSeqNo) {

server/src/main/java/org/opensearch/index/mapper/BinaryFieldMapper.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
import java.util.List;
6161
import java.util.Map;
6262
import java.util.function.Supplier;
63-
6463
/**
6564
* A mapper for binary fields
6665
*

server/src/main/java/org/opensearch/node/resource/tracker/ResourceTrackerSettings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ private static class Defaults {
2525
/**
2626
* This is the default window duration on which the average resource utilization values will be calculated
2727
*/
28-
private static final long WINDOW_DURATION_IN_SECONDS = 30;
28+
private static final long WINDOW_DURATION_IN_SECONDS = 1;
2929
}
3030

3131
public static final Setting<TimeValue> GLOBAL_CPU_USAGE_AC_POLLING_INTERVAL_SETTING = Setting.positiveTimeSetting(

server/src/main/java/org/opensearch/search/aggregations/bucket/filter/FiltersAggregator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ public LeafBucketCollector getLeafCollector(LeafReaderContext ctx, final LeafBuc
180180
return new LeafBucketCollectorBase(sub, null) {
181181
@Override
182182
public void collect(int doc, long bucket) throws IOException {
183+
System.out.println("doc id : " + doc);
183184
boolean matched = false;
184185
for (int i = 0; i < bits.length; i++) {
185186
if (bits[i].get(doc)) {

server/src/main/java/org/opensearch/search/aggregations/metrics/SumAggregator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ public LeafBucketCollector getLeafCollector(LeafReaderContext ctx, final LeafBuc
9595
return new LeafBucketCollectorBase(sub, values) {
9696
@Override
9797
public void collect(int doc, long bucket) throws IOException {
98+
System.out.println("Doc id " + doc);
9899
sums = bigArrays.grow(sums, bucket + 1);
99100
compensations = bigArrays.grow(compensations, bucket + 1);
100101

server/src/main/java/org/opensearch/transport/Header.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,10 @@ Tuple<Map<String, String>, Map<String, Set<String>>> getHeaders() {
123123

124124
void finishParsingHeader(StreamInput input) throws IOException {
125125
this.headers = ThreadContext.readHeadersFromStream(input);
126-
126+
//if(this.headers)
127+
//System.out.println("HEADER");
127128
if (isRequest()) {
129+
//System.out.println("Request");
128130
final String[] featuresFound = input.readStringArray();
129131
if (featuresFound.length == 0) {
130132
features = Collections.emptySet();
@@ -133,6 +135,7 @@ void finishParsingHeader(StreamInput input) throws IOException {
133135
}
134136
this.actionName = input.readString();
135137
} else {
138+
//System.out.println("Response");
136139
this.actionName = RESPONSE_NAME;
137140
}
138141
}

server/src/main/java/org/opensearch/transport/InboundHandler.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ private void messageReceived(TcpChannel channel, InboundMessage message, long st
139139
if (header.isRequest()) {
140140
handleRequest(channel, header, message);
141141
} else {
142+
// THIS IS RESPONSE
143+
// Responses do not support short circuiting currently
142144
// Responses do not support short circuiting currently
143145
assert message.isShortCircuit() == false;
144146
final TransportResponseHandler<?> handler;

server/src/test/java/org/opensearch/index/IndexModuleTests.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
import org.opensearch.indices.mapper.MapperRegistry;
108108
import org.opensearch.indices.recovery.DefaultRecoverySettings;
109109
import org.opensearch.indices.recovery.RecoveryState;
110+
import org.opensearch.node.ResourceUsageCollectorService;
110111
import org.opensearch.plugins.IndexStorePlugin;
111112
import org.opensearch.repositories.RepositoriesService;
112113
import org.opensearch.script.ScriptService;
@@ -207,7 +208,8 @@ public void setUp() throws Exception {
207208
boundAddress -> DiscoveryNode.createLocal(settings, boundAddress.publishAddress(), UUIDs.randomBase64UUID()),
208209
null,
209210
Collections.emptySet(),
210-
NoopTracer.INSTANCE
211+
NoopTracer.INSTANCE,
212+
mock(ResourceUsageCollectorService.class)
211213
);
212214
repositoriesService = new RepositoriesService(
213215
settings,

server/src/test/java/org/opensearch/index/search/nested/NestedSortingTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
package org.opensearch.index.search.nested;
3434

3535
import org.apache.lucene.document.Document;
36+
import org.apache.lucene.document.DoublePoint;
3637
import org.apache.lucene.document.Field;
3738
import org.apache.lucene.document.IntPoint;
3839
import org.apache.lucene.document.NumericDocValuesField;
@@ -195,6 +196,7 @@ public void testNestedSorting() throws Exception {
195196
document = new Document();
196197
document.add(new StringField(NestedPathFieldMapper.NAME, "parent", Field.Store.NO));
197198
document.add(new StringField("field1", "b", Field.Store.NO));
199+
//document.add(new AggregationPoint("minute=40,hour=12,day=30", 30, 40, 50));
198200
docs.add(document);
199201
writer.addDocuments(docs);
200202

0 commit comments

Comments
 (0)