trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertamarton <...@git.apache.org>
Subject [GitHub] trafodion pull request #1721: [TRAFODION-3216]UDR libraries need to be store...
Date Sun, 14 Oct 2018 23:52:47 GMT
Github user robertamarton commented on a diff in the pull request:

    https://github.com/apache/trafodion/pull/1721#discussion_r225015019
  
    --- Diff: core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp ---
    @@ -1749,7 +2431,124 @@ short CmpSeabaseDDL::grantLibmgrPrivs(ExeCliInterface *cliInterface)
       return 0;
     }
     
    -short CmpSeabaseDDL::upgradeSeabaseLibmgr(ExeCliInterface * cliInterface)
    +short CmpSeabaseDDL::upgradeSeabaseLibmgr(ExeCliInterface * cliInterface)
    +{
    +  if (!ComUser::isRootUserID())
    +    {
    +      *CmpCommon::diags() << DgSqlCode(-CAT_NOT_AUTHORIZED);
    +      return -1;
    +    }
    +
    +  Lng32 cliRC = 0;
    +
    +  cliRC = existsInSeabaseMDTable(cliInterface,
    +                                 getSystemCatalog(), SEABASE_LIBMGR_SCHEMA,
    +                                 SEABASE_LIBMGR_LIBRARY,
    +                                 COM_LIBRARY_OBJECT, TRUE, FALSE);
    +  if (cliRC < 0)
    +    return -1;
    +
    +  if (cliRC == 0) // does not exist
    +    {
    +      // give an error if the Java library does not exist, since that is
    +      // an indication that we never ran
    +      // INITIALIZE TRAFODION, CREATE LIBRARY MANAGEMENT
    +      NAString libraryName(getSystemCatalog());
    +      libraryName + ".\"" + SEABASE_LIBMGR_SCHEMA + "\"" + SEABASE_LIBMGR_LIBRARY;
    +      *CmpCommon::diags() << DgSqlCode(-1389)
    +                          << DgString0(libraryName.data());
    +      return -1;
    +    }
    +
    +  // Update the jar locations for system procedures and functions.  This should 
    +  // be done before adding any new jar's since we use a system procedure to add
    +  // procedures.
    +  NAString jarLocation(getenv("TRAF_HOME"));
    +  jarLocation += "/export/lib";
    +
    +  char queryBuf[1000];
    +
    +  // trafodion-sql_currversion.jar 
    +  Int32 stmtSize = snprintf(queryBuf, sizeof(queryBuf), "update %s.\"%s\".%s  "
    +           "set library_filename = '%s/trafodion-sql-currversion.jar' "
    +           "where library_uid = "
    +           "(select object_uid from %s.\"%s\".%s "
    +           " where object_name = '%s'  and object_type = 'LB')",
    +           getSystemCatalog(),SEABASE_MD_SCHEMA, SEABASE_LIBRARIES, jarLocation.data(),
    +           getSystemCatalog(),SEABASE_MD_SCHEMA, SEABASE_OBJECTS, SEABASE_VALIDATE_LIBRARY);
    +  CMPASSERT(stmtSize < sizeof(queryBuf));
    +
    +  cliRC = cliInterface->executeImmediate(queryBuf);
    +  if (cliRC < 0)
    +    {
    +      cliInterface->retrieveSQLDiagnostics(CmpCommon::diags());
    +      return -1;
    +    }
    +
    +  // lib_mgmt.jar
    +  stmtSize = snprintf(queryBuf, sizeof(queryBuf), "update %s.\"%s\".%s  "
    +           "set library_filename = '%s/lib_mgmt.jar' "
    +           "where library_uid = "
    +           "(select object_uid from %s.\"%s\".%s "
    +           " where object_name = '%s'  and object_type = 'LB')",
    +           getSystemCatalog(),SEABASE_MD_SCHEMA, SEABASE_LIBRARIES, jarLocation.data(),
    +           getSystemCatalog(),SEABASE_MD_SCHEMA, SEABASE_OBJECTS, SEABASE_LIBMGR_LIBRARY);
    +  CMPASSERT(stmtSize < sizeof(queryBuf));
    +
    +  cliRC = cliInterface->executeImmediate(queryBuf);
    +  if (cliRC < 0)
    +    {
    +      cliInterface->retrieveSQLDiagnostics(CmpCommon::diags());
    +      return -1;
    +    }
    +
    +  // libudr_predef.so
    +  NAString dllLocation(getenv("TRAF_HOME"));
    +  dllLocation += "/export/lib64";
    +  if (strcmp(getenv("SQ_MBTYPE"), "64d") == 0)
    +    dllLocation += "d";
    +
    +  stmtSize = snprintf(queryBuf, sizeof(queryBuf), "update %s.\"%s\".%s  "
    +           "set library_filename = '%s/libudr_predef.so' "
    +           "where library_uid = "
    +           "(select object_uid from %s.\"%s\".%s "
    +           " where object_name = '%s'  and object_type = 'LB')",
    +           getSystemCatalog(),SEABASE_MD_SCHEMA, SEABASE_LIBRARIES, dllLocation.data(),
    +           getSystemCatalog(),SEABASE_MD_SCHEMA, SEABASE_OBJECTS, SEABASE_LIBMGR_LIBRARY_CPP);
    +  CMPASSERT(stmtSize < sizeof(queryBuf));
    +
    +  cliRC = cliInterface->executeImmediate(queryBuf);
    +  if (cliRC < 0)
    +    {
    +      cliInterface->retrieveSQLDiagnostics(CmpCommon::diags());
    +      return -1;
    +    }
    --- End diff --
    
    Is it possible to remove the library path updates for system libraries?


---

Mime
View raw message