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-10423) Forward RocksDB native metrics to Flink metrics reporter
Date Mon, 15 Oct 2018 10:41:01 GMT

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

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

zentol commented on a change in pull request #6814: [FLINK-10423][rocksdb][metrics] rocksdb
native metrics monitor
URL: https://github.com/apache/flink/pull/6814#discussion_r225117046
 
 

 ##########
 File path: flink-state-backends/flink-statebackend-rocksdb/src/test/java/org/apache/flink/contrib/streaming/state/RocksDBNativeMetricMonitorTest.java
 ##########
 @@ -0,0 +1,148 @@
+/*
+ * 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.contrib.streaming.state;
+
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.configuration.MetricOptions;
+import org.apache.flink.metrics.Metric;
+import org.apache.flink.runtime.jobgraph.OperatorID;
+import org.apache.flink.runtime.metrics.MetricRegistry;
+import org.apache.flink.runtime.metrics.groups.AbstractMetricGroup;
+import org.apache.flink.runtime.metrics.groups.OperatorMetricGroup;
+import org.apache.flink.runtime.metrics.groups.UnregisteredMetricGroups;
+import org.apache.flink.runtime.metrics.scope.ScopeFormats;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.rocksdb.ColumnFamilyHandle;
+
+import javax.annotation.Nullable;
+
+import java.util.ArrayList;
+
+/**
+ * validate native metric monitor.
+ */
+public class RocksDBNativeMetricMonitorTest {
+
+	private static final String OPERATOR_NAME = "dummy";
+
+	private static final String COLUMN_FAMILY_NAME = "column-family";
+
+	@Test
+	public void testMetricMonitorLifecycle() throws Throwable {
+		//created as a local variable instead of using @Rule
+		//we we can manually control the lifecycle. Using @Rule
+		//but manually calling after causes occasional segmentation
+		//faults.
+		RocksDBResource rocksDBResource = new RocksDBResource();
+		rocksDBResource.before();
+
+		SimpleMetricRegistry registry = new SimpleMetricRegistry();
+		OperatorMetricGroup group = new OperatorMetricGroup(
+			registry,
+			UnregisteredMetricGroups.createUnregisteredTaskMetricGroup(),
+			new OperatorID(),
+			OPERATOR_NAME
+		);
+
+		RocksDBNativeMetricOptions options = new RocksDBNativeMetricOptions();
+		// always returns a non-zero
+		// value since empty memtables
+		// have overhead.
+		options.enableSizeAllMemTables();
+
+		RocksDBNativeMetricMonitor monitor = new RocksDBNativeMetricMonitor(
+			rocksDBResource.getRocksDB(),
+			options,
+			group
+		);
+
+		ColumnFamilyHandle handle = rocksDBResource.createNewColumnFamily(COLUMN_FAMILY_NAME);
+		monitor.registerColumnFamily(COLUMN_FAMILY_NAME, handle);
+
+		Assert.assertEquals("Failed to register metrics for column family", 1, registry.metrics.size());
+
+		RocksDBNativeMetricMonitor.RocksDBNativeMetricView view = registry.metrics.get(0);
+
+		view.update();
+
+		Assert.assertNotEquals("Failed to pull metric from RocksDB", 0, Long.parseLong(view.getValue()));
+
+		view.setValue(0L);
+
+		//removing this line reliably causes segmentation faults
 
 Review comment:
   re-phrase: `After the monitor is closed no metric should be accessing RocksDB anymore.
If they do, then this test will likely fail with a segmentation fault.`

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


> Forward RocksDB native metrics to Flink metrics reporter 
> ---------------------------------------------------------
>
>                 Key: FLINK-10423
>                 URL: https://issues.apache.org/jira/browse/FLINK-10423
>             Project: Flink
>          Issue Type: New Feature
>          Components: Metrics, State Backends, Checkpointing
>            Reporter: Seth Wiesman
>            Assignee: Seth Wiesman
>            Priority: Major
>              Labels: pull-request-available
>
> RocksDB contains a number of metrics at the column family level about current memory
usage, open memtables,  etc that would be useful to users wishing greater insight what rocksdb
is doing. This work is inspired heavily by the comments on this rocksdb issue thread (https://github.com/facebook/rocksdb/issues/3216#issuecomment-348779233)



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

Mime
View raw message