You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "SteNicholas (via GitHub)" <gi...@apache.org> on 2023/09/06 04:06:10 UTC

[GitHub] [flink-kubernetes-operator] SteNicholas commented on a diff in pull request #657: [FLINK-31406] Do not delete jobgraph on scale only last-state upgrades

SteNicholas commented on code in PR #657:
URL: https://github.com/apache/flink-kubernetes-operator/pull/657#discussion_r1316695338


##########
flink-kubernetes-operator/src/test/java/org/apache/flink/kubernetes/operator/reconciler/deployment/ApplicationReconcilerTest.java:
##########
@@ -847,6 +865,62 @@ public void cancelJob(
         assertEquals(1, rescaleCounter.get());
     }
 
+    @Test
+    public void testScaleWithJobGraphKeptInHAMetadata() throws Exception {
+        final String jobGraphKey = Constants.JOB_GRAPH_STORE_KEY_PREFIX + JobID.generate();
+        final String jobGraphVal = "job-graph-data";
+        createHAConfigMapWithData(
+                kubernetesClient,
+                "ha-configmap",
+                TEST_NAMESPACE,
+                TEST_DEPLOYMENT_NAME,
+                Collections.singletonMap(jobGraphKey, jobGraphVal));
+        final Map<String, String> configMapLabels =
+                KubernetesUtils.getConfigMapLabels(
+                        TEST_DEPLOYMENT_NAME, Constants.LABEL_CONFIGMAP_TYPE_HIGH_AVAILABILITY);
+        assertEquals(
+                jobGraphVal,
+                kubernetesClient
+                        .configMaps()
+                        .inNamespace(TEST_NAMESPACE)
+                        .withLabels(configMapLabels)
+                        .list()
+                        .getItems()
+                        .get(0)
+                        .getData()
+                        .get(jobGraphKey));
+
+        FlinkDeployment deployment = TestUtils.buildApplicationCluster();
+        getJobSpec(deployment).setUpgradeMode(UpgradeMode.LAST_STATE);
+        deployment
+                .getSpec()
+                .getFlinkConfiguration()
+                .put(
+                        KubernetesOperatorConfigOptions
+                                .OPERATOR_JOB_UPGRADE_LAST_STATE_FALLBACK_ENABLED
+                                .key(),
+                        "false");
+        reconciler.reconcile(deployment, context);
+        deployment.getStatus().setJobManagerDeploymentStatus(JobManagerDeploymentStatus.MISSING);
+        flinkService.clear();
+        deployment
+                .getSpec()
+                .getFlinkConfiguration()
+                .put(PipelineOptions.PARALLELISM_OVERRIDES.key(), new JobVertexID() + ":1");
+        reconciler.reconcile(deployment, context);
+        assertEquals(
+                jobGraphVal,
+                kubernetesClient
+                        .configMaps()
+                        .inNamespace(TEST_NAMESPACE)
+                        .withLabels(configMapLabels)
+                        .list()
+                        .getItems()
+                        .get(0)
+                        .getData()
+                        .get(jobGraphKey));

Review Comment:
   @gyfora, I have addressed the comments and corrected the test case. PTAL.



-- 
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