Skip to content
This repository was archived by the owner on Jun 7, 2021. It is now read-only.

Commit c826bce

Browse files
author
Roberta Marton
committed
Merge [TRAFODION-2249] pr 1517 Cannot use library management SPJs after an upgrade
2 parents 9247656 + e3b01d4 commit c826bce

3 files changed

Lines changed: 76 additions & 0 deletions

File tree

core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,6 +1778,71 @@ short CmpSeabaseDDL::upgradeSeabaseLibmgr(ExeCliInterface * cliInterface)
17781778
return -1;
17791779
}
17801780

1781+
// Update the jar locations for system procedures and functions. This should
1782+
// be done before adding any new jar's since we use a system procedure to add
1783+
// procedures.
1784+
NAString jarLocation(getenv("TRAF_HOME"));
1785+
jarLocation += "/export/lib";
1786+
1787+
char queryBuf[1000];
1788+
1789+
// trafodion-sql_currversion.jar
1790+
Int32 stmtSize = snprintf(queryBuf, sizeof(queryBuf), "update %s.\"%s\".%s "
1791+
"set library_filename = '%s/trafodion-sql-currversion.jar' "
1792+
"where library_uid = "
1793+
"(select object_uid from %s.\"%s\".%s "
1794+
" where object_name = '%s' and object_type = 'LB')",
1795+
getSystemCatalog(),SEABASE_MD_SCHEMA, SEABASE_LIBRARIES, jarLocation.data(),
1796+
getSystemCatalog(),SEABASE_MD_SCHEMA, SEABASE_OBJECTS, SEABASE_VALIDATE_LIBRARY);
1797+
CMPASSERT(stmtSize < sizeof(queryBuf));
1798+
1799+
cliRC = cliInterface->executeImmediate(queryBuf);
1800+
if (cliRC < 0)
1801+
{
1802+
cliInterface->retrieveSQLDiagnostics(CmpCommon::diags());
1803+
return -1;
1804+
}
1805+
1806+
// lib_mgmt.jar
1807+
stmtSize = snprintf(queryBuf, sizeof(queryBuf), "update %s.\"%s\".%s "
1808+
"set library_filename = '%s/lib_mgmt.jar' "
1809+
"where library_uid = "
1810+
"(select object_uid from %s.\"%s\".%s "
1811+
" where object_name = '%s' and object_type = 'LB')",
1812+
getSystemCatalog(),SEABASE_MD_SCHEMA, SEABASE_LIBRARIES, jarLocation.data(),
1813+
getSystemCatalog(),SEABASE_MD_SCHEMA, SEABASE_OBJECTS, SEABASE_LIBMGR_LIBRARY);
1814+
CMPASSERT(stmtSize < sizeof(queryBuf));
1815+
1816+
cliRC = cliInterface->executeImmediate(queryBuf);
1817+
if (cliRC < 0)
1818+
{
1819+
cliInterface->retrieveSQLDiagnostics(CmpCommon::diags());
1820+
return -1;
1821+
}
1822+
1823+
// libudr_predef.so
1824+
NAString dllLocation(getenv("TRAF_HOME"));
1825+
dllLocation += "/export/lib64";
1826+
if (strcmp(getenv("SQ_MBTYPE"), "64d") == 0)
1827+
dllLocation += "d";
1828+
1829+
stmtSize = snprintf(queryBuf, sizeof(queryBuf), "update %s.\"%s\".%s "
1830+
"set library_filename = '%s/libudr_predef.so' "
1831+
"where library_uid = "
1832+
"(select object_uid from %s.\"%s\".%s "
1833+
" where object_name = '%s' and object_type = 'LB')",
1834+
getSystemCatalog(),SEABASE_MD_SCHEMA, SEABASE_LIBRARIES, dllLocation.data(),
1835+
getSystemCatalog(),SEABASE_MD_SCHEMA, SEABASE_OBJECTS, SEABASE_LIBMGR_LIBRARY_CPP);
1836+
CMPASSERT(stmtSize < sizeof(queryBuf));
1837+
1838+
cliRC = cliInterface->executeImmediate(queryBuf);
1839+
if (cliRC < 0)
1840+
{
1841+
cliInterface->retrieveSQLDiagnostics(CmpCommon::diags());
1842+
return -1;
1843+
}
1844+
1845+
17811846
// now check for the C++ library, which was added in Trafodion 2.3
17821847
cliRC = existsInSeabaseMDTable(cliInterface,
17831848
getSystemCatalog(), SEABASE_LIBMGR_SCHEMA,

core/sql/sqlcomp/CmpSeabaseDDLroutine.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
// perform initialize trafodion, upgrade library management
3333
// recommend that new procedures are added in alphabetic order
3434

35+
// If adding a new library, be sure to update upgradeSeabaseLibmgr to
36+
// update jar/dll locations to the new version.
37+
3538
// At this time there is no support to drop or change the signature of an
3639
// existing procedure. Since customers may be using the procedures, it is
3740
// recommended that they not be dropped or changed - instead add new ones

install/python-installer/scripts/traf_start.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,18 @@ def run():
5252
if meta_current != "1":
5353
print 'Initialize trafodion, upgrade'
5454
run_cmd('echo "initialize trafodion, upgrade;" | sqlci > %s' % tmp_file)
55+
56+
# update system library procedures and functions
57+
run_cmd('echo "initialize trafodion, upgrade library management;" | sqlci > %s' %tmp_file)
58+
library_output = cmd_output('cat %s' % tmp_file)
59+
if 'ERROR' in library_output:
60+
err('Failed to initialize trafodion, upgrade library management:\n %s' % library_output)
61+
5562
# other errors
5663
elif 'ERROR' in init_output:
5764
err('Failed to initialize trafodion:\n %s' % init_output)
5865

66+
5967
run_cmd('rm -rf %s' % tmp_file)
6068
if dbcfgs['ldap_security'] == 'Y':
6169
run_cmd('echo "initialize authorization; alter user DB__ROOT set external name \\\"%s\\\";" | sqlci > %s' % (dbcfgs['db_root_user'], tmp_file))

0 commit comments

Comments
 (0)