Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id CAB67200D4F for ; Wed, 6 Dec 2017 13:43:07 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id C9875160BFD; Wed, 6 Dec 2017 12:43:07 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E9179160C08 for ; Wed, 6 Dec 2017 13:43:06 +0100 (CET) Received: (qmail 22710 invoked by uid 500); 6 Dec 2017 12:43:06 -0000 Mailing-List: contact issues-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list issues@flink.apache.org Received: (qmail 22701 invoked by uid 99); 6 Dec 2017 12:43:06 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Dec 2017 12:43:06 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 44DAE1A17B4 for ; Wed, 6 Dec 2017 12:43:05 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.021 X-Spam-Level: X-Spam-Status: No, score=-4.021 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id d9A4R8gpGJAP for ; Wed, 6 Dec 2017 12:43:03 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id D31355F472 for ; Wed, 6 Dec 2017 12:43:02 +0000 (UTC) Received: (qmail 22220 invoked by uid 99); 6 Dec 2017 12:43:01 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Dec 2017 12:43:01 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 499DAE00BD; Wed, 6 Dec 2017 12:43:01 +0000 (UTC) From: zentol To: issues@flink.incubator.apache.org Reply-To: issues@flink.incubator.apache.org References: In-Reply-To: Subject: [GitHub] flink pull request #5062: [FLINK-7880][QS] Wait for proper resource cleanup ... Content-Type: text/plain Message-Id: <20171206124301.499DAE00BD@git1-us-west.apache.org> Date: Wed, 6 Dec 2017 12:43:01 +0000 (UTC) archived-at: Wed, 06 Dec 2017 12:43:08 -0000 Github user zentol commented on a diff in the pull request: https://github.com/apache/flink/pull/5062#discussion_r155225199 --- Diff: flink-queryable-state/flink-queryable-state-runtime/src/test/java/org/apache/flink/queryablestate/itcases/AbstractQueryableStateTestBase.java --- @@ -260,89 +260,90 @@ public void testDuplicateRegistrationFailsJob() throws Exception { final Deadline deadline = TEST_TIMEOUT.fromNow(); final int numKeys = 256; - JobID jobId = null; + StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); + env.setStateBackend(stateBackend); + env.setParallelism(maxParallelism); + // Very important, because cluster is shared between tests and we + // don't explicitly check that all slots are available before + // submitting. + env.setRestartStrategy(RestartStrategies.fixedDelayRestart(Integer.MAX_VALUE, 1000L)); - try { - // - // Test program - // - StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); - env.setStateBackend(stateBackend); - env.setParallelism(maxParallelism); - // Very important, because cluster is shared between tests and we - // don't explicitly check that all slots are available before - // submitting. - env.setRestartStrategy(RestartStrategies.fixedDelayRestart(Integer.MAX_VALUE, 1000L)); - - DataStream> source = env - .addSource(new TestKeyRangeSource(numKeys)); - - // Reducing state - ReducingStateDescriptor> reducingState = new ReducingStateDescriptor<>( - "any-name", - new SumReduce(), - source.getType()); - - final String queryName = "duplicate-me"; - - final QueryableStateStream> queryableState = - source.keyBy(new KeySelector, Integer>() { - private static final long serialVersionUID = -4126824763829132959L; - - @Override - public Integer getKey(Tuple2 value) throws Exception { - return value.f0; - } - }).asQueryableState(queryName, reducingState); + DataStream> source = env.addSource(new TestKeyRangeSource(numKeys)); - final QueryableStateStream> duplicate = - source.keyBy(new KeySelector, Integer>() { - private static final long serialVersionUID = -6265024000462809436L; + // Reducing state + ReducingStateDescriptor> reducingState = new ReducingStateDescriptor<>( + "any-name", + new SumReduce(), + source.getType()); - @Override - public Integer getKey(Tuple2 value) throws Exception { - return value.f0; - } - }).asQueryableState(queryName); + final String queryName = "duplicate-me"; - // Submit the job graph - JobGraph jobGraph = env.getStreamGraph().getJobGraph(); - jobId = jobGraph.getJobID(); + final QueryableStateStream> queryableState = + source.keyBy(new KeySelector, Integer>() { + private static final long serialVersionUID = -4126824763829132959L; - final CompletableFuture failedFuture = - notifyWhenJobStatusIs(jobId, JobStatus.FAILED, deadline); + @Override + public Integer getKey(Tuple2 value) { + return value.f0; + } + }).asQueryableState(queryName, reducingState); - cluster.submitJobDetached(jobGraph); + final QueryableStateStream> duplicate = + source.keyBy(new KeySelector, Integer>() { + private static final long serialVersionUID = -6265024000462809436L; - TestingJobManagerMessages.JobStatusIs jobStatus = - failedFuture.get(deadline.timeLeft().toMillis(), TimeUnit.MILLISECONDS); - assertEquals(JobStatus.FAILED, jobStatus.state()); + @Override + public Integer getKey(Tuple2 value) { + return value.f0; + } + }).asQueryableState(queryName); + + // Submit the job graph + final JobGraph jobGraph = env.getStreamGraph().getJobGraph(); + final JobID jobId = jobGraph.getJobID(); + + final CompletableFuture failedFuture = + notifyWhenJobStatusIs(jobId, JobStatus.FAILED, deadline); - // Get the job and check the cause - JobManagerMessages.JobFound jobFound = FutureUtils.toJava( - cluster.getLeaderGateway(deadline.timeLeft()) - .ask(new JobManagerMessages.RequestJob(jobId), deadline.timeLeft()) - .mapTo(ClassTag$.MODULE$.apply(JobManagerMessages.JobFound.class))) - .get(deadline.timeLeft().toMillis(), TimeUnit.MILLISECONDS); + final CompletableFuture cancellationFuture = + notifyWhenJobStatusIs(jobId, JobStatus.CANCELED, deadline); - String failureCause = jobFound.executionGraph().getFailureCause().getExceptionAsString(); + cluster.submitJobDetached(jobGraph); - assertTrue("Not instance of SuppressRestartsException", failureCause.startsWith("org.apache.flink.runtime.execution.SuppressRestartsException")); - int causedByIndex = failureCause.indexOf("Caused by: "); - String subFailureCause = failureCause.substring(causedByIndex + "Caused by: ".length()); - assertTrue("Not caused by IllegalStateException", subFailureCause.startsWith("java.lang.IllegalStateException")); - assertTrue("Exception does not contain registration name", subFailureCause.contains(queryName)); + try { + final TestingJobManagerMessages.JobStatusIs jobStatus = + failedFuture.get(deadline.timeLeft().toMillis(), TimeUnit.MILLISECONDS); + assertEquals(JobStatus.FAILED, jobStatus.state()); --- End diff -- isn't this always true if the future did not time out? (In which case get() throws a TimeoutException) ---