You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by sa...@apache.org on 2018/11/06 05:31:39 UTC
[7/8] trafodion git commit: iChanges based on review comments
iChanges based on review comments
Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/d82d650e
Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/d82d650e
Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/d82d650e
Branch: refs/heads/master
Commit: d82d650eeb6c67fc1da622225a24c6b10cdbcb97
Parents: fab3c41
Author: Sandhya Sundaresan <sa...@apache.org>
Authored: Wed Oct 17 04:34:13 2018 +0000
Committer: Sandhya Sundaresan <sa...@apache.org>
Committed: Wed Oct 17 04:34:13 2018 +0000
----------------------------------------------------------------------
core/sqf/sqenvcom.sh | 6 +-
core/sqf/sql/scripts/genms | 8 +-
core/sql/cli/sqlcli.h | 2 +-
core/sql/common/ComMisc.cpp | 59 +++++-----
core/sql/common/ComMisc.h | 2 +-
core/sql/executor/ExExeUtilLoad.cpp | 2 +-
core/sql/executor/ExUdr.cpp | 14 ++-
core/sql/optimizer/UdfDllInteraction.cpp | 10 +-
core/sql/regress/tools/rgrCleanup | 4 +-
core/sql/sqlcat/TrafDDLdesc.cpp | 2 +
core/sql/sqlcomp/CmpDDLCatErrorCodes.h | 3 +-
core/sql/sqlcomp/CmpSeabaseDDL.h | 3 +-
core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp | 5 -
core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp | 142 +------------------------
core/sql/sqlcomp/CmpSeabaseDDLupgrade.cpp | 5 +-
15 files changed, 70 insertions(+), 197 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafodion/blob/d82d650e/core/sqf/sqenvcom.sh
----------------------------------------------------------------------
diff --git a/core/sqf/sqenvcom.sh b/core/sqf/sqenvcom.sh
index 804e03f..7cb9fd5 100644
--- a/core/sqf/sqenvcom.sh
+++ b/core/sqf/sqenvcom.sh
@@ -113,10 +113,10 @@ export MAKEFLAGS="-j$cpucnt"
if [ -z "$TOOLSDIR" ]; then
if [[ -n "$CLUSTERNAME" ]]; then
export TOOLSDIR=${TOOLSDIR:-/home/tools}
- export MY_UDR_ROOT=/home/udr
+ export UDR_ROOT=/home/udr
else
export TOOLSDIR=${TOOLSDIR:-/opt/home/tools}
- export MY_UDR_ROOT=$PWD
+ export UDR_ROOT=$PWD
fi
fi
@@ -207,7 +207,7 @@ export DTM_COMMON_JAR=trafodion-dtm-cdh-${TRAFODION_VER}.jar
export SQL_JAR=trafodion-sql-cdh-${TRAFODION_VER}.jar
export UTIL_JAR=trafodion-utility-${TRAFODION_VER}.jar
export JDBCT4_JAR=jdbcT4-${TRAFODION_VER}.jar
-export MY_UDR_CACHE_LIBDIR=cached_libs
+export UDR_CACHE_LIBDIR=cached_libs
if [[ "$HBASE_DISTRO" == "HDP" ]]; then
http://git-wip-us.apache.org/repos/asf/trafodion/blob/d82d650e/core/sqf/sql/scripts/genms
----------------------------------------------------------------------
diff --git a/core/sqf/sql/scripts/genms b/core/sqf/sql/scripts/genms
index 794e2e2..de66199 100755
--- a/core/sqf/sql/scripts/genms
+++ b/core/sqf/sql/scripts/genms
@@ -168,22 +168,22 @@ echo "SQ_PROPS_TDM_ARKESP=tdm_arkesp.env"
echo ""
echo "STFS_HDD_LOCATION=\$TRAF_VAR"
echo ""
-echo "#setting MY_UDR_ROOT"
+echo "#setting UDR_ROOT"
if [ -d "/home/udr" ]; then
w=`whoami`
dircreate=/home/udr/$w
if [ ! -d $dircreate ]; then
mkdir --mode=775 $dircreate 2>/dev/null
fi
- echo "MY_UDR_ROOT=$dircreate"
+ echo "UDR_ROOT=$dircreate"
else
if [ ! -d "$TRAF_HOME/udr" ]; then
mkdir $TRAF_HOME/udr 2>/dev/null
fi
- echo "MY_UDR_ROOT=\$TRAF_HOME/udr"
+ echo "UDR_ROOT=\$TRAF_HOME/udr"
fi
-echo "MY_UDR_CACHE_LIBDIR=cached_libs"
+echo "UDR_CACHE_LIBDIR=cached_libs"
echo ""
echo "#creating sqllogs folder for capturing osim data"
http://git-wip-us.apache.org/repos/asf/trafodion/blob/d82d650e/core/sql/cli/sqlcli.h
----------------------------------------------------------------------
diff --git a/core/sql/cli/sqlcli.h b/core/sql/cli/sqlcli.h
index d01048e..8f8dd42 100644
--- a/core/sql/cli/sqlcli.h
+++ b/core/sql/cli/sqlcli.h
@@ -1,4 +1,4 @@
-/*********************************************************************y
+/*********************************************************************
// @@@ START COPYRIGHT @@@
//
// Licensed to the Apache Software Foundation (ASF) under one
http://git-wip-us.apache.org/repos/asf/trafodion/blob/d82d650e/core/sql/common/ComMisc.cpp
----------------------------------------------------------------------
diff --git a/core/sql/common/ComMisc.cpp b/core/sql/common/ComMisc.cpp
index baa3a00..3ea50d5 100644
--- a/core/sql/common/ComMisc.cpp
+++ b/core/sql/common/ComMisc.cpp
@@ -372,7 +372,8 @@ Int32 ComGenerateUdrCachedLibName(NAString libname,Int64 redeftime, NAString sc
libPrefix = libname(0,lastDot);
}
- //when isolated user support is added
+ //when isolated user support is added we will pass an actual userid.
+ //By default we assume DB__ROOT.
if (userid.length()!=0)
{
@@ -382,17 +383,7 @@ Int32 ComGenerateUdrCachedLibName(NAString libname,Int64 redeftime, NAString sc
{
if (mkdir(cachedLibPath,S_IRWXU|S_IRWXG|S_IRWXO))
{
- return -1;
- }
-
- }
- cachedLibPath += "/";
- cachedLibPath += getenv("MY_UDR_CACHE_LIBDIR");
- if ( stat(cachedLibPath, &statbuf) != 0)
- {
- if (mkdir(cachedLibPath,S_IRWXU|S_IRWXG|S_IRWXO))
- {
- return -1;
+ return errno;
}
}
@@ -402,61 +393,73 @@ Int32 ComGenerateUdrCachedLibName(NAString libname,Int64 redeftime, NAString sc
if (mkdir(cachedLibPath,S_IRUSR|S_IWUSR|S_IXUSR))//Only this user has
//permission to read/write/execute in this directory and below.
{
- return -1;
+ return errno;
}
}
- cachedLibPath += "/" + schemaName;
+ cachedLibPath += "/";
+ cachedLibPath += getenv("UDR_CACHE_LIBDIR");
if ( stat(cachedLibPath, &statbuf) != 0)
{
if (mkdir(cachedLibPath,S_IRWXU|S_IRWXG|S_IRWXO))
{
- return -1;
+ return errno;
}
}
-
- }
- else
- {
- cachedLibPath = getenv("TRAF_HOME") ;
- cachedLibPath += "/udr";
+ cachedLibPath += "/" + schemaName;
if ( stat(cachedLibPath, &statbuf) != 0)
{
if (mkdir(cachedLibPath,S_IRWXU|S_IRWXG|S_IRWXO))
{
- return -1;
+ return errno;
}
}
- cachedLibPath += "/";
- cachedLibPath += getenv("MY_UDR_CACHE_LIBDIR");
+
+
+ }
+ else
+ {
+ cachedLibPath = getenv("TRAF_HOME") ;
+ cachedLibPath += "/udr";
if ( stat(cachedLibPath, &statbuf) != 0)
{
if (mkdir(cachedLibPath,S_IRWXU|S_IRWXG|S_IRWXO))
{
- return -1;
+ return errno;
}
}
cachedLibPath += "/"+ NAString("DB__ROOT") ;
if (stat(cachedLibPath, &statbuf) != 0)
{
- if (mkdir(cachedLibPath,S_IRWXU|S_IRWXG|S_IRWXO)) // these permissions
+ if (mkdir(cachedLibPath,S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)) // these permissions
//need to change when we have isolated user support so only DB_ROOT
//can access this directory. Right now we allow all to access this directory
{
- return -1;
+ return errno;
}
}
+ cachedLibPath += "/";
+ cachedLibPath += getenv("UDR_CACHE_LIBDIR");
+ if ( stat(cachedLibPath, &statbuf) != 0)
+ {
+ if (mkdir(cachedLibPath,S_IRWXU|S_IRWXG|S_IRWXO))
+ {
+ return errno;
+ }
+
+ }
+
cachedLibPath += "/" + schemaName;
if ( stat(cachedLibPath, &statbuf) != 0)
{
if (mkdir(cachedLibPath,S_IRWXU|S_IRWXG|S_IRWXO))
{
- return -1;
+ return errno;
}
}
http://git-wip-us.apache.org/repos/asf/trafodion/blob/d82d650e/core/sql/common/ComMisc.h
----------------------------------------------------------------------
diff --git a/core/sql/common/ComMisc.h b/core/sql/common/ComMisc.h
index 7b1cebb..d13832e 100644
--- a/core/sql/common/ComMisc.h
+++ b/core/sql/common/ComMisc.h
@@ -113,7 +113,7 @@ NAString ComConvertTrafHiveNameToNativeHiveName(
NABoolean ComTrafReservedColName(const NAString &colName);
// Converts a library name like myfile.jar or myfile.so to this format
-// $TRAF_HOME/$MY_UDR_CACHE_LIBDIR/<user>|public/myfile_<redeftime>.jar|so
+// $TRAF_HOME/$UDR_CACHE_LIBDIR/<user>|myfile_<redeftime>.jar|so
Int32 ComGenerateUdrCachedLibName(NAString libname,Int64 redeftime,NAString schemaName, NAString user, NAString&cachedLibName, NAString &cachedPathName );
http://git-wip-us.apache.org/repos/asf/trafodion/blob/d82d650e/core/sql/executor/ExExeUtilLoad.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExeUtilLoad.cpp b/core/sql/executor/ExExeUtilLoad.cpp
index ff4564b..436f2d2 100644
--- a/core/sql/executor/ExExeUtilLoad.cpp
+++ b/core/sql/executor/ExExeUtilLoad.cpp
@@ -3291,7 +3291,7 @@ short ExExeUtilLobExtractTcb::work()
short ExExeUtilLobExtractLibrary(ExeCliInterface *cliInterface,char *libHandle, char *cachedLibName,ComDiagsArea *toDiags)
{
- char buf[1000];
+ char buf[strlen(cachedLibName) + strlen(libHandle)+200];
Int32 cliRC =0;
str_sprintf(buf, "extract lobtofile(LOB '%s','%s');",libHandle,cachedLibName);
http://git-wip-us.apache.org/repos/asf/trafodion/blob/d82d650e/core/sql/executor/ExUdr.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExUdr.cpp b/core/sql/executor/ExUdr.cpp
index fc2686a..45f90cc 100644
--- a/core/sql/executor/ExUdr.cpp
+++ b/core/sql/executor/ExUdr.cpp
@@ -808,6 +808,7 @@ Int32 ExUdrTcb::fixup()
libOrJarName = myTdb().getPathName();
else
libOrJarName = myTdb().getContainerName();
+ Int32 err = 0;
if(ComGenerateUdrCachedLibName(libOrJarName.data(),
myTdb().getLibraryRedefTime(),
myTdb().getLibrarySchName(),
@@ -815,9 +816,16 @@ Int32 ExUdrTcb::fixup()
cachedLibName, cachedLibPath))
{
NAString cachedFullName = cachedLibPath+"/"+cachedLibName;
- *getOrCreateStmtDiags() << DgSqlCode(-4316)
- << DgString0(( char *)cachedFullName.data());;
- return FIXUP_ERROR;
+ char errString[200];
+ NAString errNAString;
+ sprintf(errString , "Error %d creating directory :",err);
+ errNAString = errString;
+ errNAString += cachedFullName;
+
+
+ *getOrCreateStmtDiags() << DgSqlCode(-4316)
+ << DgString0(( char *)errNAString.data());
+ return FIXUP_ERROR;
}
NAString cachedFullName = cachedLibPath+"/"+cachedLibName;
//If the local copy already exists, don't bother extracting.
http://git-wip-us.apache.org/repos/asf/trafodion/blob/d82d650e/core/sql/optimizer/UdfDllInteraction.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/UdfDllInteraction.cpp b/core/sql/optimizer/UdfDllInteraction.cpp
index 951833d..b7444cb 100644
--- a/core/sql/optimizer/UdfDllInteraction.cpp
+++ b/core/sql/optimizer/UdfDllInteraction.cpp
@@ -151,15 +151,21 @@ NABoolean TMUDFDllInteraction::describeParamsAndMaxOutputs(
libOrJarName = routine->getExternalPath();
else
libOrJarName = routine->getContainerName();
- if(ComGenerateUdrCachedLibName(libOrJarName.data(),
+ Int32 err = 0;
+ if(err = ComGenerateUdrCachedLibName(libOrJarName.data(),
routine->getLibRedefTime(),
routine->getLibSchName(),
dummyUser,
cachedLibName, cachedLibPath))
{
NAString cachedFullName = cachedLibPath+"/"+cachedLibName;
+ char errString[200];
+ NAString errNAString;
+ sprintf(errString , "Error %d creating directory :",err);
+ errNAString = errString;
+ errNAString += cachedFullName;
*CmpCommon::diags() << DgSqlCode(-4316)
- << DgString0(( char *)cachedFullName.data());
+ << DgString0(( char *)errNAString.data());
bindWA->setErrStatus();
return FALSE;
}
http://git-wip-us.apache.org/repos/asf/trafodion/blob/d82d650e/core/sql/regress/tools/rgrCleanup
----------------------------------------------------------------------
diff --git a/core/sql/regress/tools/rgrCleanup b/core/sql/regress/tools/rgrCleanup
index 452a6ec..c99de5b 100755
--- a/core/sql/regress/tools/rgrCleanup
+++ b/core/sql/regress/tools/rgrCleanup
@@ -1,4 +1,4 @@
#temp solution to cleanup udr cached files
#can be removed when cleanup mechanism for cached files in implemented
-echo "rm -rf $TRAF_HOME/udr/$MY_UDR_CACHE_LIBDIR/* 2>$NULL"
-rm -rf $TRAF_HOME/udr/$MY_UDR_CACHE_LIBDIR/* 2>$NULL
+echo "rm -rf $TRAF_HOME/udr/*/$UDR_CACHE_LIBDIR/* 2>$NULL"
+rm -rf $TRAF_HOME/udr/*/$UDR_CACHE_LIBDIR/* 2>$NULL
http://git-wip-us.apache.org/repos/asf/trafodion/blob/d82d650e/core/sql/sqlcat/TrafDDLdesc.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcat/TrafDDLdesc.cpp b/core/sql/sqlcat/TrafDDLdesc.cpp
index f54a79e..29788c7 100644
--- a/core/sql/sqlcat/TrafDDLdesc.cpp
+++ b/core/sql/sqlcat/TrafDDLdesc.cpp
@@ -591,6 +591,7 @@ Long TrafRoutineDesc::pack(void * space)
libraryFileName = (libraryFileName ? (char*)(((Space*)space)->convertToOffset(libraryFileName)) : NULL);
signature = (signature ? (char*)(((Space*)space)->convertToOffset(signature)) : NULL);
libBlobHandle = (libBlobHandle ? (char*)(((Space*)space)->convertToOffset(libBlobHandle)) : NULL);
+ libSchName = (libSchName ? (char*)(((Space*)space)->convertToOffset(libSchName)) : NULL);
params.pack(space);
return TrafDesc::pack(space);
@@ -604,6 +605,7 @@ Lng32 TrafRoutineDesc::unpack(void * base, void * reallocator)
libraryFileName = (libraryFileName ? (char*)((char*)base - (Long)libraryFileName) : NULL);
signature = (signature ? (char*)((char*)base - (Long)signature) : NULL);
libBlobHandle = (libBlobHandle ? (char*)((char*)base - (Long)libBlobHandle) : NULL);
+ libSchName = (libSchName ? (char*)((char*)base - (Long)libSchName) : NULL);
if (params.unpack(base, reallocator)) return -1;
return TrafDesc::unpack(base, reallocator);
http://git-wip-us.apache.org/repos/asf/trafodion/blob/d82d650e/core/sql/sqlcomp/CmpDDLCatErrorCodes.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpDDLCatErrorCodes.h b/core/sql/sqlcomp/CmpDDLCatErrorCodes.h
index 0e385e1..dedd2c4 100644
--- a/core/sql/sqlcomp/CmpDDLCatErrorCodes.h
+++ b/core/sql/sqlcomp/CmpDDLCatErrorCodes.h
@@ -1,5 +1,4 @@
/**********************************************************************
-
// @@@ START COPYRIGHT @@@
//
// Licensed to the Apache Software Foundation (ASF) under one
@@ -69,7 +68,7 @@ enum CatErrorCode { CAT_FIRST_ERROR = 1000
, CAT_CATALOG_ALREADY_EXISTS = 1035
, CAT_CIRCULAR_PRIVS = 1036
, CAT_DEPENDENT_PRIV_EXISTS = 1037
- , CAT_UNABLE_TO_UPGRADE = 1037
+ //unused = 1038
, CAT_PRIVILEGE_NOT_REVOKED = 1039
, CAT_SMD_CANNOT_BE_ALTERED = 1040
, CAT_PRIMARY_KEY_ALREADY_DEFINED = 1041
http://git-wip-us.apache.org/repos/asf/trafodion/blob/d82d650e/core/sql/sqlcomp/CmpSeabaseDDL.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDL.h b/core/sql/sqlcomp/CmpSeabaseDDL.h
index 08ba746..dc0d63b 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDL.h
+++ b/core/sql/sqlcomp/CmpSeabaseDDL.h
@@ -1330,8 +1330,7 @@ protected:
void dropSeabaseLibrary(StmtDDLDropLibrary * dropLibraryNode,
NAString &currCatName, NAString &currSchName);
- void dropSeabaseLibrary2(StmtDDLDropLibrary * dropLibraryNode,
- NAString &currCatName, NAString &currSchName);
+
void alterSeabaseLibrary(StmtDDLAlterLibrary *alterLibraryNode,
NAString &currCatName, NAString &currSchName);
void alterSeabaseLibrary2(StmtDDLAlterLibrary *alterLibraryNode,
http://git-wip-us.apache.org/repos/asf/trafodion/blob/d82d650e/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp b/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
index 8945254..6aaa084 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
@@ -9297,12 +9297,7 @@ short CmpSeabaseDDL::executeSeabaseDDL(DDLExpr * ddlExpr, ExprNode * ddlNode,
// drop seabase library
StmtDDLDropLibrary * dropLibraryParseNode =
ddlNode->castToStmtDDLNode()->castToStmtDDLDropLibrary();
- if( (CmpCommon::getDefault(USE_LIB_BLOB_STORE) == DF_OFF))
dropSeabaseLibrary(dropLibraryParseNode, currCatName, currSchName);
- else
- {
- dropSeabaseLibrary2(dropLibraryParseNode, currCatName, currSchName);
- }
}
else if (ddlNode->getOperatorType() == DDL_ALTER_LIBRARY)
{
http://git-wip-us.apache.org/repos/asf/trafodion/blob/d82d650e/core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp b/core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp
index f6bd227..1501661 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp
@@ -403,6 +403,7 @@ void CmpSeabaseDDL::createSeabaseLibrary(
NADELETEBASIC(query, STMTHEAP);
if (cliRC < 0)
{
+ deallocEHI(ehi);
cliInterface.retrieveSQLDiagnostics(CmpCommon::diags());
processReturn();
return;
@@ -653,148 +654,7 @@ void CmpSeabaseDDL::createSeabaseLibrary2(
return;
}
-void CmpSeabaseDDL::dropSeabaseLibrary2(StmtDDLDropLibrary * dropLibraryNode,
- NAString &currCatName,
- NAString &currSchName)
-{
- Lng32 cliRC = 0;
- Lng32 retcode = 0;
-
- BindWA bindWA(ActiveSchemaDB(), CmpCommon::context(), FALSE/*inDDL*/);
- NARoutineDB *pRoutineDBCache = ActiveSchemaDB()->getNARoutineDB();
- const NAString &objName = dropLibraryNode->getLibraryName();
-
- ComObjectName libraryName(objName);
- ComAnsiNamePart currCatAnsiName(currCatName);
- ComAnsiNamePart currSchAnsiName(currSchName);
- libraryName.applyDefaults(currCatAnsiName, currSchAnsiName);
-
- const NAString catalogNamePart = libraryName.
- getCatalogNamePartAsAnsiString();
- const NAString schemaNamePart = libraryName.
- getSchemaNamePartAsAnsiString(TRUE);
- const NAString objectNamePart = libraryName.
- getObjectNamePartAsAnsiString(TRUE);
- const NAString extLibraryName = libraryName.getExternalName(TRUE);
-
- ExeCliInterface cliInterface(STMTHEAP, 0, NULL,
- CmpCommon::context()->sqlSession()->getParentQid());
-
- ExpHbaseInterface * ehi = allocEHI();
- if (ehi == NULL)
- return;
- retcode = existsInSeabaseMDTable(&cliInterface,
- catalogNamePart, schemaNamePart,
- objectNamePart,
- COM_LIBRARY_OBJECT, TRUE, FALSE);
- if (retcode < 0)
- {
- deallocEHI(ehi);
- processReturn();
- return;
- }
-
- if (retcode == 0) // does not exist
- {
- *CmpCommon::diags() << DgSqlCode(-1389)
- << DgString0(extLibraryName);
- deallocEHI(ehi);
- processReturn();
- return;
- }
-
- Int32 objectOwnerID = 0;
- Int32 schemaOwnerID = 0;
- Int64 objectFlags = 0;
- Int64 objUID = getObjectInfo(&cliInterface,
- catalogNamePart.data(), schemaNamePart.data(),
- objectNamePart.data(), COM_LIBRARY_OBJECT,
- objectOwnerID,schemaOwnerID,objectFlags);
- if (objUID < 0 || objectOwnerID == 0 || schemaOwnerID == 0)
- {
- deallocEHI(ehi);
- processReturn();
- return;
- }
-
- if (!isDDLOperationAuthorized(SQLOperation::DROP_LIBRARY,
- objectOwnerID,
- schemaOwnerID))
- {
- *CmpCommon::diags() << DgSqlCode(-CAT_NOT_AUTHORIZED);
- processReturn ();
- return;
- }
-
- Queue * usingRoutinesQueue = NULL;
- cliRC = getUsingRoutines(&cliInterface, objUID, usingRoutinesQueue);
- if (cliRC < 0)
- {
- deallocEHI(ehi);
- processReturn();
- return;
- }
- // If RESTRICT and the library is being used, return an error
- if (cliRC != 100 && dropLibraryNode->getDropBehavior() == COM_RESTRICT_DROP_BEHAVIOR)
- {
- *CmpCommon::diags() << DgSqlCode(-CAT_DEPENDENT_ROUTINES_EXIST);
-
- deallocEHI(ehi);
- processReturn();
- return;
- }
-
- usingRoutinesQueue->position();
- for (size_t i = 0; i < usingRoutinesQueue->numEntries(); i++)
- {
- OutputInfo * rou = (OutputInfo*)usingRoutinesQueue->getNext();
-
- char * routineName = rou->get(0);
- ComObjectType objectType = PrivMgr::ObjectLitToEnum(rou->get(1));
-
- if (dropSeabaseObject(ehi, routineName,
- currCatName, currSchName, objectType,
- dropLibraryNode->ddlXns(),
- TRUE, FALSE))
- {
- deallocEHI(ehi);
- processReturn();
- return;
- }
-
- // Remove routine from DBRoutinCache
- ComObjectName objectName(routineName);
- QualifiedName qualRoutineName(objectName, STMTHEAP);
- NARoutineDBKey key(qualRoutineName, STMTHEAP);
- NARoutine *cachedNARoutine = pRoutineDBCache->get(&bindWA, &key);
-
- if (cachedNARoutine)
- {
- Int64 routineUID = *(Int64*)rou->get(2);
- pRoutineDBCache->removeNARoutine(qualRoutineName,
- ComQiScope::REMOVE_FROM_ALL_USERS,
- routineUID,
- dropLibraryNode->ddlXns(), FALSE);
- }
-
- }
-
- // can get a slight perf. gain if we pass in objUID
- if (dropSeabaseObject(ehi, objName,
- currCatName, currSchName, COM_LIBRARY_OBJECT,
- dropLibraryNode->ddlXns(),
- TRUE, FALSE))
- {
- deallocEHI(ehi);
- processReturn();
- return;
- }
-
- deallocEHI(ehi);
- processReturn();
- return;
-}
void CmpSeabaseDDL::dropSeabaseLibrary(StmtDDLDropLibrary * dropLibraryNode,
NAString &currCatName,
NAString &currSchName)
http://git-wip-us.apache.org/repos/asf/trafodion/blob/d82d650e/core/sql/sqlcomp/CmpSeabaseDDLupgrade.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLupgrade.cpp b/core/sql/sqlcomp/CmpSeabaseDDLupgrade.cpp
index fe09364..3871b4b 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLupgrade.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLupgrade.cpp
@@ -325,8 +325,9 @@ short CmpSeabaseMDupgrade::executeSeabaseMDupgrade(CmpDDLwithStatusInfo *mdui,
// interfaces for upgrading subsystems; OK to create on stack for
// now as they are stateless
CmpSeabaseUpgradeRepository upgradeRepository;
- CmpSeabaseUpgradePrivMgr upgradePrivMgr;
CmpSeabaseUpgradeLibraries upgradeLibraries;
+ CmpSeabaseUpgradePrivMgr upgradePrivMgr;
+
ExeCliInterface cliInterface(STMTHEAP, 0, NULL,
CmpCommon::context()->sqlSession()->getParentQid());
ExpHbaseInterface * ehi = NULL;
@@ -1673,7 +1674,7 @@ short CmpSeabaseMDupgrade::executeSeabaseMDupgrade(CmpDDLwithStatusInfo *mdui,
{
*CmpCommon::diags() << DgSqlCode(-20123);
- mdui->setStep(UPGRADE_FAILED_RESTORE_OLD_REPOS);
+ mdui->setStep(UPGRADE_FAILED_RESTORE_OLD_LIBRARIES);
mdui->setSubstep(0);
break;