Skip to content

Commit

Permalink
[Transform] Unmute TestFeatureResetIT and include more debug informat…
Browse files Browse the repository at this point in the history
…ion (#104763)
  • Loading branch information
przemekwitek committed Jan 26, 2024
1 parent bed59ba commit a12a4f1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public void cleanup() throws Exception {
}

@SuppressWarnings("unchecked")
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/100596")
public void testTransformFeatureReset() throws Exception {
String indexName = "basic-crud-reviews";
String transformId = "batch-transform-feature-reset";
Expand Down Expand Up @@ -91,7 +90,8 @@ public void testTransformFeatureReset() throws Exception {

putTransform(continuousTransformId, Strings.toString(config), RequestOptions.DEFAULT);
startTransform(continuousTransformId, RequestOptions.DEFAULT);
client().performRequest(new Request(HttpPost.METHOD_NAME, "/_features/_reset"));

assertOK(client().performRequest(new Request(HttpPost.METHOD_NAME, "/_features/_reset")));

Response response = adminClient().performRequest(new Request("GET", "/_cluster/state?metric=metadata"));
Map<String, Object> metadata = (Map<String, Object>) ESRestTestCase.entityAsMap(response).get("metadata");
Expand All @@ -118,5 +118,4 @@ public void testTransformFeatureReset() throws Exception {
Map<String, Object> transformIndices = ESRestTestCase.entityAsMap(adminClient().performRequest(new Request("GET", ".transform-*")));
assertThat("Indices were: " + transformIndices, transformIndices, is(anEmptyMap()));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*/
package org.elasticsearch.xpack.transform.notifications;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.admin.indices.template.put.TransportPutComposableIndexTemplateAction;
import org.elasticsearch.client.internal.Client;
Expand All @@ -30,6 +32,8 @@
*/
public class TransformAuditor extends AbstractAuditor<TransformAuditMessage> {

private static final Logger logger = LogManager.getLogger(TransformAuditor.class);

private volatile boolean isResetMode = false;

private final boolean includeNodeInfo;
Expand All @@ -45,12 +49,12 @@ public TransformAuditor(Client client, String nodeName, ClusterService clusterSe
ComposableIndexTemplate.builder()
.template(TransformInternalIndex.getAuditIndexTemplate())
.version((long) TransformConfigVersion.CURRENT.id())
.indexPatterns(Collections.singletonList(TransformInternalIndexConstants.AUDIT_INDEX_PREFIX + "*"))
.indexPatterns(Collections.singletonList(TransformInternalIndexConstants.AUDIT_INDEX_PATTERN))
.priority(Long.MAX_VALUE)
.build()
);
} catch (IOException e) {
throw new ElasticsearchException("Failure creating transform notification index", e);
throw new ElasticsearchException("Failure creating transform notification index template request", e);
}
},
nodeName,
Expand All @@ -59,7 +63,12 @@ public TransformAuditor(Client client, String nodeName, ClusterService clusterSe
);
clusterService.addListener(event -> {
if (event.metadataChanged()) {
isResetMode = TransformMetadata.getTransformMetadata(event.state()).isResetMode();
boolean oldIsResetMode = isResetMode;
boolean newIsResetMode = TransformMetadata.getTransformMetadata(event.state()).isResetMode();
if (oldIsResetMode != newIsResetMode) {
logger.debug("TransformAuditor has noticed change of isResetMode bit from {} to {}", oldIsResetMode, newIsResetMode);
}
isResetMode = newIsResetMode;
}
});
this.includeNodeInfo = includeNodeInfo;
Expand Down

0 comments on commit a12a4f1

Please sign in to comment.