You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by ae...@apache.org on 2020/02/12 21:03:35 UTC

[hadoop-ozone] branch master updated: HDDS-2955. Unnecessary log messages in DBStoreBuilder (#502)

This is an automated email from the ASF dual-hosted git repository.

aengineer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hadoop-ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new f4fbc01  HDDS-2955. Unnecessary log messages in DBStoreBuilder (#502)
f4fbc01 is described below

commit f4fbc01e5fe7f74284eb64454b733501bb7ddf80
Author: Doroszlai, Attila <64...@users.noreply.github.com>
AuthorDate: Wed Feb 12 22:03:23 2020 +0100

    HDDS-2955. Unnecessary log messages in DBStoreBuilder (#502)
---
 .../hadoop/hdds/utils/db/DBStoreBuilder.java       | 33 +++++++++++++---------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/db/DBStoreBuilder.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/db/DBStoreBuilder.java
index e3d5afb..c38bc0f 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/db/DBStoreBuilder.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/db/DBStoreBuilder.java
@@ -40,6 +40,7 @@ import java.io.File;
 import java.io.IOException;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
@@ -59,6 +60,10 @@ public final class DBStoreBuilder {
       LoggerFactory.getLogger(DBStoreBuilder.class);
   public static final Logger ROCKS_DB_LOGGER =
       LoggerFactory.getLogger(RocksDB.class);
+
+  private static final String DEFAULT_COLUMN_FAMILY_NAME =
+      StringUtils.bytes2String(RocksDB.DEFAULT_COLUMN_FAMILY);
+
   private Set<TableConfig> tables;
   private DBProfile dbProfile;
   private DBOptions rocksDBOption;
@@ -117,6 +122,12 @@ public final class DBStoreBuilder {
 
   public DBStoreBuilder addTable(String tableName, ColumnFamilyOptions option)
       throws IOException {
+    LOG.debug("using custom profile for table: {}", tableName);
+    return addTableDefinition(tableName, option);
+  }
+
+  private DBStoreBuilder addTableDefinition(String tableName,
+      ColumnFamilyOptions option) throws IOException {
     TableConfig tableConfig = new TableConfig(tableName, option);
     if (!tables.add(tableConfig)) {
       String message = "Unable to add the table: " + tableName +
@@ -124,7 +135,6 @@ public final class DBStoreBuilder {
       LOG.error(message);
       throw new IOException(message);
     }
-    LOG.info("using custom profile for table: {}", tableName);
     return this;
   }
 
@@ -174,21 +184,16 @@ public final class DBStoreBuilder {
       dbProfile = this.configuration.getEnum(HDDS_DB_PROFILE,
           HDDS_DEFAULT_DB_PROFILE);
     }
+    LOG.debug("default profile:{}", dbProfile);
   }
 
   private void processTables() throws IOException {
-    if (tableNames.size() > 0) {
-      for (String name : tableNames) {
-        addTable(name, dbProfile.getColumnFamilyOptions());
-        LOG.info("Using default column profile:{} for Table:{}",
-            dbProfile.toString(), name);
-      }
+    List<String> list = new ArrayList<>(tableNames);
+    list.add(DEFAULT_COLUMN_FAMILY_NAME);
+    for (String name : list) {
+      LOG.debug("using default profile for table:{}", name);
+      addTableDefinition(name, dbProfile.getColumnFamilyOptions());
     }
-    addTable(StringUtils.bytes2String(RocksDB.DEFAULT_COLUMN_FAMILY),
-        dbProfile.getColumnFamilyOptions());
-    LOG.info("Using default column profile:{} for Table:{}",
-        dbProfile.toString(),
-        StringUtils.bytes2String(RocksDB.DEFAULT_COLUMN_FAMILY));
   }
 
   private DBOptions getDbProfile() {
@@ -211,13 +216,13 @@ public final class DBStoreBuilder {
             LOG.info("Using Configs from {}.ini file", dbname);
           }
         } catch (IOException ex) {
-          LOG.info("Unable to read ROCKDB config", ex);
+          LOG.info("Unable to read RocksDB config from {}", dbname, ex);
         }
       }
     }
 
     if (option == null) {
-      LOG.info("Using default options. {}", dbProfile.toString());
+      LOG.debug("Using default options: {}", dbProfile);
       option = dbProfile.getDBOptions();
     }
 


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