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

Drop Index that includes AUTHZ_OBJ_NAME

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.0.0
    • Component/s: Sentry
    • Labels:
      None

      Description

      AUTHZ_OBJ_NAME has (384) chars. It is constructed by sentry from notification event as DB_NAME + "." + TBL_NAME. To be consistent with hive, sentry should use the same char set as what's used by DB_NAME and TBL_NAME

      Besides, if its table char set is utf8, the constrain AUTHZOBJNAME will have error "Specified key was too long; max key length is 767 bytes" for mysql.

      The solution is to drop the index includes this field, so it works for mysql regardless the char set of its table or DB.

      Reference:
      1) CREATE TABLE AUTHZ_PATHS_MAPPING
      (
      AUTHZ_OBJ_ID BIGINT NOT NULL generated always as identity (start with 1),
      AUTHZ_OBJ_NAME VARCHAR(384),
      CREATE_TIME_MS BIGINT NOT NULL
      );

      CREATE UNIQUE INDEX AUTHZOBJNAME ON AUTHZ_PATHS_MAPPING (AUTHZ_OBJ_NAME);

      2) AUTHZ_OBJ_NAME is constructed by sentry from notification event as DB_NAME + "." + TBL_NAME. To be consistent with hive, sentry should use the same char set as what's used by DB_NAME and TBL_NAME in NotificationProcessor.processAlterTable().
      3) hive uses latin1 as default charset for notification event.

      CREATE TABLE IF NOT EXISTS `NOTIFICATION_LOG`
      (
      `NL_ID` BIGINT(20) NOT NULL,
      `EVENT_ID` BIGINT(20) NOT NULL,
      `EVENT_TIME` INT(11) NOT NULL,
      `EVENT_TYPE` varchar(32) NOT NULL,
      `DB_NAME` varchar(128),
      `TBL_NAME` varchar(128),
      `MESSAGE` mediumtext,
      PRIMARY KEY (`NL_ID`)
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

      4) actual installation shows both fields are in latin1 char set.
      SHOW FULL COLUMNS FROM NOTIFICATION_LOG;
      --------------------------------------------------------------------------------------------------

      Field Type Collation Null Key Default Extra Privileges Comment

      --------------------------------------------------------------------------------------------------

      NL_ID bigint(20) NULL NO PRI NULL   select,insert,update,references  
      EVENT_ID bigint(20) NULL NO   NULL   select,insert,update,references  
      EVENT_TIME int(11) NULL NO   NULL   select,insert,update,references  
      EVENT_TYPE varchar(32) latin1_swedish_ci NO   NULL   select,insert,update,references  
      DB_NAME varchar(128) latin1_swedish_ci YES   NULL   select,insert,update,references  
      TBL_NAME varchar(128) latin1_swedish_ci YES   NULL   select,insert,update,references  
      MESSAGE mediumtext latin1_swedish_ci YES   NULL   select,insert,update,references  

      --------------------------------------------------------------------------------------------------

        Attachments

        1. SENTRY-2024.005.patch
          10 kB
          Na Li
        2. SENTRY-2024.004.patch
          10 kB
          Na Li
        3. SENTRY-2024.003.patch
          9 kB
          Na Li
        4. SENTRY-2024.002.patch
          2 kB
          Na Li
        5. SENTRY-2024.002.patch
          2 kB
          Na Li
        6. SENTRY-2024.001.patch
          2 kB
          Na Li
        7. SENTRY-2024.001.patch
          2 kB
          Na Li
        8. SENTRY-2024.001.patch
          2 kB
          Na Li

          Issue Links

            Activity

              People

              • Assignee:
                linaataustin Na Li
                Reporter:
                linaataustin Na Li
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: