Github user DaveBirdsall commented on a diff in the pull request:
https://github.com/apache/trafodion/pull/1728#discussion_r226129024
--- Diff: core/sql/sqludr/SqlUdrPredefLogReader.cpp ---
@@ -530,37 +530,28 @@ void
ReadCppEventsUDFInterface::processData(UDRInvocationInfo &info,
{
char* logrootdir = NULL;
char* confrootdir = NULL;
+
+ logrootdir = getenv("TRAF_LOG");
+ if (strlen(logrootdir) > 1000)
+ throw UDRException(38001, "TRAF_HOME is longer than 1000 characters");
+ std::string logDirName(logrootdir);
+
switch (logLocationIndex)
{
- case 0: // sqroot, for all logs other than dcs
- logrootdir = getenv("TRAF_HOME");
- if (strlen(logrootdir) > 1000)
- throw UDRException(38001, "TRAF_HOME is longer than 1000 characters");
+ case 0: // no sub-directory
break ;
case 1:
- logrootdir = getenv("DCS_INSTALL_DIR");
- if (!logrootdir)
- throw UDRException(38001, "DCS_INSTALL_DIR not set");
- else if (strlen(logrootdir) > 1000)
- throw UDRException(38001, "DCS_INSTALL_DIR is longer than 1000
characters");
+ logDirName += "/dcs";
break ;
case 2:
- logrootdir = getenv("REST_INSTALL_DIR");
- if (!logrootdir)
- throw UDRException(38001, "REST_INSTALL_DIR not set");
- else if (strlen(logrootdir) > 1000)
- throw UDRException(38001, "REST_INSTALL_DIR is longer than 1000
characters");
- break ;
+ logDirName += "/rest";
--- End diff --
You need a "break;" statement after this one, otherwise you fall through to
the default case and raise an exception. This is probably why test udr/TEST002
failed in the regression test run.
---