You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/03/03 02:41:42 UTC

[GitHub] [flink] PatrickRen opened a new pull request #18965: [FLINK-26387][connector/kafka] Use individual multi-broker cluster in broker failure tests

PatrickRen opened a new pull request #18965:
URL: https://github.com/apache/flink/pull/18965


   ## What is the purpose of the change
   
   This pull request fixes a flaky broker failure test that should use multi-broker cluster for replicating partitions during the test run. 
   
   
   ## Brief change log
   
   - Use individual multi-broker cluster in broker failure tests
   - Re-enable ignored tests
   
   
   ## Verifying this change
   
   This change is already covered by existing broker failure tests.
   
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (yes / **no**)
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (yes / **no**)
     - The serializers: (yes / **no** / don't know)
     - The runtime per-record code paths (performance sensitive): (yes / **no** / don't know)
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (yes / **no** / don't know)
     - The S3 file system connector: (yes / **no** / don't know)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (yes / **no**)
     - If yes, how is the feature documented? (**not applicable** / docs / JavaDocs / not documented)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot commented on pull request #18965: [FLINK-26387][connector/kafka] Use individual multi-broker cluster in broker failure tests

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #18965:
URL: https://github.com/apache/flink/pull/18965#issuecomment-1057611030


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "868aa2c455dd900823290ba207edf2ef81c7d2d5",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "868aa2c455dd900823290ba207edf2ef81c7d2d5",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 868aa2c455dd900823290ba207edf2ef81c7d2d5 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #18965: [FLINK-26387][connector/kafka] Use individual multi-broker cluster in broker failure tests

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #18965:
URL: https://github.com/apache/flink/pull/18965#issuecomment-1057611030


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "868aa2c455dd900823290ba207edf2ef81c7d2d5",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32464",
       "triggerID" : "868aa2c455dd900823290ba207edf2ef81c7d2d5",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8926624d81a884d9c4decd9948e90e8829a4228f",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32468",
       "triggerID" : "8926624d81a884d9c4decd9948e90e8829a4228f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 8926624d81a884d9c4decd9948e90e8829a4228f Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32468) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #18965: [FLINK-26387][connector/kafka] Use individual multi-broker cluster in broker failure tests

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #18965:
URL: https://github.com/apache/flink/pull/18965#issuecomment-1057611030


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "868aa2c455dd900823290ba207edf2ef81c7d2d5",
       "status" : "CANCELED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32464",
       "triggerID" : "868aa2c455dd900823290ba207edf2ef81c7d2d5",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8926624d81a884d9c4decd9948e90e8829a4228f",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32468",
       "triggerID" : "8926624d81a884d9c4decd9948e90e8829a4228f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 868aa2c455dd900823290ba207edf2ef81c7d2d5 Azure: [CANCELED](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32464) 
   * 8926624d81a884d9c4decd9948e90e8829a4228f Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32468) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #18965: [FLINK-26387][connector/kafka] Use individual multi-broker cluster in broker failure tests

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #18965:
URL: https://github.com/apache/flink/pull/18965#issuecomment-1057611030


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "868aa2c455dd900823290ba207edf2ef81c7d2d5",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32464",
       "triggerID" : "868aa2c455dd900823290ba207edf2ef81c7d2d5",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8926624d81a884d9c4decd9948e90e8829a4228f",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "8926624d81a884d9c4decd9948e90e8829a4228f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 868aa2c455dd900823290ba207edf2ef81c7d2d5 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32464) 
   * 8926624d81a884d9c4decd9948e90e8829a4228f UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] PatrickRen commented on a change in pull request #18965: [FLINK-26387][connector/kafka] Use individual multi-broker cluster in broker failure tests

Posted by GitBox <gi...@apache.org>.
PatrickRen commented on a change in pull request #18965:
URL: https://github.com/apache/flink/pull/18965#discussion_r818310017



##########
File path: flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/streaming/connectors/kafka/KafkaTestEnvironmentImpl.java
##########
@@ -496,17 +494,4 @@ private void unpause(int brokerId) throws Exception {
         pausedBroker.remove(brokerId);
         LOG.info("Broker {} is resumed", brokerId);
     }
-
-    private KafkaConsumer<Void, Void> createTempConsumer() {
-        Properties consumerProps = new Properties();
-        consumerProps.putAll(getStandardProperties());
-        consumerProps.setProperty(
-                ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG,
-                VoidDeserializer.class.getCanonicalName());
-        consumerProps.setProperty(
-                ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG,
-                VoidDeserializer.class.getCanonicalName());
-        consumerProps.setProperty(ConsumerConfig.ALLOW_AUTO_CREATE_TOPICS_CONFIG, "false");
-        return new KafkaConsumer<>(consumerProps);
-    }

Review comment:
       Thanks for the reminder! This class has too much warnings (technical debt) so I didn't notice this one 😞 Maybe we need a giant refactor on Kafka test utils in the future. They are deeply bound with the legacy FlinkKafkaProducer and FlinkKafkaConsumer now so a lots of horrible warnings in IDE.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] leonardBang commented on a change in pull request #18965: [FLINK-26387][connector/kafka] Use individual multi-broker cluster in broker failure tests

Posted by GitBox <gi...@apache.org>.
leonardBang commented on a change in pull request #18965:
URL: https://github.com/apache/flink/pull/18965#discussion_r818288213



##########
File path: flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/streaming/connectors/kafka/KafkaConsumerTestBase.java
##########
@@ -1463,23 +1463,30 @@ public void cancel() {
     public void runBrokerFailureTest() throws Exception {
         final String topic = "brokerFailureTestTopic";
 
+        // Start a temporary multi-broker cluster.
+        // This test case relies on stopping a broker and switching partition leader to another
+        // during the test, so single-broker cluster (kafkaServer) could not fulfill the
+        // requirement.
+        KafkaTestEnvironment multiBrokerCluster = constructKafkaTestEnvironment();

Review comment:
       ```suggestion
           final KafkaTestEnvironment kafkaServerCluster = constructKafkaTestEnvironment();
   ```

##########
File path: flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/streaming/connectors/kafka/KafkaConsumerTestBase.java
##########
@@ -2610,7 +2620,9 @@ public T map(T value) throws Exception {
 
                 if (failer && numElementsTotal >= failCount) {
                     // shut down a Kafka broker
-                    kafkaServer.stopBroker(shutdownBrokerId);
+                    kafkaServerToKill.stopBroker(shutdownBrokerId);
+                    hasBeenCheckpointedBeforeFailure = hasBeenCheckpointed;
+                    killedLeaderBefore = true;

Review comment:
       This should be a bug in your last PR and now you correct this IIUC, aha?

##########
File path: flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/streaming/connectors/kafka/KafkaConsumerTestBase.java
##########
@@ -1463,23 +1463,30 @@ public void cancel() {
     public void runBrokerFailureTest() throws Exception {
         final String topic = "brokerFailureTestTopic";
 
+        // Start a temporary multi-broker cluster.
+        // This test case relies on stopping a broker and switching partition leader to another
+        // during the test, so single-broker cluster (kafkaServer) could not fulfill the
+        // requirement.
+        KafkaTestEnvironment multiBrokerCluster = constructKafkaTestEnvironment();

Review comment:
       minor: we can move this piece of code to line `1478` for readable consideration

##########
File path: flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/streaming/connectors/kafka/KafkaTestEnvironmentImpl.java
##########
@@ -496,17 +494,4 @@ private void unpause(int brokerId) throws Exception {
         pausedBroker.remove(brokerId);
         LOG.info("Broker {} is resumed", brokerId);
     }
-
-    private KafkaConsumer<Void, Void> createTempConsumer() {
-        Properties consumerProps = new Properties();
-        consumerProps.putAll(getStandardProperties());
-        consumerProps.setProperty(
-                ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG,
-                VoidDeserializer.class.getCanonicalName());
-        consumerProps.setProperty(
-                ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG,
-                VoidDeserializer.class.getCanonicalName());
-        consumerProps.setProperty(ConsumerConfig.ALLOW_AUTO_CREATE_TOPICS_CONFIG, "false");
-        return new KafkaConsumer<>(consumerProps);
-    }

Review comment:
       plz check the IDE warning before open a PR thus we can avoid this kind of minor issue.

##########
File path: flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/streaming/connectors/kafka/KafkaConsumerTestBase.java
##########
@@ -2584,14 +2591,17 @@ private boolean validateSequence(
         public static volatile boolean killedLeaderBefore;
         public static volatile boolean hasBeenCheckpointedBeforeFailure;
 
+        private static KafkaTestEnvironment kafkaServerToKill;

Review comment:
       I tend to use `kafkaServerToShutdown` name because we call command `shutdown` instead of `kill ` command

##########
File path: flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/streaming/connectors/kafka/KafkaConsumerTestBase.java
##########
@@ -1495,21 +1502,21 @@ public void runBrokerFailureTest() throws Exception {
         env.setRestartStrategy(RestartStrategies.noRestart());
 
         Properties props = new Properties();
-        props.putAll(standardProps);
-        props.putAll(secureProps);
+        props.putAll(multiBrokerCluster.getStandardProperties());
+        props.putAll(multiBrokerCluster.getSecureProperties());
 
         getStream(env, topic, schema, props)
                 .map(new PartitionValidatingMapper(parallelism, 1))
-                .map(new BrokerKillingMapper<Integer>(leaderId, failAfterElements))
+                .map(new BrokerKillingMapper<>(multiBrokerCluster, leaderId, failAfterElements))
                 .addSink(new ValidatingExactlyOnceSink(totalElements))
                 .setParallelism(1);
 
         try {
             BrokerKillingMapper.killedLeaderBefore = false;
             tryExecute(env, "Broker failure once test");
         } finally {
-            // start a new broker:
-            kafkaServer.restartBroker(leaderId);
+            // Tear down the temporary cluster anyway

Review comment:
       ```suggestion
               // Shutdown the kafkaServer cluster directly
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #18965: [FLINK-26387][connector/kafka] Use individual multi-broker cluster in broker failure tests

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #18965:
URL: https://github.com/apache/flink/pull/18965#issuecomment-1057611030


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "868aa2c455dd900823290ba207edf2ef81c7d2d5",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32464",
       "triggerID" : "868aa2c455dd900823290ba207edf2ef81c7d2d5",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 868aa2c455dd900823290ba207edf2ef81c7d2d5 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32464) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] PatrickRen commented on pull request #18965: [FLINK-26387][connector/kafka] Use individual multi-broker cluster in broker failure tests

Posted by GitBox <gi...@apache.org>.
PatrickRen commented on pull request #18965:
URL: https://github.com/apache/flink/pull/18965#issuecomment-1057664371


   Thanks @leonardBang for the review! I made another push just now. Please have a look when you are available. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] PatrickRen commented on a change in pull request #18965: [FLINK-26387][connector/kafka] Use individual multi-broker cluster in broker failure tests

Posted by GitBox <gi...@apache.org>.
PatrickRen commented on a change in pull request #18965:
URL: https://github.com/apache/flink/pull/18965#discussion_r818308240



##########
File path: flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/streaming/connectors/kafka/KafkaConsumerTestBase.java
##########
@@ -2610,7 +2620,9 @@ public T map(T value) throws Exception {
 
                 if (failer && numElementsTotal >= failCount) {
                     // shut down a Kafka broker
-                    kafkaServer.stopBroker(shutdownBrokerId);
+                    kafkaServerToKill.stopBroker(shutdownBrokerId);
+                    hasBeenCheckpointedBeforeFailure = hasBeenCheckpointed;
+                    killedLeaderBefore = true;

Review comment:
       Yep exactly 👍 Sorry for being so careless




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] leonardBang closed pull request #18965: [FLINK-26387][connector/kafka] Use individual multi-broker cluster in broker failure tests

Posted by GitBox <gi...@apache.org>.
leonardBang closed pull request #18965:
URL: https://github.com/apache/flink/pull/18965


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org