[ 
https://issues.apache.org/jira/browse/BEAM-6876?focusedWorklogId=219451&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-219451
 ]

ASF GitHub Bot logged work on BEAM-6876:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 27/Mar/19 17:19
            Start Date: 27/Mar/19 17:19
    Worklog Time Spent: 10m 
      Work Description: mxm commented on pull request #8118: [BEAM-6876] 
Cleanup user state in portable Flink Runner
URL: https://github.com/apache/beam/pull/8118#discussion_r269678618
 
 

 ##########
 File path: 
runners/flink/src/test/java/org/apache/beam/runners/flink/streaming/ExecutableStageDoFnOperatorTest.java
 ##########
 @@ -340,6 +346,38 @@ public void testStageBundleClosed() throws Exception {
     verifyNoMoreInteractions(bundle);
   }
 
+  @Test
+  public void testEnsureStateCleanupWithKeyedInput() throws Exception {
+    TupleTag<Integer> mainOutput = new TupleTag<>("main-output");
+    DoFnOperator.MultiOutputOutputManagerFactory<Integer> outputManagerFactory 
=
+        new DoFnOperator.MultiOutputOutputManagerFactory(mainOutput, 
VoidCoder.of());
+    VarIntCoder keyCoder = VarIntCoder.of();
+    ExecutableStageDoFnOperator<Integer, Integer> operator =
+        getOperator(mainOutput, Collections.emptyList(), outputManagerFactory, 
keyCoder);
+
+    KeyedOneInputStreamOperatorTestHarness<Integer, WindowedValue<Integer>, 
WindowedValue<Integer>>
+        testHarness =
+            new KeyedOneInputStreamOperatorTestHarness(
+                operator, val -> val, new CoderTypeInformation<>(keyCoder));
+
+    RemoteBundle bundle = Mockito.mock(RemoteBundle.class);
+    when(bundle.getInputReceivers())
+        .thenReturn(
+            ImmutableMap.<String, FnDataReceiver<WindowedValue>>builder()
+                .put("input", Mockito.mock(FnDataReceiver.class))
+                .build());
+    when(stageBundleFactory.getBundle(any(), any(), any())).thenReturn(bundle);
+
+    testHarness.open();
+
+    Object doFnRunner = Whitebox.getInternalState(operator, "doFnRunner");
+    assertThat(doFnRunner, instanceOf(DoFnRunnerWithMetricsUpdate.class));
+
+    // There should be a StatefulDoFnRunner installed which takes care of 
clearing state
+    Object statefulDoFnRunner = Whitebox.getInternalState(doFnRunner, 
"delegate");
+    assertThat(statefulDoFnRunner, instanceOf(StatefulDoFnRunner.class));
 
 Review comment:
   We have tests for the `StatefulDoFnRunner`, but you're right. We should test 
the timer setting and state cleanup. Added additional tests.
 
----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 219451)
    Time Spent: 2h  (was: 1h 50m)

> User state cleanup in portable Flink runner
> -------------------------------------------
>
>                 Key: BEAM-6876
>                 URL: https://issues.apache.org/jira/browse/BEAM-6876
>             Project: Beam
>          Issue Type: Bug
>          Components: runner-flink
>    Affects Versions: 2.11.0
>            Reporter: Thomas Weise
>            Assignee: Maximilian Michels
>            Priority: Major
>              Labels: portability-flink
>          Time Spent: 2h
>  Remaining Estimate: 0h
>
> State is currently not being cleaned up by the runner.
> [https://lists.apache.org/thread.html/86f0809fbfa3da873051287b9ff249d6dd5a896b45409db1e484cf38@%3Cdev.beam.apache.org%3E]
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to