Skip to content

Commit 8da2d81

Browse files
committed
removing junk code
1 parent 2a74f97 commit 8da2d81

File tree

1 file changed

+0
-27
lines changed

1 file changed

+0
-27
lines changed

server/src/main/java/org/elasticsearch/ingest/SamplingService.java

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,11 @@
1313
import org.elasticsearch.action.admin.indices.sampling.SamplingMetadata;
1414
import org.elasticsearch.action.index.IndexRequest;
1515
import org.elasticsearch.cluster.ClusterChangedEvent;
16-
import org.elasticsearch.cluster.ClusterState;
1716
import org.elasticsearch.cluster.ClusterStateListener;
18-
import org.elasticsearch.cluster.ClusterStateUpdateTask;
1917
import org.elasticsearch.cluster.metadata.ProjectId;
2018
import org.elasticsearch.cluster.metadata.ProjectMetadata;
2119
import org.elasticsearch.cluster.project.ProjectResolver;
2220
import org.elasticsearch.cluster.service.ClusterService;
23-
import org.elasticsearch.common.Priority;
2421
import org.elasticsearch.common.bytes.BytesReference;
2522
import org.elasticsearch.common.io.stream.StreamInput;
2623
import org.elasticsearch.common.io.stream.StreamOutput;
@@ -48,7 +45,6 @@
4845
import java.util.Map;
4946
import java.util.Objects;
5047
import java.util.concurrent.ConcurrentHashMap;
51-
import java.util.concurrent.atomic.AtomicBoolean;
5248
import java.util.concurrent.atomic.AtomicInteger;
5349
import java.util.concurrent.atomic.LongAdder;
5450
import java.util.function.LongSupplier;
@@ -62,7 +58,6 @@ public class SamplingService implements ClusterStateListener {
6258
private final ProjectResolver projectResolver;
6359
private final LongSupplier relativeMillisTimeSupplier;
6460
private final LongSupplier statsTimeSupplier = System::nanoTime;
65-
private final AtomicBoolean firstCall = new AtomicBoolean(true);
6661
/*
6762
* This Map contains the samples that exist on this node. They are not persisted to disk. They are stored as SoftReferences so that
6863
* sampling does not contribute to a node running out of memory. The idea is that access to samples is desirable, but not critical. We
@@ -245,28 +240,6 @@ public SampleStats getLocalSampleStats(ProjectId projectId, String index) {
245240

246241
public boolean atLeastOneSampleConfigured() {
247242
if (RANDOM_SAMPLING_FEATURE_FLAG) {
248-
if (firstCall.get()) {
249-
clusterService.submitUnbatchedStateUpdateTask("blocking-task", new ClusterStateUpdateTask(Priority.IMMEDIATE) {
250-
@Override
251-
public ClusterState execute(ClusterState currentState) throws Exception {
252-
ProjectMetadata.Builder projectMetadataBuilder = ProjectMetadata.builder(
253-
currentState.metadata().getProject(ProjectId.DEFAULT)
254-
);
255-
SamplingMetadata samplingMetadata = new SamplingMetadata(
256-
Map.of("test", new SamplingConfiguration(1.0d, 50, null, null, null))
257-
);
258-
projectMetadataBuilder.putCustom(SamplingMetadata.TYPE, samplingMetadata);
259-
ClusterState newState = new ClusterState.Builder(currentState).putProjectMetadata(projectMetadataBuilder).build();
260-
return newState;
261-
}
262-
263-
@Override
264-
public void onFailure(Exception e) {
265-
assert false : e.getMessage();
266-
}
267-
});
268-
firstCall.set(false);
269-
}
270243
SamplingMetadata samplingMetadata = clusterService.state()
271244
.projectState(projectResolver.getProjectId())
272245
.metadata()

0 commit comments

Comments
 (0)