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

wylee pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nemo.git


The following commit(s) were added to refs/heads/master by this push:
     new dd0cfe2  [NEMO-375] Clean up of remnants of #211 (#224)
dd0cfe2 is described below

commit dd0cfe20ffdc49cde380e7afe0d20625f3638a05
Author: Won Wook SONG <[email protected]>
AuthorDate: Tue Sep 24 21:29:04 2019 +0900

    [NEMO-375] Clean up of remnants of #211 (#224)
    
    JIRA: [NEMO-375: Add option to turn off metric collection to 
DB](https://issues.apache.org/jira/projects/NEMO/issues/NEMO-375)
    
    **Major changes:**
    - None
    
    **Minor changes to note:**
    - Removes the static actions that happen nevertheless of the configuration 
and misleads users
    
    **Tests for the changes:**
    - None
    
    **Other comments:**
    - None
    
    Closes #224
---
 .../java/org/apache/nemo/runtime/common/metric/MetricUtils.java     | 6 +++---
 .../java/org/apache/nemo/runtime/master/metric/MetricStore.java     | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/runtime/common/src/main/java/org/apache/nemo/runtime/common/metric/MetricUtils.java
 
b/runtime/common/src/main/java/org/apache/nemo/runtime/common/metric/MetricUtils.java
index 8d458ae..49bdd9f 100644
--- 
a/runtime/common/src/main/java/org/apache/nemo/runtime/common/metric/MetricUtils.java
+++ 
b/runtime/common/src/main/java/org/apache/nemo/runtime/common/metric/MetricUtils.java
@@ -65,7 +65,6 @@ public final class MetricUtils {
     } catch (ClassNotFoundException e) {
       throw new MetricException("PostgreSQL Driver not found: " + e);
     }
-    loadMetaData();
   }
 
   public static final String SQLITE_DB_NAME =
@@ -83,9 +82,9 @@ public final class MetricUtils {
   /**
    * Load the BiMaps (lightweight) Metadata from the DB.
    *
-   * @return the loaded BiMaps, or initialized ones.
+   * @return Whether or not the metadata has been successfully loaded from the 
DB.
    */
-  private static void loadMetaData() {
+  public static Boolean loadMetaData() {
     try (Connection c = 
DriverManager.getConnection(MetricUtils.POSTGRESQL_METADATA_DB_NAME,
       "postgres", "fake_password")) {
       try (Statement statement = c.createStatement()) {
@@ -121,6 +120,7 @@ public final class MetricUtils {
     } catch (Exception e) {
       LOG.warn("Loading metadata from DB failed : ", e);
     }
+    return metaDataLoaded();
   }
 
   public static Boolean metaDataLoaded() {
diff --git 
a/runtime/master/src/main/java/org/apache/nemo/runtime/master/metric/MetricStore.java
 
b/runtime/master/src/main/java/org/apache/nemo/runtime/master/metric/MetricStore.java
index 5e55d84..3d3db4f 100644
--- 
a/runtime/master/src/main/java/org/apache/nemo/runtime/master/metric/MetricStore.java
+++ 
b/runtime/master/src/main/java/org/apache/nemo/runtime/master/metric/MetricStore.java
@@ -278,7 +278,7 @@ public final class MetricStore {
                                           final String dbId, final String 
dbPasswd) {
     final String[] syntax = {"SERIAL PRIMARY KEY"};
 
-    if (!MetricUtils.metaDataLoaded()) {
+    if (!MetricUtils.metaDataLoaded() && !MetricUtils.loadMetaData()) {
       saveOptimizationMetricsToLocal(jobId);
       return;
     }

Reply via email to