FAQ
Repository: hive
Updated Branches:
   refs/heads/branch-2.0 4357f130c -> ecccdda84
   refs/heads/master 4fa0f6659 -> 2a0dc3c3f


HIVE-13025 : need a better error message for when one needs to run schematool (Sergey Shelukhin, reviewed by Prasanth Jayachandran, Sushanth Sowmyan, Alan Gates)

Conflicts:
  ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/2a0dc3c3
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/2a0dc3c3
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/2a0dc3c3

Branch: refs/heads/master
Commit: 2a0dc3c3ff4ac914a967bd62d90ba9801cc04c57
Parents: 4fa0f66
Author: Sergey Shelukhin <sershe@apache.org>
Authored: Mon Feb 8 15:39:32 2016 -0800
Committer: Sergey Shelukhin <sershe@apache.org>
Committed: Mon Feb 8 17:43:32 2016 -0800

----------------------------------------------------------------------
  .../apache/hadoop/hive/ql/metadata/Hive.java | 28 +++++++++++++++++++-
  .../hadoop/hive/ql/session/SessionState.java | 6 +++++
  2 files changed, 33 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/2a0dc3c3/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
index 75d2519..5c32f6f 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
@@ -45,6 +45,8 @@ import java.util.Set;
  import java.util.concurrent.atomic.AtomicInteger;

  import com.google.common.collect.ImmutableMap;
+import javax.jdo.JDODataStoreException;
+
  import org.apache.hadoop.conf.Configuration;
  import org.apache.hadoop.fs.FileStatus;
  import org.apache.hadoop.fs.FileSystem;
@@ -3125,6 +3127,13 @@ private void constructOneLBLocationMap(FileStatus fSta,
      }
    }

+ public static class SchemaException extends MetaException {
+ private static final long serialVersionUID = 1L;
+ public SchemaException(String message) {
+ super(message);
+ }
+ }
+
    /**
     * @return the metastore client for the current thread
     * @throws MetaException
@@ -3140,7 +3149,24 @@ private void constructOneLBLocationMap(FileStatus fSta,
          LOG.error(msg, e);
          throw new MetaException(msg + "\n" + StringUtils.stringifyException(e));
        }
- metaStoreClient = createMetaStoreClient();
+ try {
+ metaStoreClient = createMetaStoreClient();
+ } catch (RuntimeException ex) {
+ Throwable t = ex.getCause();
+ while (t != null) {
+ if (t instanceof JDODataStoreException && t.getMessage() != null
+ && t.getMessage().contains("autoCreate")) {
+ LOG.error("Cannot initialize metastore due to autoCreate error", t);
+ // DataNucleus wants us to auto-create, but we shall do no such thing.
+ throw new SchemaException("Hive metastore database is not initialized. Please use "
+ + "schematool (e.g. ./schematool -initSchema -dbType ...) to create the schema. If "
+ + "needed, don't forget to include the option to auto-create the underlying database"
+ + " in your JDBC connection string (e.g. ?createDatabaseIfNotExist=true for mysql)");
+ }
+ t = t.getCause();
+ }
+ throw ex;
+ }
        String metaStoreUris = conf.getVar(HiveConf.ConfVars.METASTOREURIS);
        if (!org.apache.commons.lang3.StringUtils.isEmpty(metaStoreUris)) {
          // get a synchronized wrapper if the meta store is remote.

http://git-wip-us.apache.org/repos/asf/hive/blob/2a0dc3c3/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java b/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java
index 15965ad..2a1458e 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java
@@ -551,6 +551,12 @@ public class SessionState {
            throw new RuntimeException(e);
          }
        }
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Hive.SchemaException e) {
+ RuntimeException ex = new RuntimeException(e.getMessage());
+ ex.setStackTrace(new StackTraceElement[0]);
+ throw ex;
      } catch (Exception e) {
        // Catch-all due to some exec time dependencies on session state
        // that would cause ClassNoFoundException otherwise

Search Discussions

  • Sershe at Feb 9, 2016 at 1:52 am
    HIVE-13025 : need a better error message for when one needs to run schematool (Sergey Shelukhin, reviewed by Prasanth Jayachandran, Sushanth Sowmyan, Alan Gates)


    Project: http://git-wip-us.apache.org/repos/asf/hive/repo
    Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/ecccdda8
    Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/ecccdda8
    Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/ecccdda8

    Branch: refs/heads/branch-2.0
    Commit: ecccdda845a0a45de24463669847ddf37ad3c220
    Parents: 4357f13
    Author: Sergey Shelukhin <sershe@apache.org>
    Authored: Mon Feb 8 17:48:50 2016 -0800
    Committer: Sergey Shelukhin <sershe@apache.org>
    Committed: Mon Feb 8 17:48:50 2016 -0800

    ----------------------------------------------------------------------
      RELEASE_NOTES.txt | 6 ++++-
      .../apache/hadoop/hive/ql/metadata/Hive.java | 28 +++++++++++++++++++-
      .../hadoop/hive/ql/session/SessionState.java | 6 +++++
      3 files changed, 38 insertions(+), 2 deletions(-)
    ----------------------------------------------------------------------


    http://git-wip-us.apache.org/repos/asf/hive/blob/ecccdda8/RELEASE_NOTES.txt
    ----------------------------------------------------------------------
    diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
    index 488dbef..f9388c1 100644
    --- a/RELEASE_NOTES.txt
    +++ b/RELEASE_NOTES.txt
    @@ -417,6 +417,7 @@ Release Notes - Hive - Version 2.0.0
          * [HIVE-11466] - HIVE-10166 generates more data on hive.log causing Jenkins to fill all the disk.
          * [HIVE-11468] - Vectorize: Struct IN() clauses
          * [HIVE-11469] - Update doc for InstanceCache to clearly define the contract on the SeedObject
    + * [HIVE-11470] - NPE in DynamicPartFileRecordWriterContainer on null part-keys.
          * [HIVE-11472] - ORC StringDirectTreeReader is thrashing the GC due to byte[] allocation per row
          * [HIVE-11473] - Upgrade Spark dependency to 1.5 [Spark Branch]
          * [HIVE-11476] - TypeInfoParser cannot handle column names with spaces in them
    @@ -565,6 +566,7 @@ Release Notes - Hive - Version 2.0.0
          * [HIVE-11990] - Loading data inpath from a temporary table dir fails on Windows
          * [HIVE-11995] - Remove repetitively setting permissions in insert/load overwrite partition
          * [HIVE-12004] - SDPO doesnt set colExprMap correctly on new RS
    + * [HIVE-12007] - Hive LDAP Authenticator should allow just Domain without baseDN (for AD)
          * [HIVE-12008] - Hive queries failing when using count(*) on column in view
          * [HIVE-12011] - unable to create temporary table using CTAS if regular table with that name already exists
          * [HIVE-12012] - select query on json table with map containing numeric values fails
    @@ -815,6 +817,8 @@ Release Notes - Hive - Version 2.0.0
          * [HIVE-12947] - SMB join in tez has ClassCastException when container reuse is on
          * [HIVE-12964] - TestOperationLoggingAPIWithMr,TestOperationLoggingAPIWithTez fail on branch-2.0 (with Java 7, at least)
          * [HIVE-12985] - distribution configs are wrong and out of date
    + * [HIVE-13024] - schematool does not log anywhere
    +



    @@ -938,7 +942,7 @@ Release Notes - Hive - Version 2.0.0
          * [HIVE-12751] - Fix NVL explain syntax
          * [HIVE-12761] - Add stack trace servlet to HS2 web ui
          * [HIVE-12769] - LLAP: Pick up java_home from System properties for Slider
    -
    + * [HIVE-13025] - need a better error message for when one needs to run schematool


      ** New Feature

    http://git-wip-us.apache.org/repos/asf/hive/blob/ecccdda8/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
    ----------------------------------------------------------------------
    diff --git a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
    index 089f67a..e4ebd29 100644
    --- a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
    +++ b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
    @@ -44,6 +44,8 @@ import java.util.Map.Entry;
      import java.util.Set;
      import java.util.concurrent.atomic.AtomicInteger;

    +import javax.jdo.JDODataStoreException;
    +
      import org.apache.hadoop.conf.Configuration;
      import org.apache.hadoop.fs.FileStatus;
      import org.apache.hadoop.fs.FileSystem;
    @@ -3080,6 +3082,13 @@ private void constructOneLBLocationMap(FileStatus fSta,
          }
        }

    + public static class SchemaException extends MetaException {
    + private static final long serialVersionUID = 1L;
    + public SchemaException(String message) {
    + super(message);
    + }
    + }
    +
        /**
         * @return the metastore client for the current thread
         * @throws MetaException
    @@ -3095,7 +3104,24 @@ private void constructOneLBLocationMap(FileStatus fSta,
              LOG.error(msg, e);
              throw new MetaException(msg + "\n" + StringUtils.stringifyException(e));
            }
    - metaStoreClient = createMetaStoreClient();
    + try {
    + metaStoreClient = createMetaStoreClient();
    + } catch (RuntimeException ex) {
    + Throwable t = ex.getCause();
    + while (t != null) {
    + if (t instanceof JDODataStoreException && t.getMessage() != null
    + && t.getMessage().contains("autoCreate")) {
    + LOG.error("Cannot initialize metastore due to autoCreate error", t);
    + // DataNucleus wants us to auto-create, but we shall do no such thing.
    + throw new SchemaException("Hive metastore database is not initialized. Please use "
    + + "schematool (e.g. ./schematool -initSchema -dbType ...) to create the schema. If "
    + + "needed, don't forget to include the option to auto-create the underlying database"
    + + " in your JDBC connection string (e.g. ?createDatabaseIfNotExist=true for mysql)");
    + }
    + t = t.getCause();
    + }
    + throw ex;
    + }
            String metaStoreUris = conf.getVar(HiveConf.ConfVars.METASTOREURIS);
            if (!org.apache.commons.lang3.StringUtils.isEmpty(metaStoreUris)) {
              // get a synchronized wrapper if the meta store is remote.

    http://git-wip-us.apache.org/repos/asf/hive/blob/ecccdda8/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java
    ----------------------------------------------------------------------
    diff --git a/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java b/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java
    index 17634f2..d50b285 100644
    --- a/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java
    +++ b/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java
    @@ -542,6 +542,12 @@ public class SessionState {
                throw new RuntimeException(e);
              }
            }
    + } catch (RuntimeException e) {
    + throw e;
    + } catch (Hive.SchemaException e) {
    + RuntimeException ex = new RuntimeException(e.getMessage());
    + ex.setStackTrace(new StackTraceElement[0]);
    + throw ex;
          } catch (Exception e) {
            // Catch-all due to some exec time dependencies on session state
            // that would cause ClassNoFoundException otherwise

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommits @
categorieshive, hadoop
postedFeb 9, '16 at 1:52a
activeFeb 9, '16 at 1:52a
posts2
users1
websitehive.apache.org

1 user in discussion

Sershe: 2 posts

People

Translate

site design / logo © 2021 Grokbase