[ 
https://issues.apache.org/jira/browse/TRAFODION-3216?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16649587#comment-16649587
 ] 

ASF GitHub Bot commented on TRAFODION-3216:
-------------------------------------------

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?


> UDR libraries need to be stored in metadata table as a blob
> -----------------------------------------------------------
>
>                 Key: TRAFODION-3216
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-3216
>             Project: Apache Trafodion
>          Issue Type: Improvement
>          Components: sql-general
>    Affects Versions: 2.4
>            Reporter: Sandhya Sundaresan
>            Assignee: Sandhya Sundaresan
>            Priority: Major
>             Fix For: 2.4
>
>         Attachments: Support for LOB storage in metadata for UDR 
> libraries.docx
>
>
> This is one of many  infrastructure changes for SPJs that was planned. 
>  * {color:#0070c0}Store UDR libraries in BLOBs   {color}
>  * {color:#0070c0}Add BLOB column to library metadata table{color}
>  * {color:#0070c0}Change CREATE LIBRARY command to store library in 
> BLOB{color}
>  * {color:#0070c0}Change library file names to include the timestamp (so 
> updating a library changes the name){color}
>  * {color:#0070c0}Add a cache for libraries (a new directory, 
> $TRAF_HOME/udr/public/lib){color}
>  * {color:#0070c0}Change UDR code to read library from the metadata table 
> when not in cache{color}
>  * {color:#0070c0}Upgrade support{color}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to