flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-10042) Extract snapshot algorithms from inner classes into full classes
Date Mon, 20 Aug 2018 17:53:00 GMT

    [ https://issues.apache.org/jira/browse/FLINK-10042?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586300#comment-16586300
] 

ASF GitHub Bot commented on FLINK-10042:
----------------------------------------

azagrebin commented on a change in pull request #6556: FLINK-10042][state] Extract snapshot
algorithms from inner classes of RocksDBKeyedStateBackend into full classes
URL: https://github.com/apache/flink/pull/6556#discussion_r210962023
 
 

 ##########
 File path: flink-runtime/src/main/java/org/apache/flink/runtime/state/AbstractSnapshotStrategy.java
 ##########
 @@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.runtime.state;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.annotation.Nonnull;
+
+/**
+ * Abstract base class for implementing {@link SnapshotStrategy}, that gives a consistent
logging across state backends.
+ *
+ * @param <T> type of the snapshot result.
+ */
+public abstract class AbstractSnapshotStrategy<T extends StateObject> implements SnapshotStrategy<SnapshotResult<T>>
{
+
+	private static final Logger LOG = LoggerFactory.getLogger(AbstractSnapshotStrategy.class);
+
+	private static final String LOG_SYNC_COMPLETED_TEMPLATE = "{} ({}, synchronous part) in
thread {} took {} ms.";
+	private static final String LOG_ASYNC_COMPLETED_TEMPLATE = "{} ({}, asynchronous part) in
thread {} took {} ms.";
+
+	/** Descriptive name of the snapshot strategy that will appear in the log outputs and {@link
#toString()}. */
+	@Nonnull
+	protected final String description;
+
+	protected AbstractSnapshotStrategy(@Nonnull String description) {
+		this.description = description;
+	}
+
+	/**
+	 * Logs the duration of the synchronous snapshot part from the given start time.
+	 */
+	public void logSyncCompleted(@Nonnull Object checkpointOutDescription, long startTime) {
+		logCompletedInternal(LOG_SYNC_COMPLETED_TEMPLATE, checkpointOutDescription, startTime);
+	}
+
+	/**
+	 * Logs the duration of the synchronous snapshot part from the given start time.
 
 Review comment:
   asynchronous

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


> Extract snapshot algorithms from inner classes into full classes
> ----------------------------------------------------------------
>
>                 Key: FLINK-10042
>                 URL: https://issues.apache.org/jira/browse/FLINK-10042
>             Project: Flink
>          Issue Type: Sub-task
>            Reporter: Stefan Richter
>            Assignee: Stefan Richter
>            Priority: Major
>              Labels: pull-request-available
>




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

Mime
View raw message