From reviews-return-1019068-archive-asf-public=cust-asf.ponee.io@spark.apache.org Mon Jan 20 11:13:31 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 6C2FA18037A for ; Mon, 20 Jan 2020 12:13:31 +0100 (CET) Received: (qmail 81566 invoked by uid 500); 20 Jan 2020 11:13:30 -0000 Mailing-List: contact reviews-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list reviews@spark.apache.org Received: (qmail 81554 invoked by uid 99); 20 Jan 2020 11:13:30 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Jan 2020 11:13:30 +0000 From: GitBox To: reviews@spark.apache.org Subject: [GitHub] [spark] HeartSaVioR commented on a change in pull request #27002: [SPARK-30346][CORE]Improve logging when events dropped Message-ID: <157951881067.32510.2296669696459605152.gitbox@gitbox.apache.org> References: In-Reply-To: Date: Mon, 20 Jan 2020 11:13:30 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit HeartSaVioR commented on a change in pull request #27002: [SPARK-30346][CORE]Improve logging when events dropped URL: https://github.com/apache/spark/pull/27002#discussion_r368493390 ########## File path: core/src/main/scala/org/apache/spark/scheduler/AsyncEventQueue.scala ########## @@ -167,22 +170,19 @@ private class AsyncEventQueue( } logTrace(s"Dropping event $event") - val droppedCount = droppedEventsCounter.get - if (droppedCount > 0) { - // Don't log too frequently - if (System.currentTimeMillis() - lastReportTimestamp >= 60 * 1000) { - // There may be multiple threads trying to decrease droppedEventsCounter. - // Use "compareAndSet" to make sure only one thread can win. - // And if another thread is increasing droppedEventsCounter, "compareAndSet" will fail and - // then that thread will update it. - if (droppedEventsCounter.compareAndSet(droppedCount, 0)) { - val prevLastReportTimestamp = lastReportTimestamp - lastReportTimestamp = System.currentTimeMillis() - val previous = new java.util.Date(prevLastReportTimestamp) + val droppedCount = droppedEventsCounter.get - lastDroppedEventsCounter + val lastReportTime = lastReportTimestamp.get + val curTime = System.currentTimeMillis() + // Don't log too frequently + if (droppedCount > 0 && curTime - lastReportTime >= LOGGING_INTERVAL) { + // There may be multiple threads trying to logging dropped events, Review comment: Please fix indent, as we've consolidated two nested `if` into one because of reducing necessary indentation. ---------------------------------------------------------------- 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: users@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org For additional commands, e-mail: reviews-help@spark.apache.org