Bläddra i källkod

[Transform] Unmute TestFeatureResetIT and include more debug information (#104763)

Przemysław Witek 1 år sedan
förälder
incheckning
a12a4f1b0b

+ 2 - 3
x-pack/plugin/transform/qa/multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/transform/integration/TestFeatureResetIT.java

@@ -58,7 +58,6 @@ public class TestFeatureResetIT extends TransformRestTestCase {
     }
 
     @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";
@@ -91,7 +90,8 @@ public class TestFeatureResetIT extends TransformRestTestCase {
 
         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");
@@ -118,5 +118,4 @@ public class TestFeatureResetIT extends TransformRestTestCase {
         Map<String, Object> transformIndices = ESRestTestCase.entityAsMap(adminClient().performRequest(new Request("GET", ".transform-*")));
         assertThat("Indices were: " + transformIndices, transformIndices, is(anEmptyMap()));
     }
-
 }

+ 12 - 3
x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/notifications/TransformAuditor.java

@@ -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;
@@ -30,6 +32,8 @@ import static org.elasticsearch.xpack.core.ClientHelper.TRANSFORM_ORIGIN;
  */
 public class TransformAuditor extends AbstractAuditor<TransformAuditMessage> {
 
+    private static final Logger logger = LogManager.getLogger(TransformAuditor.class);
+
     private volatile boolean isResetMode = false;
 
     private final boolean includeNodeInfo;
@@ -45,12 +49,12 @@ public class TransformAuditor extends AbstractAuditor<TransformAuditMessage> {
                         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,
@@ -59,7 +63,12 @@ public class TransformAuditor extends AbstractAuditor<TransformAuditMessage> {
         );
         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;