You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2022/09/17 03:44:00 UTC

[GitHub] [ozone] adoroszlai commented on a diff in pull request #3755: HDDS-7224. Create a new RocksDBCheckpoint Diff utility.

adoroszlai commented on code in PR #3755:
URL: https://github.com/apache/ozone/pull/3755#discussion_r973534185


##########
pom.xml:
##########
@@ -1843,35 +1843,47 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xs
               </goals>
               <configuration>
                 <rules>
-                  <RestrictImports>
-                    <includeTestCode>false</includeTestCode>
-                    <reason>Use managed RocksObjects under org.apache.hadoop.hdds.utils.db.managed instead.</reason>
-                    <!-- By default, ban all the classes in org.rocksdb -->
-                    <bannedImport>org.rocksdb.**</bannedImport>
-                    <allowedImports>
-                      <!-- Allow non-RocksObject classes. -->
-                      <allowedImport>org.rocksdb.BlockBasedTableConfig</allowedImport>
-                      <allowedImport>org.rocksdb.ColumnFamilyDescriptor</allowedImport>
-                      <allowedImport>org.rocksdb.CompactionStyle</allowedImport>
-                      <allowedImport>org.rocksdb.HistogramData</allowedImport>
-                      <allowedImport>org.rocksdb.HistogramType</allowedImport>
-                      <allowedImport>org.rocksdb.Holder</allowedImport>
-                      <allowedImport>org.rocksdb.InfoLogLevel</allowedImport>
-                      <allowedImport>org.rocksdb.OptionsUtil</allowedImport>
-                      <allowedImport>org.rocksdb.RocksDBException</allowedImport>
-                      <allowedImport>org.rocksdb.StatsLevel</allowedImport>
-                      <allowedImport>org.rocksdb.TransactionLogIterator.BatchResult</allowedImport>
-                      <allowedImport>org.rocksdb.TickerType</allowedImport>
-
-                      <!-- Allow RocksObjects whose native pointer is managed by RocksDB. -->
-                      <allowedImport>org.rocksdb.ColumnFamilyHandle</allowedImport>
-                      <allowedImport>org.rocksdb.Env</allowedImport>
-                      <allowedImport>org.rocksdb.Statistics</allowedImport>
-
-                      <!-- Allow RocksDB constants and static methods to be used. -->
-                      <allowedImport>org.rocksdb.RocksDB.*</allowedImport>
-                    </allowedImports>
-                    <exclusion>org.apache.hadoop.hdds.utils.db.managed.*</exclusion>
+                  <RestrictImports>	
+                    <includeTestCode>false</includeTestCode>	
+                    <reason>Use managed RocksObjects under org.apache.hadoop.hdds.utils.db.managed instead.</reason>	
+                    <!-- By default, ban all the classes in org.rocksdb -->	
+                    <bannedImport>org.rocksdb.**</bannedImport>	
+                    <allowedImports>	
+                      <!-- Allow non-RocksObject classes. -->	
+                      <allowedImport>org.rocksdb.BlockBasedTableConfig</allowedImport>	
+                      <allowedImport>org.rocksdb.ColumnFamilyDescriptor</allowedImport>	
+                      <allowedImport>org.rocksdb.CompactionStyle</allowedImport>	
+                      <allowedImport>org.rocksdb.HistogramData</allowedImport>	
+                      <allowedImport>org.rocksdb.HistogramType</allowedImport>	
+                      <allowedImport>org.rocksdb.Holder</allowedImport>	
+                      <allowedImport>org.rocksdb.InfoLogLevel</allowedImport>	
+                      <allowedImport>org.rocksdb.OptionsUtil</allowedImport>	
+                      <allowedImport>org.rocksdb.RocksDBException</allowedImport>	
+                      <allowedImport>org.rocksdb.StatsLevel</allowedImport>	
+                      <allowedImport>org.rocksdb.TransactionLogIterator.BatchResult</allowedImport>	
+                      <allowedImport>org.rocksdb.TickerType</allowedImport>	
+
+                      <allowedImport>org.rocksdb.AbstractEventListener</allowedImport>	
+                      <allowedImport>org.rocksdb.Checkpoint</allowedImport>	
+                      <allowedImport>org.rocksdb.CompactionJobInfo</allowedImport>	
+                      <allowedImport>org.rocksdb.CompressionType</allowedImport>	
+                      <allowedImport>org.rocksdb.DBOptions</allowedImport>	
+                      <allowedImport>org.rocksdb.FlushOptions</allowedImport>	
+                      <allowedImport>org.rocksdb.LiveFileMetaData</allowedImport>	
+                      <allowedImport>org.rocksdb.Options</allowedImport>	
+                      <allowedImport>org.rocksdb.RocksDB</allowedImport>	

Review Comment:
   Allowing these (e.g. `RocksDB` and `Options`) seems to circumvent the whole point of banning these imports.
   
   If these imports are absolutely necessary for the diff tool, please add override the restrictions only for that module.



##########
hadoop-hdds/rocksdb-checkpoint-differ/pom.xml:
##########
@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed 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. See accompanying LICENSE file.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+https://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.ozone</groupId>
+    <artifactId>hdds</artifactId>
+    <version>1.3.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>RocksDBCheckpointDiffer</artifactId>

Review Comment:
   Nit: Shouldn't artifact ID be in `rocksdb-checkpoint-differ` style?



##########
hadoop-hdds/rocksdb-checkpoint-differ/src/test/java/org/apache/ozone/rocksdiff/TestRocksDBCheckpointDiffer.java:
##########
@@ -0,0 +1,328 @@
+/*
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.ozone.rocksdiff;
+
+import static org.apache.ozone.rocksdiff.RocksDBCheckpointDiffer.DEBUG_DAG_LIVE_NODES;
+import static org.apache.ozone.rocksdiff.RocksDBCheckpointDiffer.DEBUG_READ_ALL_DB_KEYS;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+import java.util.stream.Collectors;
+
+import org.rocksdb.ColumnFamilyDescriptor;
+import org.rocksdb.ColumnFamilyHandle;
+import org.rocksdb.ColumnFamilyOptions;
+import org.rocksdb.CompressionType;
+import org.rocksdb.DBOptions;
+import org.rocksdb.LiveFileMetaData;
+import org.rocksdb.Options;
+import org.rocksdb.RocksDB;
+import org.rocksdb.RocksDBException;
+import org.rocksdb.RocksIterator;
+
+////CHECKSTYLE:OFF

Review Comment:
   > Find bugs warnings are in UnitTest Class and can be ignored for now.
   
   Please add a `@SuppressFBWarnings` annotation.



##########
hadoop-hdds/rocksdb-checkpoint-differ/src/main/java/org/apache/ozone/rocksdiff/RelationshipEdg.java:
##########
@@ -0,0 +1,30 @@
+/*
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.rocksdiff;
+
+// import org.jgrapht.graph.DefaultEdge;
+// Enable this import and extend DefaultEdge if We need to
+// pcitorially represent the DAG constructed.
+
+//class RelationshipEdge extends DefaultEdge {
+class RelationshipEdge {

Review Comment:
   Class name and file name mismatch.



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

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org