Uploaded image for project: 'Sentry (Retired)'
  1. Sentry (Retired)
  2. SENTRY-1270

Improve error handling - Database with malformed URI causes NPE in HMS plugin during DDL

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.7.0
    • 1.8.0, 2.0.0
    • None
    • None

    Description

      Exception:

      Caused by: java.lang.NullPointerException
              at org.apache.sentry.hdfs.MetastorePlugin.applyLocal(MetastorePlugin.java:336)
              at org.apache.sentry.hdfs.MetastorePlugin.processUpdate(MetastorePlugin.java:364)
              at org.apache.sentry.hdfs.MetastorePlugin.notifySentryAndApplyLocal(MetastorePlugin.java:341)
              at org.apache.sentry.hdfs.MetastorePlugin.renameAuthzObject(MetastorePlugin.java:292)
              at org.apache.sentry.binding.metastore.SentryMetastorePostEventListener.renameSentryTablePrivilege(SentryMetastorePostEventListener.java:336)
              at org.apache.sentry.binding.metastore.SentryMetastorePostEventListener.onAlterTable(SentryMetastorePostEventListener.java:194)
              at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.alter_table_core(HiveMetaStore.java:3439)
              ... 21 more
      

      When looking in the HMS database we found:

      SELECT "NAME", "DB_LOCATION_URI" FROM "DBS" WHERE NOT "DB_LOCATION_URI" LIKE 'hdfs://%/%';
      NAME | DB_LOCATION_URI 
      -----------+--------------------
      db_name | hdfs://nameservice1
      (1 row)
      

      Fixed by manually updating the HMS DB:

      UPDATE DBS
      SET DB_LOCATION_URI='hdfs://nameservice1/user/hive/warehouse/db_name.db'
      WHERE DB_ID=12345;
      

      We should handle this more gracefully in Sentry.

      Attachments

        1. SENTRY-1270.0.patch
          2 kB
          Sravya Tirukkovalur
        2. SENTRY-1270.1.patch
          2 kB
          Sravya Tirukkovalur

        Issue Links

          Activity

            People

              sravya Sravya Tirukkovalur
              lskuff Lenni Kuff
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: