Merge remote branch 'origin/pr/1721/head' into merge_1721
diff --git a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Address.java b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Address.java
index 2bc145c..7870d58 100644
--- a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Address.java
+++ b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Address.java
@@ -32,6 +32,7 @@
 import java.sql.SQLException;
 import java.util.Locale;
 import java.util.Properties;
+import java.util.regex.Pattern;
 
 final class T4Address extends Address {
 
@@ -140,7 +141,10 @@
 
 	// ----------------------------------------------------------
 	String getUrl() {
-		return urlPrefix + getIPorName() + ':' + getPort().toString() + "/:";
+          if (isIPv6ForPureUrl(getIPorName())){
+              return urlPrefix + '[' + getIPorName() + ']' + ':' + getPort().toString() + "/:";
+          }else
+              return urlPrefix + getIPorName() + ':' + getPort().toString() + "/:";
 	} // end getProps()
 
 	// ----------------------------------------------------------
@@ -167,7 +171,8 @@
 		int hostStartIndex = urlPrefix.length();
 		int hostEndIndex = -1;
 		if (isIPV6(url)) {
-			hostEndIndex = url.lastIndexOf(']', hostStartIndex); // IP6
+			hostStartIndex = hostStartIndex + 1;
+			hostEndIndex = url.lastIndexOf(']'); // IP6
 		} else {
 			hostEndIndex = url.indexOf(':', hostStartIndex); // IP4
 
@@ -201,12 +206,24 @@
 	 * @return port string
 	 */
 	private String extractPortFromUrl(String url) throws SQLException {
-		int portStartIndex = url.indexOf(':', urlPrefix.length()) + 1;
-		int portEndIndex = url.indexOf('/', portStartIndex);
-		if (portEndIndex < 0) {
-			portEndIndex = url.length();
+		int portStartIndex = 0;
+		int portEndIndex = 0;
+		if (isIPV6(url)){
+			portStartIndex = url.indexOf(':', url.indexOf(']')) + 1;
+			portEndIndex = url.indexOf('/', portStartIndex);
+			if (portEndIndex < 0) {
+				portEndIndex = url.length();
 
+			}
+		}else{
+			portStartIndex = url.indexOf(':', urlPrefix.length()) + 1;
+			portEndIndex = url.indexOf('/', portStartIndex);
+			if (portEndIndex < 0) {
+				portEndIndex = url.length();
+
+			}
 		}
+
 		String port = url.substring(portStartIndex, portEndIndex);
 		if (port.length() < 1) {
 			throw new SQLException("Incorrect port value in the URL.");
@@ -303,13 +320,40 @@
 	 * @return true if the address is a IP address
 	 */
 	private boolean isIPAddress(String IPorName) {
-		// Minimum length = 7; 1.1.1.1
-		if (IPorName.length() < 7)
-			return false;
-		//
-		// If first letter is a digit or ":" (i.e. IPv6), I'll assume it is an
-		// IP address
-		//
-		return (Character.isDigit(IPorName.charAt(0)) || (IPorName.charAt(1) == ':'));
+
+		return isIPv4(IPorName) || isIPv6ForPureUrl(IPorName);
 	}
+
+	public boolean isIPv4(String str) {
+		if (!Pattern.matches("[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+", str))
+			return false;
+		else {
+			String[] arrays = str.split("\\.");
+			if (Integer.parseInt(arrays[0]) < 256 && arrays[0].length() <= 3
+					&& Integer.parseInt(arrays[1]) < 256 && arrays[1].length() <= 3
+					&& Integer.parseInt(arrays[2]) < 256 && arrays[2].length() <= 3
+					&& Integer.parseInt(arrays[3]) < 256 && arrays[3].length() <= 3)
+				return true;
+			else return false;
+		}
+	}
+
+	public boolean isIPv6ForPureUrl(String str) {
+
+		return isIPV6Std(str) || isIPV6Compress(str);
+	}
+
+	public boolean isIPV6Std(String str) {
+		if (!Pattern.matches("^(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$", str))
+			return false;
+		return true;
+	}
+
+	public boolean isIPV6Compress(String str) {
+		if (!Pattern.matches(                "^((?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)?)::((?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)?)$", str))
+			return false;
+		return true;
+	}
+
+
 } // end class Address
diff --git a/core/conn/odb/build.bat b/core/conn/odb/build.bat
index e81a79c..60a058b 100644
--- a/core/conn/odb/build.bat
+++ b/core/conn/odb/build.bat
@@ -57,10 +57,10 @@
 
 ISCC.exe /Q %BUILDDIR%\installer.iss
 
-copy /Y %BUILDDIR%\Output\TRAFODB-2.2.0.exe %PACKDIR%
+copy /Y %BUILDDIR%\Output\TRAFODB-2.3.0.exe %PACKDIR%
 @echo on
 
-if exist %PACKDIR%\TRAFODB-2.2.0.exe (
+if exist %PACKDIR%\TRAFODB-2.3.0.exe (
 	set ALL_SUCCESS=1
 )
 
diff --git a/core/conn/odb/installer.iss b/core/conn/odb/installer.iss
index e2278bd..020c8cc 100644
--- a/core/conn/odb/installer.iss
+++ b/core/conn/odb/installer.iss
@@ -18,8 +18,8 @@
 ; Script generated by the Inno Setup Script Wizard.
 ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
 
-#define MyAppName "Trafodion ODB 2.2"
-#define MyAppVersion "2.2.0"
+#define MyAppName "Trafodion ODB 2.3"
+#define MyAppVersion "2.3.0"
 #define MyAppPublisher "Apache Trafodion"
 #define MyAppURL "http://trafodion.apache.org/"
 #define MyAppExeName "odb.exe"
@@ -131,4 +131,4 @@
       Result := False; //when older version present and not uninstalled
   end;
 
-end;
\ No newline at end of file
+end;
diff --git a/core/conn/odbc/src/odbc/nsksrvr/Interface/Listener_srvr.cpp b/core/conn/odbc/src/odbc/nsksrvr/Interface/Listener_srvr.cpp
index a31b51b..29fc422 100644
--- a/core/conn/odbc/src/odbc/nsksrvr/Interface/Listener_srvr.cpp
+++ b/core/conn/odbc/src/odbc/nsksrvr/Interface/Listener_srvr.cpp
@@ -36,7 +36,7 @@
 	m_port = 0;
 	m_TraceCount = 0;
 	m_tcpip_operation = CURR_UNDEFINED;
-	m_bIPv4 = true;
+	m_bIPv4 = false;
 	m_TcpProcessName[0] = 0;
 	doingRequest = new SB_Thread::Errorcheck_Mutex(true);
 	pipefd[0] = 0; //read fd
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/ConsoleReader.java b/core/conn/trafci/src/main/java/org/trafodion/ci/ConsoleReader.java
index 4e421c4..6f309b1 100644
--- a/core/conn/trafci/src/main/java/org/trafodion/ci/ConsoleReader.java
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/ConsoleReader.java
@@ -123,6 +123,7 @@
           cr = new jline.console.ConsoleReader();
           cr.setPrompt(this.prompt);
           cr.setHandleUserInterrupt(true);
+          cr.setExpandEvents(false);
       }
    }
 
diff --git a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/charsetconv.cpp b/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/charsetconv.cpp
index 2f96082..7ad21d1 100644
--- a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/charsetconv.cpp
+++ b/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/charsetconv.cpp
@@ -298,6 +298,10 @@
 		}
 		memcpy(outputStr, inputStr, inputSize);
 		outputStr[inputSize]=0;
+        if (charCount)
+        {
+            *charCount = inputSize;
+        }
 		return inputSize;
 	}
 	
diff --git a/core/dbsecurity/auth/src/authEvents.cpp b/core/dbsecurity/auth/src/authEvents.cpp
index b63d2e5..a342a39 100644
--- a/core/dbsecurity/auth/src/authEvents.cpp
+++ b/core/dbsecurity/auth/src/authEvents.cpp
@@ -56,7 +56,7 @@
 // ****************************************************************************
 // function authInitEventLog()
 //
-// This function create a new log in $TRAF_HOME/logs directory with the 
+// This function create a new log in $TRAF_LOG directory with the 
 // following name dbsecurity_<host>_<pid>.log
 //
 // It is called for standalone executables (e.g. ldapcheck) to log issues
diff --git a/core/rest/bin/rest b/core/rest/bin/rest
index 96d9ec5..0b49b4a 100755
--- a/core/rest/bin/rest
+++ b/core/rest/bin/rest
@@ -163,7 +163,7 @@
 
 # default log directory & file
 if [ "$REST_LOG_DIR" = "" ]; then
-  REST_LOG_DIR="$REST_HOME/logs"
+  REST_LOG_DIR="$TRAF_LOG/rest"
 fi
 if [ "$REST_LOGFILE" = "" ]; then
   REST_LOGFILE='rest.log'
diff --git a/core/rest/bin/rest-daemon.sh b/core/rest/bin/rest-daemon.sh
index fcc0d16..e7f3cc4 100755
--- a/core/rest/bin/rest-daemon.sh
+++ b/core/rest/bin/rest-daemon.sh
@@ -98,12 +98,12 @@
 
 # get log directory
 if [ "$REST_LOG_DIR" = "" ]; then
-  export REST_LOG_DIR="$REST_HOME/logs"
+  export REST_LOG_DIR="$TRAF_LOG/rest"
 fi
 mkdir -p "$REST_LOG_DIR"
 
 if [ "$REST_PID_DIR" = "" ]; then
-  REST_PID_DIR="$REST_HOME/tmp"
+  REST_PID_DIR="$TRAF_VAR"
 fi
 
 #if [ "$REST_IDENT_STRING" = "" ]; then
diff --git a/core/rest/conf/rest-env.sh b/core/rest/conf/rest-env.sh
index 340c171..7134093 100644
--- a/core/rest/conf/rest-env.sh
+++ b/core/rest/conf/rest-env.sh
@@ -79,8 +79,8 @@
 # Extra ssh options.  Empty by default.
 # export REST_SSH_OPTS="-o ConnectTimeout=1 -o SendEnv=REST_CONF_DIR"
 
-# Where log files are stored.  $REST_HOME/logs by default.
-# export REST_LOG_DIR=${REST_HOME}/logs
+# Where log files are stored.  $TRAF_LOG/rest by default.
+# export REST_LOG_DIR=$TRAF_LOG/rest
 
 # Enable remote JDWP debugging of major rest processes. Meant for Core Developers 
 # export REST_RESET_OPTS="$REST_RESET_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8072"
@@ -92,4 +92,4 @@
 # export REST_NICENESS=10
 
 # The directory where pid files are stored. $REST_HOME/tmp by default.
-# export REST_PID_DIR=/var/rest/pids
\ No newline at end of file
+# export REST_PID_DIR=/var/rest/pids
diff --git a/core/rest/src/main/asciidoc/_chapters/troubleshooting.adoc b/core/rest/src/main/asciidoc/_chapters/troubleshooting.adoc
index edc2182..31ae58f 100644
--- a/core/rest/src/main/asciidoc/_chapters/troubleshooting.adoc
+++ b/core/rest/src/main/asciidoc/_chapters/troubleshooting.adoc
@@ -34,8 +34,8 @@
 == Logs
 The key process logs are as follows...(replace <user> with the user that started the service, <instance> for the server instance and <hostname> for the machine name)
  
-* $REST_INSTALL_DIR/logs/rest-<user>-<instance>-rest-<hostname>.log
-* $REST_INSTALL_DIR/logs/rest-<user>-<instance>-rest-<hostname>.out
+* $TRAF_LOG/rest/rest-<user>-<instance>-rest-<hostname>.log
+* $TRAF_LOG/rest/rest-<user>-<instance>-rest-<hostname>.out
 
 The logs are your best resource when troubleshooting the REST server.
 
diff --git a/core/sqf/.gitignore b/core/sqf/.gitignore
index a8425d5..f9c7191 100644
--- a/core/sqf/.gitignore
+++ b/core/sqf/.gitignore
@@ -51,11 +51,7 @@
 /logs/
 /sqcert/
 /sql/scripts/sqconfig.db
-/sql/scripts/*.log
-/sql/scripts/*.out
 /sql/scripts/sqshell.env
-/sql/scripts/sq*.exit_status
-/sql/scripts/stdout_*
 /tmp/
 
 # sql regressions
diff --git a/core/sqf/conf/log4cxx.monitor.mon.config b/core/sqf/conf/log4cxx.monitor.mon.config
index ce32e16..96b7b38 100644
--- a/core/sqf/conf/log4cxx.monitor.mon.config
+++ b/core/sqf/conf/log4cxx.monitor.mon.config
@@ -22,7 +22,7 @@
 #
 
 # Define some default values that can be overridden by system properties
-trafodion.log.dir=${TRAF_HOME}/logs
+trafodion.log.dir=${TRAF_LOG}
 trafodion.log.filename.suffix=${TRAFODION_LOG_FILENAME_SUFFIX}
 
 # Logging Threshold
diff --git a/core/sqf/conf/log4cxx.monitor.psd.config b/core/sqf/conf/log4cxx.monitor.psd.config
index 394a2e3..787d408 100644
--- a/core/sqf/conf/log4cxx.monitor.psd.config
+++ b/core/sqf/conf/log4cxx.monitor.psd.config
@@ -22,7 +22,7 @@
 #
 
 # Define some default values that can be overridden by system properties
-trafodion.log.dir=${TRAF_HOME}/logs
+trafodion.log.dir=${TRAF_LOG}
 trafodion.log.filename.suffix=${TRAFODION_LOG_FILENAME_SUFFIX}
 
 # Logging Threshold
diff --git a/core/sqf/conf/log4cxx.monitor.trafns.config b/core/sqf/conf/log4cxx.monitor.trafns.config
index 2fd23e8..7bc00b7 100644
--- a/core/sqf/conf/log4cxx.monitor.trafns.config
+++ b/core/sqf/conf/log4cxx.monitor.trafns.config
@@ -22,7 +22,7 @@
 #
 
 # Define some default values that can be overridden by system properties
-trafodion.log.dir=${TRAF_HOME}/logs
+trafodion.log.dir=${TRAF_LOG}
 trafodion.log.filename.suffix=${TRAFODION_LOG_FILENAME_SUFFIX}
 
 # Logging Threshold
diff --git a/core/sqf/conf/log4cxx.monitor.wdg.config b/core/sqf/conf/log4cxx.monitor.wdg.config
index 40b3af6..a3ab708 100644
--- a/core/sqf/conf/log4cxx.monitor.wdg.config
+++ b/core/sqf/conf/log4cxx.monitor.wdg.config
@@ -22,7 +22,7 @@
 #
 
 # Define some default values that can be overridden by system properties
-trafodion.log.dir=${TRAF_HOME}/logs
+trafodion.log.dir=${TRAF_LOG}
 trafodion.log.filename.suffix=${TRAFODION_LOG_FILENAME_SUFFIX}
 
 # Logging Threshold
diff --git a/core/sqf/conf/log4cxx.trafodion.auth.config b/core/sqf/conf/log4cxx.trafodion.auth.config
index 97e8ce9..ae8e5c9 100644
--- a/core/sqf/conf/log4cxx.trafodion.auth.config
+++ b/core/sqf/conf/log4cxx.trafodion.auth.config
@@ -23,7 +23,7 @@
 
 # Define some default values that can be overridden by system properties
 trafodion.root.logger=INFO, authAppender
-trafodion.log.dir=${TRAF_HOME}/logs
+trafodion.log.dir=${TRAF_LOG}
 trafodion.log.filename.suffix=${TRAFODION_LOG_FILENAME_SUFFIX}
 
 # Define the root logger to the system property "trafodion.root.logger".
diff --git a/core/sqf/conf/log4cxx.trafodion.masterexe.config b/core/sqf/conf/log4cxx.trafodion.masterexe.config
index 97cdc2d..1519570 100644
--- a/core/sqf/conf/log4cxx.trafodion.masterexe.config
+++ b/core/sqf/conf/log4cxx.trafodion.masterexe.config
@@ -22,7 +22,7 @@
 #
 
 # Define some default values that can be overridden by system properties
-trafodion.log.dir=${TRAF_HOME}/logs
+trafodion.log.dir=${TRAF_LOG}
 trafodion.log.filename.suffix=${TRAFODION_LOG_FILENAME_SUFFIX}
 
 # Logging Threshold
diff --git a/core/sqf/conf/log4cxx.trafodion.sql.config b/core/sqf/conf/log4cxx.trafodion.sql.config
index f53df69..a6f9e11 100644
--- a/core/sqf/conf/log4cxx.trafodion.sql.config
+++ b/core/sqf/conf/log4cxx.trafodion.sql.config
@@ -22,7 +22,7 @@
 #
 
 # Define some default values that can be overridden by system properties
-trafodion.log.dir=${TRAF_HOME}/logs
+trafodion.log.dir=${TRAF_LOG}
 trafodion.log.filename.suffix=${TRAFODION_LOG_FILENAME_SUFFIX}
 
 # Logging Threshold
diff --git a/core/sqf/conf/log4cxx.trafodion.sscp.config b/core/sqf/conf/log4cxx.trafodion.sscp.config
index 4d4e5cf..2308bed 100644
--- a/core/sqf/conf/log4cxx.trafodion.sscp.config
+++ b/core/sqf/conf/log4cxx.trafodion.sscp.config
@@ -22,7 +22,7 @@
 #
 
 # Define some default values that can be overridden by system properties
-trafodion.log.dir=${TRAF_HOME}/logs
+trafodion.log.dir=${TRAF_LOG}
 trafodion.log.filename.suffix=${TRAFODION_LOG_FILENAME_SUFFIX}
 
 # Logging Threshold
diff --git a/core/sqf/conf/log4cxx.trafodion.ssmp.config b/core/sqf/conf/log4cxx.trafodion.ssmp.config
index f751b64..e0ec9dc 100644
--- a/core/sqf/conf/log4cxx.trafodion.ssmp.config
+++ b/core/sqf/conf/log4cxx.trafodion.ssmp.config
@@ -22,7 +22,7 @@
 #
 
 # Define some default values that can be overridden by system properties
-trafodion.log.dir=${TRAF_HOME}/logs
+trafodion.log.dir=${TRAF_LOG}
 trafodion.log.filename.suffix=${TRAFODION_LOG_FILENAME_SUFFIX}
 
 # Logging Threshold
diff --git a/core/sqf/conf/log4cxx.trafodion.tm.config b/core/sqf/conf/log4cxx.trafodion.tm.config
index 8c193ec..5e99afb 100644
--- a/core/sqf/conf/log4cxx.trafodion.tm.config
+++ b/core/sqf/conf/log4cxx.trafodion.tm.config
@@ -22,7 +22,7 @@
 #
 
 # Define some default values that can be overridden by system properties
-trafodion.log.dir=${TRAF_HOME}/logs
+trafodion.log.dir=${TRAF_LOG}
 trafodion.log.filename.suffix=${TRAFODION_LOG_FILENAME_SUFFIX}
 
 # Logging Threshold
diff --git a/core/sqf/conf/log4j.dtm.config b/core/sqf/conf/log4j.dtm.config
index feaf588..d4247c1 100644
--- a/core/sqf/conf/log4j.dtm.config
+++ b/core/sqf/conf/log4j.dtm.config
@@ -22,7 +22,7 @@
 #
 
 # Define some default values that can be overridden by system properties
-dtm.log.dir=${trafodion.root}/logs
+dtm.log.dir=${TRAF_LOG}
 dtm.log.file=trafodion.dtm.log
 
 # Logging Threshold
diff --git a/core/sqf/conf/log4j.sql.config b/core/sqf/conf/log4j.sql.config
index 909ba64..6b2ed43 100644
--- a/core/sqf/conf/log4j.sql.config
+++ b/core/sqf/conf/log4j.sql.config
@@ -22,7 +22,7 @@
 #
 
 # Define some default values that can be overridden by system properties
-trafodion.sql.log=${trafodion.root}/logs/trafodion.sql.java.log
+trafodion.sql.log=${TRAF_LOG}/trafodion.sql.java.log
 
 # Logging Threshold
 log4j.threshhold=ALL
diff --git a/core/sqf/export/share/man/man1/sqcore.1 b/core/sqf/export/share/man/man1/sqcore.1
index d727c2c..d404420 100644
--- a/core/sqf/export/share/man/man1/sqcore.1
+++ b/core/sqf/export/share/man/man1/sqcore.1
@@ -40,7 +40,7 @@
 .SH USAGE
 .TP 7
 .BI -d
-Head node directory where the core files are to be moved. (Default $TRAF_HOME/logs)
+Head node directory where the core files are to be moved. (Default $TRAF_LOG)
 .TP
 .BI -h
 will display help.
diff --git a/core/sqf/monitor/linux/monitor.cxx b/core/sqf/monitor/linux/monitor.cxx
index 2ad0528..799fb61 100755
--- a/core/sqf/monitor/linux/monitor.cxx
+++ b/core/sqf/monitor/linux/monitor.cxx
@@ -1574,26 +1574,26 @@
     // We create a standard output file here.
     if ( IsRealCluster )
     {
-        snprintf(fname, sizeof(fname), "%s/logs/trafns.%s.log",
-                 getenv("TRAF_HOME"), Node_name);
+        snprintf(fname, sizeof(fname), "%s/trafns.%s.log",
+                 getenv("TRAF_LOG"), Node_name);
     }
     else
     {
-        snprintf(fname, sizeof(fname), "%s/logs/trafns.%d.%s.log",
-                 getenv("TRAF_HOME"), MyPNID, Node_name);
+        snprintf(fname, sizeof(fname), "%s/trafns.%d.%s.log",
+                 getenv("TRAF_LOG"), MyPNID, Node_name);
     }
 #else
     // Without mpi daemon the monitor has no default standard output.
     // We create a standard output file here.
     if ( IsRealCluster )
     {
-        snprintf(fname, sizeof(fname), "%s/logs/sqmon.%s.log",
-                 getenv("TRAF_HOME"), Node_name);
+        snprintf(fname, sizeof(fname), "%s/sqmon.%s.log",
+                 getenv("TRAF_LOG"), Node_name);
     }
     else
     {
-        snprintf(fname, sizeof(fname), "%s/logs/sqmon.%d.%s.log",
-                 getenv("TRAF_HOME"), MyPNID, Node_name);
+        snprintf(fname, sizeof(fname), "%s/sqmon.%d.%s.log",
+                 getenv("TRAF_LOG"), MyPNID, Node_name);
     }
 #endif
     remove(fname);
diff --git a/core/sqf/monitor/linux/monlogging.cxx b/core/sqf/monitor/linux/monlogging.cxx
index a54567a..e714263 100755
--- a/core/sqf/monitor/linux/monlogging.cxx
+++ b/core/sqf/monitor/linux/monlogging.cxx
@@ -209,18 +209,18 @@
     char   logFileDir[PATH_MAX];
     char  *logFileDirPtr;
     char   logFilePrefix[MAX_FILE_NAME];
-    char  *rootDir;
+    char  *logDir;
 
     if ( useAltLog_ )
     {
-        rootDir = getenv("TRAF_HOME");
-        if (rootDir == NULL)
+        logDir = getenv("TRAF_LOG");
+        if (logDir == NULL)
         {
             logFileDirPtr = NULL;
         }
         else
         {
-            sprintf(logFileDir, "%s/logs", rootDir);
+            sprintf(logFileDir, "%s", logDir);
             logFileDirPtr = logFileDir;
         }
 
diff --git a/core/sqf/monitor/linux/pnode.cxx b/core/sqf/monitor/linux/pnode.cxx
index 364837b..4c21729 100644
--- a/core/sqf/monitor/linux/pnode.cxx
+++ b/core/sqf/monitor/linux/pnode.cxx
@@ -1256,8 +1256,9 @@
     char name[MAX_PROCESS_NAME];
     char stdout[MAX_PROCESS_PATH];
     
+    const char *logpath = getenv("TRAF_LOG");
     snprintf( name, sizeof(name), "$TNS%d", MyNode->GetZone() );
-    snprintf( stdout, sizeof(stdout), "stdout_TNS%d", MyNode->GetZone() );
+    snprintf( stdout, sizeof(stdout), "%s/stdout_TNS%d", logpath, MyNode->GetZone() );
 
     if (trace_settings & (TRACE_INIT | TRACE_RECOVERY))
     {
@@ -1319,8 +1320,9 @@
     char stdout[MAX_PROCESS_PATH];
     CProcess * watchdogProcess;
     
+    const char *logpath = getenv("TRAF_LOG");
     snprintf( name, sizeof(name), "$WDG%d", MyNode->GetZone() );
-    snprintf( stdout, sizeof(stdout), "stdout_WDG%d", MyNode->GetZone() );
+    snprintf( stdout, sizeof(stdout), "%s/stdout_WDG%d", logpath, MyNode->GetZone() );
 
     // The following variables are used to retrieve the proper startup and keepalive environment variable
     // values, and to use as arguments for the lower level ioctl calls that interface with the watchdog 
@@ -1402,8 +1404,9 @@
     char stdout[MAX_PROCESS_PATH];
     CProcess * pstartdProcess;
     
+    const char *logpath = getenv("TRAF_LOG");
     snprintf( name, sizeof(name), "$PSD%d", MyNode->GetZone() );
-    snprintf( stdout, sizeof(stdout), "stdout_PSD%d", MyNode->GetZone() );
+    snprintf( stdout, sizeof(stdout), "%s/stdout_PSD%d", logpath, MyNode->GetZone() );
 
     strcpy(path,getenv("PATH"));
     strcat(path,":");
@@ -1579,8 +1582,9 @@
     if (trace_settings & (TRACE_INIT | TRACE_RECOVERY))
        trace_printf("%s@%d" " - Creating SMService Process\n", method_name, __LINE__);
 
+    const char *logpath = getenv("TRAF_LOG");
     snprintf( name, sizeof(name), "$SMS%03d", MyNode->GetZone() );
-    snprintf( stdout, sizeof(stdout), "stdout_SMS%03d", MyNode->GetZone() );
+    snprintf( stdout, sizeof(stdout), "%s/stdout_SMS%03d", logpath, MyNode->GetZone() );
 
     strcpy(path,getenv("PATH"));
     strcat(path,":");
diff --git a/core/sqf/monitor/linux/shell.cxx b/core/sqf/monitor/linux/shell.cxx
index 0da8c32..05369e3 100644
--- a/core/sqf/monitor/linux/shell.cxx
+++ b/core/sqf/monitor/linux/shell.cxx
@@ -4542,7 +4542,7 @@
 
         // remove shared segment on the node
         char cmd[256];
-        sprintf(cmd, "pdsh -w %s \"sqipcrm %s >> $TRAF_HOME/logs/node_up_%s.log\"", node_name, node_name, node_name);
+        sprintf(cmd, "pdsh -w %s \"sqipcrm %s >> $TRAF_LOG/node_up_%s.log\"", node_name, node_name, node_name);
         system(cmd);
 
         // Start a monitor process on the node
@@ -4950,6 +4950,7 @@
     char programNameAndArgs[MAX_PROCESS_PATH+MAX_VALUE_SIZE_INT];
     char infile[MAX_PROCESS_PATH];
     char outfile[MAX_PROCESS_PATH];
+    char outpath[MAX_PROCESS_PATH];
     char persistRetries[MAX_PERSIST_VALUE_STR];
     char persistZones[MAX_VALUE_SIZE_INT];
     int nid;
@@ -5014,6 +5015,7 @@
                 sprintf( programNameAndArgs, "%s"
                        , persistConfig->GetProgramName() );
             }
+            snprintf(outpath, MAX_FILE_NAME, "%s/%s", getenv("TRAF_LOG"), outfile);
             pid = start_process( &i
                                , process_type
                                , processName
@@ -5021,7 +5023,7 @@
                                , priority
                                , nowait
                                , infile
-                               , outfile
+                               , outpath
                                , programNameAndArgs );
                                //, (char *)persistConfig->GetProgramName() );
             if (pid > 0)
@@ -5072,6 +5074,7 @@
             sprintf( programNameAndArgs, "%s"
                    , persistConfig->GetProgramName() );
         }
+        snprintf(outpath, MAX_FILE_NAME, "%s/%s", getenv("TRAF_LOG"), outfile);
         pid = start_process( &nid
                            , process_type
                            , processName
@@ -5079,7 +5082,7 @@
                            , priority
                            , nowait
                            , infile
-                           , outfile
+                           , outpath
                            , programNameAndArgs );
         if (pid > 0)
         {
@@ -5127,6 +5130,7 @@
             sprintf( programNameAndArgs, "%s"
                    , persistConfig->GetProgramName() );
         }
+        snprintf(outpath, MAX_FILE_NAME, "%s/%s", getenv("TRAF_LOG"), outfile);
         pid = start_process( &nid
                            , process_type
                            , processName
@@ -5134,7 +5138,7 @@
                            , priority
                            , nowait
                            , infile
-                           , outfile
+                           , outpath
                            , programNameAndArgs );
         if (pid > 0)
         {
@@ -6140,10 +6144,10 @@
     char fname[PATH_MAX];
     char msgString[MAX_BUFFER] = { 0 };
 
-    char *tmpDir = getenv( "TRAF_HOME" );
+    char *tmpDir = getenv( "TRAF_LOG" );
     if ( tmpDir )
     {
-        snprintf( fname, sizeof(fname), "%s/sql/scripts/startup.log", tmpDir );
+        snprintf( fname, sizeof(fname), "%s/mon_startup.log", tmpDir );
     }
     else
     {
diff --git a/core/sqf/sqenvcom.sh b/core/sqf/sqenvcom.sh
index 7cb9fd5..987d519 100644
--- a/core/sqf/sqenvcom.sh
+++ b/core/sqf/sqenvcom.sh
@@ -154,6 +154,7 @@
 fi
 export TRAF_HOME=$PWD
 export TRAF_VAR=${TRAF_VAR:-$TRAF_HOME/tmp}
+export TRAF_LOG=${TRAF_LOG:-$TRAF_HOME/logs}
 export TRAF_CONF=${TRAF_CONF:-$TRAF_HOME/conf}
 
 # normal installed location, can be overridden in .trafodion
diff --git a/core/sqf/sql/scripts/ckillall b/core/sqf/sql/scripts/ckillall
index f62efa4..a97475b 100755
--- a/core/sqf/sql/scripts/ckillall
+++ b/core/sqf/sql/scripts/ckillall
@@ -23,7 +23,7 @@
 #
 
 function LogIt {
-    echo  "`date`: $1" >> $TRAF_HOME/logs/startup.log
+    echo  "`date`: $1" >> $TRAF_LOG/startup.log
 }
 
 lv_prog_name="ckillall"
diff --git a/core/sqf/sql/scripts/cleanlogs b/core/sqf/sql/scripts/cleanlogs
index 660b119..a108237 100755
--- a/core/sqf/sql/scripts/cleanlogs
+++ b/core/sqf/sql/scripts/cleanlogs
@@ -33,42 +33,41 @@
    echo ""
    echo "$prog { all | dcs | rest | core }"
    echo "    all  --- Remove files from core, dcs and rest logs folder"
-   echo "    dcs  --- Remove files from $DCS_INSTALL_DIR/logs folder"
-   echo "    rest --- Remove files from $REST_INSTALL_DIR/logs folder"
-   echo "    core --- Remove log files residing in $TRAF_HOME/logs folder"
+   echo "    dcs  --- Remove files from $TRAF_LOG/dcs folder"
+   echo "    rest --- Remove files from $TRAF_LOG/rest folder"
+   echo "    core --- Remove log files residing in $TRAF_LOG folder"
 }
 
 function core_logs() {
  if [[ ! -z $L_PDSH ]]; then
-   $L_PDSH "rm -f ${TRAF_HOME}/logs/*.err"
-   $L_PDSH "rm -f ${TRAF_HOME}/logs/*.log"
-   $L_PDSH "rm -f ${TRAF_HOME}/logs/*log.[0-9]*"
-   $L_PDSH "rm -f ${TRAF_HOME}/sql/scripts/stdout_*"
+   $L_PDSH "rm -f ${TRAF_LOG}/*.err"
+   $L_PDSH "rm -f ${TRAF_LOG}/*.log"
+   $L_PDSH "rm -f ${TRAF_LOG}/*log.[0-9]*"
+   $L_PDSH "rm -f ${TRAF_LOG}/stdout_*"
  else
-   rm -f ${TRAF_HOME}/logs/*
-   rm -f ${TRAF_HOME}/sql/scripts/stdout_*
+   rm -f ${TRAF_LOG}/*
  fi
 }
 
 function dcs_logs() {
  if [[ ! -z $L_PDSH ]]; then
-   $L_PDSH "rm -f ${DCS_INSTALL_DIR}/logs/*.log"
-   $L_PDSH "rm -f ${DCS_INSTALL_DIR}/logs/*.log.[0-9]*"
-   $L_PDSH "rm -f ${DCS_INSTALL_DIR}/logs/*.out"
-   $L_PDSH "rm -f ${DCS_INSTALL_DIR}/logs/*.out.[0-9]*"
+   $L_PDSH "rm -f ${TRAF_LOG}/dcs/*.log"
+   $L_PDSH "rm -f ${TRAF_LOG}/dcs/*.log.[0-9]*"
+   $L_PDSH "rm -f ${TRAF_LOG}/dcs/*.out"
+   $L_PDSH "rm -f ${TRAF_LOG}/dcs/*.out.[0-9]*"
  else
-   rm -f ${DCS_INSTALL_DIR}/logs/*
+   rm -f ${TRAF_LOG}/dcs/*
  fi
 }
 
 function rest_logs() {
  if [[ ! -z $L_PDSH ]]; then
-   $L_PDSH "rm -f ${REST_INSTALL_DIR}/logs/*.log"
-   $L_PDSH "rm -f ${REST_INSTALL_DIR}/logs/*.log.[0-9]*"
-   $L_PDSH "rm -f ${REST_INSTALL_DIR}/logs/*.out"
-   $L_PDSH "rm -f ${REST_INSTALL_DIR}/logs/*.out.[0-9]*"
+   $L_PDSH "rm -f ${TRAF_LOG}/rest/*.log"
+   $L_PDSH "rm -f ${TRAF_LOG}/rest/*.log.[0-9]*"
+   $L_PDSH "rm -f ${TRAF_LOG}/rest/*.out"
+   $L_PDSH "rm -f ${TRAF_LOG}/rest/*.out.[0-9]*"
  else
-   rm -f ${REST_INSTALL_DIR}/logs/*
+   rm -f ${TRAF_LOG}/rest/*
  fi
 }
 
diff --git a/core/sqf/sql/scripts/cresumeall b/core/sqf/sql/scripts/cresumeall
index f3d1867..7cb8a0e 100755
--- a/core/sqf/sql/scripts/cresumeall
+++ b/core/sqf/sql/scripts/cresumeall
@@ -23,7 +23,7 @@
 #
 
 function LogIt {
-    echo  "`date`: $1" >> $TRAF_HOME/logs/startup.log
+    echo  "`date`: $1" >> $TRAF_LOG/startup.log
 }
 
 lv_prog_name="cresumeall"
diff --git a/core/sqf/sql/scripts/csuspendall b/core/sqf/sql/scripts/csuspendall
index 7447632..a3d6798 100755
--- a/core/sqf/sql/scripts/csuspendall
+++ b/core/sqf/sql/scripts/csuspendall
@@ -23,7 +23,7 @@
 #
 
 function LogIt {
-    echo  "`date`: $1" >> $TRAF_HOME/logs/startup.log
+    echo  "`date`: $1" >> $TRAF_LOG/startup.log
 }
 
 lv_prog_name="csuspendall"
diff --git a/core/sqf/sql/scripts/genms b/core/sqf/sql/scripts/genms
index de66199..53c23b0 100755
--- a/core/sqf/sql/scripts/genms
+++ b/core/sqf/sql/scripts/genms
@@ -208,6 +208,7 @@
 echo "REST_INSTALL_DIR=$restinstalldir"
 
 echo "TRAF_VAR=$TRAF_VAR"
+echo "TRAF_LOG=$TRAF_LOG"
 echo "TRAF_CONF=$TRAF_CONF"
 
 if [[ ! -z "$PID_MAX" ]]; then
diff --git a/core/sqf/sql/scripts/gensq.pl b/core/sqf/sql/scripts/gensq.pl
index b48ea3b..3c89c34 100755
--- a/core/sqf/sql/scripts/gensq.pl
+++ b/core/sqf/sql/scripts/gensq.pl
@@ -197,7 +197,7 @@
 #    printScript(1, "   echo\n");
 #    printScript(1, "else\n");
 #    printScript(1, "   echo \"Aborting startup.\"\n");
-#    printScript(1, "   more \$TRAF_HOME/logs/sqcheckmon.log\n");
+#    printScript(1, "   more \$TRAF_LOG/sqcheckmon.log\n");
 #    printScript(1, "   exit 1\n");
 #    printScript(1, "fi\n");
 
diff --git a/core/sqf/sql/scripts/gomon.cold b/core/sqf/sql/scripts/gomon.cold
index f963e29..7a251d4 100755
--- a/core/sqf/sql/scripts/gomon.cold
+++ b/core/sqf/sql/scripts/gomon.cold
@@ -69,7 +69,7 @@
 
    if [[ $monitor_ready -lt 1 ]]; then
       echo "Aborting startup!"
-      cat $TRAF_HOME/logs/sqcheckmon.log
+      cat $TRAF_LOG/sqcheckmon.log
       exit 1
    else
 
diff --git a/core/sqf/sql/scripts/hbcheck b/core/sqf/sql/scripts/hbcheck
index 79dbd97..c0d3944 100755
--- a/core/sqf/sql/scripts/hbcheck
+++ b/core/sqf/sql/scripts/hbcheck
@@ -29,8 +29,8 @@
     exit 1;
 fi
 
-mkdir -p $TRAF_HOME/logs
-lv_stderr_file="$TRAF_HOME/logs/hbcheck.log"
+mkdir $TRAF_LOG
+lv_stderr_file="$TRAF_LOG/hbcheck.log"
 echo "Stderr being written to the file: ${lv_stderr_file}"
 for interval in 5 10 15 30
 do
diff --git a/core/sqf/sql/scripts/ilh_hbase_repair b/core/sqf/sql/scripts/ilh_hbase_repair
index 605e2da..412e4b4 100755
--- a/core/sqf/sql/scripts/ilh_hbase_repair
+++ b/core/sqf/sql/scripts/ilh_hbase_repair
@@ -54,7 +54,7 @@
 
 lv_starttime=`date`
 
-lv_stderr_file="$TRAF_HOME/logs/hbase_hbck_repair.log"
+lv_stderr_file="$TRAF_LOG/hbase_hbck_repair.log"
 echo "Stderr being written to the file: ${lv_stderr_file}"
 ${HBASE_HOME}/bin/hbase hbck -repair > ${lv_stderr_file} 2>${lv_stderr_file}
 
diff --git a/core/sqf/sql/scripts/install_local_hadoop b/core/sqf/sql/scripts/install_local_hadoop
index 807ba74..9a2376b 100755
--- a/core/sqf/sql/scripts/install_local_hadoop
+++ b/core/sqf/sql/scripts/install_local_hadoop
@@ -615,6 +615,7 @@
     HIVE_PREFIX=apache-hive-${HIVE_DEP_VER_APACHE}-bin
 fi
 if [[ "$HBASE_DISTRO" = "HDP" ]]; then
+    HIVE_MIRROR_URL=https://archive.apache.org/dist/hive/hive-${HIVE_DEP_VER_HDP}
     HIVE_PREFIX=apache-hive-${HIVE_DEP_VER_HDP}-bin
 fi
 HIVE_TAR=${HIVE_PREFIX}.tar.gz
@@ -622,7 +623,8 @@
 HBASE_MIRROR_URL=http://archive.cloudera.com/cdh5/cdh/5
 HBASE_TAR=hbase-${HBASE_DEP_VER_CDH}.tar.gz
 if [[ "$HBASE_DISTRO" = "HDP" ]]; then
-    HBASE_TAR=hbase-${HBASE_DEP_VER_HDP}.tar.gz
+    HBASE_MIRROR_URL=https://archive.apache.org/dist/hbase/${HBASE_DEP_VER_HDP}
+    HBASE_TAR=hbase-${HBASE_DEP_VER_HDP}-bin.tar.gz
 fi
 if [[ "$HBASE_DISTRO" =~ "APACHE" ]]; then
     HBASE_MIRROR_URL=https://archive.apache.org/dist/hbase/${HBASE_DEP_VER_APACHE}
diff --git a/core/sqf/sql/scripts/krb5check b/core/sqf/sql/scripts/krb5check
index 94bafa2..7e4509c 100755
--- a/core/sqf/sql/scripts/krb5check
+++ b/core/sqf/sql/scripts/krb5check
@@ -32,7 +32,7 @@
 WAIT_INTERVAL=300
 REPORT_INTERVAL=12
 LOCK_FILE=$TRAF_VAR/krb5check
-LOG_FILE=$TRAF_HOME/logs/krb5check
+LOG_FILE=$TRAF_LOG/krb5check
 CACHE_FILE=""
 HOST_NAME=`hostname -f`
 getKeytab
diff --git a/core/sqf/sql/scripts/krb5functions b/core/sqf/sql/scripts/krb5functions
index 059aea1..00dadf0 100755
--- a/core/sqf/sql/scripts/krb5functions
+++ b/core/sqf/sql/scripts/krb5functions
@@ -114,7 +114,7 @@
 
 function getLogFile
 {
-  LOG_FILE=$TRAF_HOME/logs/krb5check
+  LOG_FILE=$TRAF_LOG/krb5check
 }
 
 function getLockFile
diff --git a/core/sqf/sql/scripts/krb5service b/core/sqf/sql/scripts/krb5service
index 23ba7a0..24dadac 100755
--- a/core/sqf/sql/scripts/krb5service
+++ b/core/sqf/sql/scripts/krb5service
@@ -47,7 +47,7 @@
 #   stop    - stops the ticket renewal service
 #
 # Location attributes (see krb5functions to change these values):
-#  [LOG_FILE]  : $TRAF_HOME/logs/krb5check - log where all events are stored
+#  [LOG_FILE]  : $TRAF_LOG/krb5check - log where all events are stored
 #    (the log file is recreated each time the krb5service is started)
 #  [LOCK_FILE] : $TRAF_VAR/krb5check - file to keep track of krb5check process
 #    (acts as a semiphore to prevent multiple occurrances from running)
@@ -228,7 +228,7 @@
   fi
 
   # remove log, may want to handle log garbage collection differently 
-  rm $TRAF_HOME/logs/krb5check 
+  rm $TRAF_LOG/krb5check 
 
   # kick off a process that wakes up once in a while and check for 
   # ticket expirations
diff --git a/core/sqf/sql/scripts/sqcheckmon b/core/sqf/sql/scripts/sqcheckmon
index 406ee6c..cb8d9c1 100755
--- a/core/sqf/sql/scripts/sqcheckmon
+++ b/core/sqf/sql/scripts/sqcheckmon
@@ -29,7 +29,7 @@
 let lv_first_time=1
 
 while [ $lv_sqmonitor_up '==' 0 ]; do
-    sqshell -a <<EOF >$TRAF_HOME/logs/sqcheckmon.log 2>&1
+    sqshell -a <<EOF >$TRAF_LOG/sqcheckmon.log 2>&1
 EOF
     let lv_sqshell_ret=$?
     if [ $lv_sqshell_ret '==' 0 ]; then
diff --git a/core/sqf/sql/scripts/sqcore b/core/sqf/sql/scripts/sqcore
index acc90cf..abe0838 100755
--- a/core/sqf/sql/scripts/sqcore
+++ b/core/sqf/sql/scripts/sqcore
@@ -34,7 +34,7 @@
     echo "Usage: $0 [ -d <directory> | -q | -r | -h  ]"
     echo 
     echo "-d        Head node directory where the users cluster core files are to be moved"
-    echo "          The default location is \$TRAF_HOME/logs"
+    echo "          The default location is \$TRAF_LOG"
     echo "-q        Quiet mode (no prompts)"
     echo "-r        Remove all of a users cluster core files (excluding head node)"
     echo "-h        Help"
@@ -93,7 +93,7 @@
 declare -i ERR_FLAG=0
 head=`headnode`
 current=`uname -n`
-to_path=$TRAF_HOME/logs
+to_path=$TRAF_LOG
 
 GetOpts $@
 
diff --git a/core/sqf/sql/scripts/sqgen b/core/sqf/sql/scripts/sqgen
index 25c10a1..768f562 100755
--- a/core/sqf/sql/scripts/sqgen
+++ b/core/sqf/sql/scripts/sqgen
@@ -178,7 +178,7 @@
   done
 
 export SQETC_DIR=$TRAF_HOME/etc
-export SQLOG_DIR=$TRAF_HOME/logs
+export SQLOG_DIR=$TRAF_LOG
 mkdir -p $SQETC_DIR
 mkdir -p $SQLOG_DIR
 mkdir -p $MPI_TMPDIR
diff --git a/core/sqf/sql/scripts/sqsmdstats b/core/sqf/sql/scripts/sqsmdstats
index a0802c9..af4f97f 100755
--- a/core/sqf/sql/scripts/sqsmdstats
+++ b/core/sqf/sql/scripts/sqsmdstats
@@ -279,7 +279,7 @@
 # **************************************************************************
 # FUNCTION: adjustSavedFiles
 # removes old versions of saved files, only retain $archiveCount versions
-# copies final list of files to $TRAF_HOME/logs/sqsmdstats_logs directory
+# copies final list of files to $TRAF_LOG/sqsmdstats_logs directory
 #   on all nodes
 function adjustSavedFiles
 {
@@ -499,7 +499,7 @@
  
 # set up script location, name of results file, etc.
 if [ "$scriptAndLogLoc" = "" ]; then
-   scriptAndLogLoc=$TRAF_HOME/logs/sqsmdstats_logs
+   scriptAndLogLoc=$TRAF_LOG/sqsmdstats_logs
 fi
 
 resultsFile=$scriptAndLogLoc/sqsmdstats_details_$scriptStartTime.log
diff --git a/core/sqf/sql/scripts/sqstart b/core/sqf/sql/scripts/sqstart
index 30fedff..d75a3c1 100755
--- a/core/sqf/sql/scripts/sqstart
+++ b/core/sqf/sql/scripts/sqstart
@@ -25,7 +25,7 @@
 #Trafodion startup Script. 
 
 function LogIt {
-    echo  "`date`: $1" >> $TRAF_HOME/logs/startup.log
+    echo  "`date`: $1" >> $TRAF_LOG/startup.log
 }
 
 function Usage {
@@ -154,7 +154,7 @@
         echoLog
         echoLog "Please check the Trafodion shell log file : $SQMON_LOG"
         echoLog
-        echoLog "For additional information, please check the monitor mon.*.log file in $TRAF_HOME/logs"
+        echoLog "For additional information, please check the monitor mon.*.log file in $TRAF_LOG"
         echoLog
         echoLog "Trafodion Startup (from $PWD) Failed"
         echoLog
@@ -369,9 +369,9 @@
 
 
 
-SQLOG_DIR=$TRAF_HOME/logs
+SQLOG_DIR=$TRAF_LOG
 SQMON_LOG=$SQLOG_DIR/sqmon.log
-SQSTART_EXIT_STATUS=./sqstart.exit_status
+SQSTART_EXIT_STATUS=$TRAF_VAR/sqstart.exit_status
 
 if [[ -z $SQSCRIPTS_DIR ]]; then
     SQSCRIPTS_DIR=$TRAF_HOME/sql/scripts
@@ -428,11 +428,11 @@
     $SQPDSHA "cd $TRAF_HOME/sql/scripts; utilConfigDb -u"
 
     echoLog "Executing sqipcrm (output to sqipcrm.out)"
-    sqipcrm > sqipcrm.out
+    sqipcrm > $TRAF_LOG/sqipcrm.out 2>&1
 fi
 
 echoLog "Executing cleanZKNodes (output to cleanZKNodes.out)"
-cleanZKNodes > cleanZKNodes.out 2>&1
+cleanZKNodes > $TRAF_LOG/cleanZKNodes.out 2>&1
 
 echoLog "Checking whether HBase is up"
 hbcheck 4 30
diff --git a/core/sqf/sql/scripts/sqstop b/core/sqf/sql/scripts/sqstop
index c4da486..7facb57 100755
--- a/core/sqf/sql/scripts/sqstop
+++ b/core/sqf/sql/scripts/sqstop
@@ -35,7 +35,7 @@
 }
 
 function LogIt {
-    echo  "`date`: $1" >> $TRAF_HOME/logs/startup.log
+    echo  "`date`: $1" >> $TRAF_LOG/startup.log
 }
 
 function echoLog {
@@ -44,10 +44,10 @@
 }
 
 script_name=`/bin/basename $0`
-SQLOG_DIR=$TRAF_HOME/logs
+SQLOG_DIR=$TRAF_LOG
 SQMON_LOG=$SQLOG_DIR/sqmon.log
 SQGOMON_FILE=$TRAF_HOME/sql/scripts/gomon.cold
-SQSTOP_EXIT_STATUS=$TRAF_HOME/sql/scripts/sqstop.exit_status
+SQSTOP_EXIT_STATUS=$TRAF_VAR/sqstop.exit_status
 
 if [ $# -eq 0 ]; then
     shutdowntype=normal
@@ -227,7 +227,7 @@
 					unbindip=`echo "$match_ip_interface"|awk '{print $2}'`
 					unbindlb=`echo "$match_ip_interface"|awk '{print $NF}'`
 					echoLog "pdsh $cmd_timeout -S -w $curnode sudo ip addr del $unbindip dev $myinterface label $unbindlb"
-					pdsh $cmd_timeout -S -w $curnode sudo ip addr del $unbindip dev $myinterface label $unbindlb >> $TRAF_HOME/logs/ndcsunbind.log
+					pdsh $cmd_timeout -S -w $curnode sudo ip addr del $unbindip dev $myinterface label $unbindlb >> $TRAF_LOG/ndcsunbind.log
 				fi
 	       done
 	   done
@@ -242,7 +242,7 @@
 					unbindip=`echo "$match_ip_interface"|awk '{print $2}'`
 					unbindlb=`echo "$match_ip_interface"|awk '{print $NF}'`
 					echoLog "pdsh $cmd_timeout -S -w $curnode sudo ip addr del $unbindip dev $myinterface label $unbindlb"
-					pdsh $cmd_timeout -S -w $curnode sudo ip addr del $unbindip dev $myinterface label $unbindlb >> $TRAF_HOME/logs/ndcsunbind.log
+					pdsh $cmd_timeout -S -w $curnode sudo ip addr del $unbindip dev $myinterface label $unbindlb >> $TRAF_LOG/ndcsunbind.log
 			   fi
 		   done
 	   done
diff --git a/core/sqf/sql/scripts/traf_authentication_setup b/core/sqf/sql/scripts/traf_authentication_setup
index ea6d9b4..fd249d1 100755
--- a/core/sqf/sql/scripts/traf_authentication_setup
+++ b/core/sqf/sql/scripts/traf_authentication_setup
@@ -189,7 +189,7 @@
 # =============================================================================
 function enable_authorization
 {
-  logLoc=$TRAF_HOME/logs
+  logLoc=$TRAF_LOG
   rm $logLoc/authEnable.log > /dev/null 2>&1
   #gdb sqlci
   sqlci >> "$logLoc/authEnable.log" 2>&1 <<eof
@@ -216,7 +216,7 @@
 # =============================================================================
 function disable_authorization
 {
-  logLoc=$TRAF_HOME/logs
+  logLoc=$TRAF_LOG
   rm $logLoc/authDisable.log > /dev/null 2>&1
   sqlci >> "$logLoc/authDisable.log" 2>&1 <<eof
    values (current_timestamp);
@@ -243,7 +243,7 @@
 # =============================================================================
 function status_authorization
 {
-  logLoc=$TRAF_HOME/logs
+  logLoc=$TRAF_LOG
   rm $logLoc/authStatus.log > /dev/null 2>&1
   sqlci >> "$logLoc/authStatus.log" 2>&1 <<eof
    values (current_timestamp);
diff --git a/core/sqf/src/seabed/src/util.cpp b/core/sqf/src/seabed/src/util.cpp
index 9ea3610..71a8b99 100644
--- a/core/sqf/src/seabed/src/util.cpp
+++ b/core/sqf/src/seabed/src/util.cpp
@@ -1249,11 +1249,11 @@
 
     strncpy(gv_ms_save_log, pp_buf, sizeof(gv_ms_save_log) - 1);
     gv_ms_save_log[sizeof(gv_ms_save_log) - 1] = '\0';
-    lp_root = getenv("TRAF_HOME");
+    lp_root = getenv("TRAF_LOG");
     if (lp_root == NULL)
         lp_log_file_dir = NULL;
     else {
-        sprintf(la_log_file_dir, "%s/logs", lp_root);
+        sprintf(la_log_file_dir, "%s", lp_root);
         lp_log_file_dir = la_log_file_dir;
     }
     SBX_log_write(SBX_LOG_TYPE_LOGFILE |        // log_type
diff --git a/core/sqf/src/seabed/test/gostart b/core/sqf/src/seabed/test/gostart
index edf1765..1c025b5 100755
--- a/core/sqf/src/seabed/test/gostart
+++ b/core/sqf/src/seabed/test/gostart
@@ -23,6 +23,6 @@
 date
 rm -f core.* > /dev/null 2>&1
 sqipcrm
-if [ ! -d $TRAF_HOME/logs ]; then
-	mkdir $TRAF_HOME/logs
+if [ ! -d $TRAF_LOG ]; then
+	mkdir $TRAF_LOG
 fi
diff --git a/core/sqf/src/tm/tminfo.cpp b/core/sqf/src/tm/tminfo.cpp
index 7d013e9..2017893 100644
--- a/core/sqf/src/tm/tminfo.cpp
+++ b/core/sqf/src/tm/tminfo.cpp
@@ -1507,7 +1507,7 @@
 {
     char la_buf_tm_name[20];
     char la_prog[MS_MON_MAX_PROCESS_PATH];
-    char la_out_file[128];
+    char la_out_file[MS_MON_MAX_PROCESS_PATH];
     int lv_server_nid = pv_nid;
     int lv_server_pid;
     int32 lv_oid = 0;
@@ -1528,7 +1528,8 @@
     }
 
     strcpy(la_prog, "tm");
-    sprintf(la_out_file, "stdout_dtm_%d", pv_nid);
+    const char *la_logpath = ms_getenv_str("TRAF_LOG");
+    sprintf(la_out_file, "%s/stdout_dtm_%d", la_logpath, pv_nid);
 
     sprintf (la_buf_tm_name, "$tm%d", pv_nid);
 
diff --git a/core/sqf/sysinstall/etc/init.d/trafodion b/core/sqf/sysinstall/etc/init.d/trafodion
index d1969cb..02fd4b9 100755
--- a/core/sqf/sysinstall/etc/init.d/trafodion
+++ b/core/sqf/sysinstall/etc/init.d/trafodion
@@ -48,7 +48,7 @@
 TRAF_USER=${TRAF_USER:-"trafodion"}
 TRAF_SUDO_CMD=${TRAF_SUDO_CMD:-"su ${TRAF_USER} --login "}
 TRAF_SHELL_CMD=${TRAF_SHELL_CMD:-sqshell}
-TRAF_OUT=${TRAF_VAR:-/var}/log/trafodion/${TRAF_SHELL_CMD}.log
+TRAF_OUT=${TRAF_LOG}/${TRAF_SHELL_CMD}.log
 TRAF_NODE_NAME=`uname -n`
 
 
diff --git a/core/sqf/tools/sqtools.sh b/core/sqf/tools/sqtools.sh
index 3d7b6ad..2839332 100644
--- a/core/sqf/tools/sqtools.sh
+++ b/core/sqf/tools/sqtools.sh
@@ -327,7 +327,7 @@
 # check the startup log and sort the interesting even chronologically
 function sqchksl {
     setup_sqpdsh
-    eval '$SQPDSHA "cd $TRAF_HOME/sql/scripts; grep Executing startup.log 2>/dev/null" 2>/dev/null | sort -k4 -k5'
+    eval '$SQPDSHA "cd $TRAF_LOG; grep Executing mon_startup.log 2>/dev/null" 2>/dev/null | sort -k4 -k5'
 }
 
 function sqchkopt {
@@ -371,7 +371,7 @@
 }
 
 function sqchkmpi {
-    pdsh $MY_NODES "cd $TRAF_HOME/logs; egrep -i '(mpi bug|ibv_create)' *.log" 2>/dev/null
+    pdsh $MY_NODES "cd $TRAF_LOG; egrep -i '(mpi bug|ibv_create)' *.log" 2>/dev/null
 }
 
 #### Log Collection functions
@@ -430,24 +430,23 @@
     
     sqcollectmonmemlog 2>/dev/null
 
-    cp -p $TRAF_HOME/logs/master_exec*.log ${lv_copy_to_dir}
-    cp -p $TRAF_HOME/logs/mon.*.log ${lv_copy_to_dir}
-    cp -p $TRAF_HOME/logs/monmem.*.log ${lv_copy_to_dir}
-    cp -p $TRAF_HOME/logs/pstart*.log ${lv_copy_to_dir}
-    cp -p $TRAF_HOME/logs/smstats.*.log ${lv_copy_to_dir}
-    cp -p $TRAF_HOME/logs/sqmo*.log ${lv_copy_to_dir}
-    cp -p $TRAF_HOME/logs/trafodion.*log* ${lv_copy_to_dir}
-    cp -p $TRAF_HOME/logs/tm*.log ${lv_copy_to_dir}
-    cp -p $TRAF_HOME/logs/wdt.*.log ${lv_copy_to_dir}
+    cp -p $TRAF_LOG/master_exec*.log ${lv_copy_to_dir}
+    cp -p $TRAF_LOG/mon.*.log ${lv_copy_to_dir}
+    cp -p $TRAF_LOG/monmem.*.log ${lv_copy_to_dir}
+    cp -p $TRAF_LOG/pstart*.log ${lv_copy_to_dir}
+    cp -p $TRAF_LOG/smstats.*.log ${lv_copy_to_dir}
+    cp -p $TRAF_LOG/sqmo*.log ${lv_copy_to_dir}
+    cp -p $TRAF_LOG/trafodion.*log* ${lv_copy_to_dir}
+    cp -p $TRAF_LOG/tm*.log ${lv_copy_to_dir}
+    cp -p $TRAF_LOG/wdt.*.log ${lv_copy_to_dir}
 
     cp -p $TRAF_VAR/monitor.map.[0-9]*.* ${lv_copy_to_dir}
     cp -p $TRAF_VAR/monitor.trace* ${lv_copy_to_dir}
 
     lv_stdout_dir_name=${lv_copy_to_dir}/stdout_${lv_node}
     mkdir -p ${lv_stdout_dir_name}
-    cp -p $TRAF_HOME/sql/scripts/startup.log ${lv_copy_to_dir}/startup.${lv_node}.log
-    cp -p $TRAF_HOME/sql/scripts/stdout_* ${lv_stdout_dir_name}
-    cp -p $TRAF_HOME/sql/scripts/hs_err_pid*.log ${lv_stdout_dir_name}
+    cp -p $TRAF_LOG/startup.log ${lv_copy_to_dir}/startup.${lv_node}.log
+    cp -p $TRAF_LOG/stdout_* ${lv_stdout_dir_name}
 
     lv_config_dir_name=${lv_copy_to_dir}/sqconfig_db
     cp -p $TRAF_HOME/sql/scripts/sqconfig.db ${lv_config_dir_name}/${lv_node}_sqconfig.db
@@ -692,7 +691,7 @@
     if [ $monpid_x ]; then
       monpid=`printf "%d" 0x$monpid_x`
       nodename=`uname -n`
-      monmemlog $monpid nowait > $TRAF_HOME/logs/monmem.${nodename}.${monpid}.log
+      monmemlog $monpid nowait > $TRAF_LOG/monmem.${nodename}.${monpid}.log
     fi
 }
 
@@ -1002,7 +1001,7 @@
     cd $TRAF_HOME
 }
 function cdl {
-    cd $TRAF_HOME/logs
+    cd $TRAF_LOG
 }
 function cdb {
     cd $TRAF_HOME/export/bin${SQ_MBTYPE}
diff --git a/core/sql/SqlCompilerDebugger/AboutBox.ui b/core/sql/SqlCompilerDebugger/AboutBox.ui
index 138f254..b498eb6 100644
--- a/core/sql/SqlCompilerDebugger/AboutBox.ui
+++ b/core/sql/SqlCompilerDebugger/AboutBox.ui
@@ -57,7 +57,7 @@
        <item>

         <widget class="QLabel" name="labelAboutCopyright">

          <property name="text">

-          <string>Copyright © 2013</string>

+          <string>Copyright © 2013-2018</string>

          </property>

          <property name="alignment">

           <set>Qt::AlignCenter</set>

diff --git a/core/sql/SqlCompilerDebugger/BreakpointDialog.cpp b/core/sql/SqlCompilerDebugger/BreakpointDialog.cpp
index bc3e56a..3435b48 100644
--- a/core/sql/SqlCompilerDebugger/BreakpointDialog.cpp
+++ b/core/sql/SqlCompilerDebugger/BreakpointDialog.cpp
@@ -55,7 +55,7 @@
   ui_->chkDisplayAfterPrecodegen->setChecked(m_breakpoint->brkAfterPreCodegen);
   ui_->chkDisplayAfterCodegen->setChecked(m_breakpoint->brkAfterCodegen);
   ui_->chkDisplayAfterTdbGeneration->setChecked(m_breakpoint->brkAfterTDBgen);
-  //ui_->chkDisplayExecution->setChecked(m_breakpoint->brkDuringExecution);
+  ui_->chkDisplayExecution->setChecked(m_breakpoint->brkDuringExecution);
   // Set center screen
   QDesktopWidget * desktop = QApplication::desktop();
   move((desktop->width() - this->width()) / 2, (desktop->height() - this->height()) / 2);
@@ -78,6 +78,7 @@
   m_breakpoint->brkAfterPreCodegen = ui_->chkDisplayAfterPrecodegen->isChecked();
   m_breakpoint->brkAfterCodegen = ui_->chkDisplayAfterCodegen->isChecked();
   m_breakpoint->brkAfterTDBgen = ui_->chkDisplayAfterTdbGeneration->isChecked();
+  m_breakpoint->brkDuringExecution = ui_->chkDisplayExecution->isChecked();
   done(0);
 }
 
@@ -109,4 +110,5 @@
   ui_->chkDisplayAfterPrecodegen->setChecked(checked);
   ui_->chkDisplayAfterCodegen->setChecked(checked);
   ui_->chkDisplayAfterTdbGeneration->setChecked(checked);
+  ui_->chkDisplayExecution->setChecked(checked);
 }
diff --git a/core/sql/SqlCompilerDebugger/BreakpointDialog.ui b/core/sql/SqlCompilerDebugger/BreakpointDialog.ui
index 740ecba..9e0ea80 100644
--- a/core/sql/SqlCompilerDebugger/BreakpointDialog.ui
+++ b/core/sql/SqlCompilerDebugger/BreakpointDialog.ui
@@ -162,6 +162,13 @@
         </property>
        </widget>
       </item>
+      <item>
+       <widget class="QCheckBox" name="chkDisplayExecution">
+        <property name="text">
+         <string>Display execution</string>
+        </property>
+       </widget>
+      </item>
      </layout>
     </widget>
    </item>
diff --git a/core/sql/SqlCompilerDebugger/CommonSqlCmpDbg.h b/core/sql/SqlCompilerDebugger/CommonSqlCmpDbg.h
index 2d30701..acbafe8 100644
--- a/core/sql/SqlCompilerDebugger/CommonSqlCmpDbg.h
+++ b/core/sql/SqlCompilerDebugger/CommonSqlCmpDbg.h
@@ -27,7 +27,7 @@
  * File:         CommonSqlCmpDbg.h
  * Description:  This file contains declarations common to arkcmp components
  *               and tdm_sqlcmpdbg, the GUI tool used to display query
- *		 compilation.
+ *		 compilation and execution.
  *****************************************************************************
  */
 
@@ -51,6 +51,10 @@
 #include "ComTdb.h"
 #include "ex_tcb.h"
 
+// executor GUI header files
+#include "ex_exe_stmt_globals.h"
+#include "ExScheduler.h"
+
 #ifdef _c
 #undef _c
 #endif /*  */
@@ -78,43 +82,6 @@
 #define IDX_GENERIC 3
 
 #include "ComSqlcmpdbg.h"
-#if 0
-class Sqlcmpdbg
-{
-  // This class exists merely to give a nice naming scope for this enum
-public:
-  enum CompilationPhase
-  {
-    AFTER_PARSING,
-    AFTER_BINDING,
-    AFTER_TRANSFORMATION,
-    AFTER_NORMALIZATION,
-    AFTER_SEMANTIC_QUERY_OPTIMIZATION,
-    DURING_MVQR,
-    AFTER_ANALYZE,
-    AFTER_OPT1,
-    AFTER_OPT2,
-    AFTER_PRECODEGEN,
-    AFTER_CODEGEN,
-    AFTER_TDBGEN,
-    DURING_EXECUTION,
-    DURING_MEMOIZATION,
-    FROM_MSDEV
-  };
-};
-
-typedef struct tagSqlcmpdbgExpFuncs
-{
-  void (*fpDisplayQueryTree) (Sqlcmpdbg::CompilationPhase, void *, void *);
-  void (*fpSqldbgSetPointers) (void *, void *, void *, void *, void *);
-  void (*fpDoMemoStep) (Int32, Int32, Int32, void *, void *, void *);
-  void (*fpHideQueryTree) (BOOL);
-  void (*fpDisplayTDBTree) (Sqlcmpdbg::CompilationPhase, void *, void *);
-  NABoolean (*fpDisplayExecution) (void);
-  void (*fpCleanUp) (void);
-} SqlcmpdbgExpFuncs;
-typedef SqlcmpdbgExpFuncs *(*fpGetSqlcmpdbgExpFuncs) (void);
-#endif
 
 typedef struct tagSQLDebugBrkPts
 {
@@ -128,7 +95,8 @@
     brkAfterOpt2 (FALSE),
     brkAfterPreCodegen (FALSE),
     brkAfterCodegen (FALSE),
-    brkAfterTDBgen (FALSE), brkDuringExecution (FALSE)
+    brkAfterTDBgen (FALSE),
+    brkDuringExecution (FALSE)
   {  }
   NABoolean brkAfterParsing;
   NABoolean brkAfterBinding;
diff --git a/core/sql/SqlCompilerDebugger/ExeQueueDisplay.cpp b/core/sql/SqlCompilerDebugger/ExeQueueDisplay.cpp
new file mode 100644
index 0000000..64f029d
--- /dev/null
+++ b/core/sql/SqlCompilerDebugger/ExeQueueDisplay.cpp
@@ -0,0 +1,186 @@
+// @@@ START COPYRIGHT @@@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+// @@@ END COPYRIGHT @@@
+#include "ExeQueueDisplay.h"
+#include "ui_ExeQueueDisplay.h"
+#include "CommonSqlCmpDbg.h"
+#include "TCBTreeView.h"
+
+ExeQueueDisplay::ExeQueueDisplay(const ex_tcb *tcb,
+                                 bool isUp,
+                                 QWidget *parent) :
+  QDialog(parent),
+  ui(new Ui::ExeQueueDisplay),
+  tcb_(tcb),
+  isUp_(isUp)
+{
+  ui->setupUi(this);
+
+  QString s = QString("%1 queue for %2 (Id: %3 Ex: %4)").
+                 arg(isUp_ ? "Up" : "Down").
+                 arg(tcb->getTdb()->getNodeName()).
+                 arg(tcb->getTdb()->getTdbId()).
+                 arg(tcb->getTdb()->getExplainNodeId());
+  setWindowTitle(s);
+  s = "";
+  setLabel(s);
+  populate();
+}
+
+ExeQueueDisplay::~ExeQueueDisplay()
+{
+  delete ui;
+}
+
+void ExeQueueDisplay::setLabel(QString &lbl)
+{
+    ui->queueLabel->setText(lbl);
+}
+
+void ExeQueueDisplay::populate()
+{
+  ex_queue_pair qp = tcb_->getParentQueue();
+  ex_queue *q = (isUp_ ? qp.up : qp.down);
+  queue_index qLength = q->getLength();
+  queue_index headIndex = q->getHeadIndex();
+  QStringList headers;
+
+  ui->tableWidget->setRowCount(qLength);
+  headers << "Index";
+  if (isUp_)
+    {
+      headers << "DownIx" << "ParentIx" << "State";
+      ui->tableWidget->setColumnCount(4);
+    }
+  else
+    {
+      headers << "ParentIx" << "State";
+      ui->tableWidget->setColumnCount(3);
+    }
+  ui->tableWidget->setHorizontalHeaderLabels(headers);
+  for (queue_index ix=0; ix<qLength; ix++)
+    {
+      ex_queue_entry *qEntry = q->getQueueEntry(headIndex+ix);
+
+      ui->tableWidget->setItem(ix, 0, new QTableWidgetItem(QString("%1").
+                           arg(headIndex + ix)));
+      if (isUp_)
+        {
+          up_state upState = qEntry->upState;
+          QString status;
+
+          ui->tableWidget->setItem(ix, 1, new QTableWidgetItem(QString("%1").
+                                                               arg(upState.downIndex)));
+          ui->tableWidget->setItem(ix, 2, new QTableWidgetItem(QString("%1").
+                                                               arg(upState.parentIndex)));
+
+          switch (upState.status)
+            {
+            case ex_queue::Q_NO_DATA:
+              status = "Q_NO_DATA";
+              break;
+            case ex_queue::Q_OK_MMORE:
+              status = "Q_OK_MMORE";
+              break;
+            case ex_queue::Q_SQLERROR:
+              status = "Q_SQLERROR";
+              break;
+            case ex_queue::Q_INVALID:
+              status = "Q_INVALID";
+              break;
+            case ex_queue::Q_GET_DONE:
+              status = "Q_GET_DONE";
+              break;
+            case ex_queue::Q_REC_SKIPPED:
+              status = "Q_REC_SKIPPED";
+              break;
+            case ex_queue::Q_STATS:
+              status = "Q_STATS";
+              break;
+            default:
+              status = QString("unknown: %1").arg((int) upState.status);
+              break;
+            }
+          ui->tableWidget->setItem(ix, 3, new QTableWidgetItem(status));
+        }
+      else
+        {
+          down_state downState = qEntry->downState;
+          QString status;
+
+          ui->tableWidget->setItem(ix, 1, new QTableWidgetItem(QString("%1").arg(downState.parentIndex)));
+
+          switch (downState.request)
+            {
+            case ex_queue::GET_N:
+              status = QString("GET_N (%1)").arg(downState.requestValue);
+              break;
+            case ex_queue::GET_ALL:
+              status = "GET_ALL";
+              break;
+            case ex_queue::GET_NOMORE:
+              status = "GET_NOMORE";
+              break;
+            case ex_queue::GET_EMPTY:
+              status = "GET_EMPTY";
+              break;
+            case ex_queue::GET_EOD:
+              status = "GET_EOD";
+              break;
+            case ex_queue::GET_EOD_NO_ST_COMMIT:
+              status = "GET_EOD_NO_ST_COMMIT";
+              break;
+            case ex_queue::GET_NEXT_N:
+              status = QString("GET_NEXT_N (%1)").arg(downState.requestValue);
+              break;
+            case ex_queue::GET_NEXT_N_MAYBE_WAIT:
+              status = "GET_NEXT_N_MAYBE_WAIT";
+              break;
+            case ex_queue::GET_NEXT_0_MAYBE_WAIT:
+              status = "GET_NEXT_0_MAYBE_WAIT";
+              break;
+            case ex_queue::GET_NEXT_N_SKIP:
+              status = "GET_NEXT_N_SKIP";
+              break;
+            case ex_queue::GET_NEXT_N_MAYBE_WAIT_SKIP:
+              status = "GET_NEXT_N_MAYBE_WAIT_SKIP";
+              break;
+            case ex_queue::GET_N_RETURN_SKIPPED:
+              status = "GET_N_RETURN_SKIPPED";
+              break;
+           default:
+              status = QString("unknown: %1").arg((int) downState.request);
+              break;
+            }
+          ui->tableWidget->setItem(ix, 2, new QTableWidgetItem(status));
+        }
+    }
+}
+
+void ExeQueueDisplay::on_okButton_clicked()
+{
+  delete this;
+}
+
+void ExeQueueDisplay::on_cancelButton_clicked()
+{
+  // same as OK button, just close the window
+  on_okButton_clicked();
+}
diff --git a/core/sql/SqlCompilerDebugger/ExeQueueDisplay.h b/core/sql/SqlCompilerDebugger/ExeQueueDisplay.h
new file mode 100644
index 0000000..a73f8b3
--- /dev/null
+++ b/core/sql/SqlCompilerDebugger/ExeQueueDisplay.h
@@ -0,0 +1,60 @@
+// @@@ START COPYRIGHT @@@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+// @@@ END COPYRIGHT @@@
+#ifndef EXEQUEUEDISPLAY_H
+#define EXEQUEUEDISPLAY_H
+
+#include <QtGui>
+#include <QDialog>
+#include "CommonSqlCmpDbg.h"
+#include "ex_globals.h"
+#include "ex_tcb.h"
+
+namespace Ui {
+  class ExeQueueDisplay;
+  }
+
+class QTreeWidgetItem;
+
+class ExeQueueDisplay : public QDialog
+{
+  Q_OBJECT
+
+  public:
+  explicit ExeQueueDisplay(const ex_tcb *tcb,
+                           bool isUp,
+                           QWidget *parent);
+  ~ExeQueueDisplay();
+
+  void setLabel(QString & lbl);
+  void populate();
+
+  private slots:
+  void on_okButton_clicked();
+
+  void on_cancelButton_clicked();
+
+  private:
+  Ui::ExeQueueDisplay *ui;
+  const ex_tcb *tcb_;
+  bool isUp_;
+};
+
+#endif // EXEQUEUEDISPLAY_H
diff --git a/core/sql/SqlCompilerDebugger/ExeQueueDisplay.ui b/core/sql/SqlCompilerDebugger/ExeQueueDisplay.ui
new file mode 100644
index 0000000..fd21877
--- /dev/null
+++ b/core/sql/SqlCompilerDebugger/ExeQueueDisplay.ui
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<ui version="4.0">
+ <class>ExeQueueDisplay</class>
+ <widget class="QDialog" name="ExeQueueDisplay">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>484</width>
+    <height>369</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <widget class="QWidget" name="verticalLayoutWidget">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>491</width>
+     <height>371</height>
+    </rect>
+   </property>
+   <layout class="QVBoxLayout" name="verticalLayout">
+    <item>
+     <widget class="QLabel" name="queueLabel">
+      <property name="text">
+       <string>  Queue</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QTableWidget" name="tableWidget"/>
+    </item>
+    <item>
+     <layout class="QHBoxLayout" name="horizontalLayout">
+      <property name="leftMargin">
+       <number>9</number>
+      </property>
+      <property name="topMargin">
+       <number>9</number>
+      </property>
+      <property name="rightMargin">
+       <number>9</number>
+      </property>
+      <property name="bottomMargin">
+       <number>9</number>
+      </property>
+      <item>
+       <spacer name="horizontalSpacer">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>40</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+      <item>
+       <widget class="QPushButton" name="cancelButton">
+        <property name="text">
+         <string>Cancel</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="okButton">
+        <property name="text">
+         <string>OK</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/core/sql/SqlCompilerDebugger/ExeSchedWindow.cpp b/core/sql/SqlCompilerDebugger/ExeSchedWindow.cpp
new file mode 100644
index 0000000..37e84cb
--- /dev/null
+++ b/core/sql/SqlCompilerDebugger/ExeSchedWindow.cpp
@@ -0,0 +1,246 @@
+// @@@ START COPYRIGHT @@@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+// @@@ END COPYRIGHT @@@
+#include "ExeSchedWindow.h"
+#include "ui_ExeSchedWindow.h"
+#include "CommonSqlCmpDbg.h"
+
+// defined in MainWindow.cpp
+extern QApplication* GlobGuiApplication;
+
+const int GlobGuiExeMaxFragInstances = 32;
+ExeSchedWindow *GlobGuiExeSchedWindow[GlobGuiExeMaxFragInstances];
+int GlobGuiExeFragInstancesLen = 0;
+
+ExeSchedWindow::ExeSchedWindow(QWidget *parent) :
+    QMainWindow(parent),
+    ui(new Ui::ExeSchedWindow)
+{
+    ui->setupUi(this);
+    headerIsInitialized_ = false;
+    isVisible_ = false;
+    keepProcessingEvents_ = true;
+    stopAtBreakpoints_ = true;
+    stopAtAllTasks_ = true;
+    hasSavedGeometry_ = false;
+    subtaskPtr_ = NULL;
+    tcbTreeView_ = new TCBTreeView(this);
+
+    // ViewContainer *viewContainer = new ViewContainer();
+    QMdiSubWindow *subWindow = ui->mdiArea->addSubWindow(tcbTreeView_);
+    subWindow->resize(ui->mdiArea->width() / 2, ui->mdiArea->height() / 2);
+    subWindow->showMaximized();
+
+}
+
+ExeSchedWindow::~ExeSchedWindow()
+{
+    delete ui;
+}
+
+void ExeSchedWindow::initializeStaticInfo(ExScheduler *sched)
+{
+  if (!headerIsInitialized_)
+    {
+      int frag, inst, numInst, nid, pid;
+      char buf[100];
+      char procName[100];
+      int xOffset = 0;
+      int yOffset = 0;
+      int xDelta = 75;
+      int yDelta = 75;
+      QDesktopWidget *desktop = QApplication::desktop();
+      int maxXOffset = (desktop->width() - this->width()) / 4;
+      int maxYOffset = (desktop->height() - this->height()) / 4;
+      sched->getProcInfoForGui(frag, inst, numInst, nid, pid, procName, sizeof(procName));
+
+      if (frag == 0)
+        snprintf(buf, sizeof(buf), "Master Executor");
+      else
+        snprintf(buf, sizeof(buf), "Fragment %d, instance %d of %d",
+                 frag, inst, numInst);
+      ui->centralwidget->parentWidget()->setWindowTitle(buf);
+
+      snprintf(buf, sizeof(buf), "%d, %d, %s", nid, pid, procName);
+      ui->nidPidLabel->setText(buf);
+      // position the windows such that they are staggered
+      // and their titles are visible, fragments at the same
+      // height and instances arranged left to right
+      xOffset = inst * xDelta;
+      yOffset = frag * yDelta;
+      if (xOffset > maxXOffset)
+        xOffset = maxXOffset;
+      if (yOffset > maxYOffset)
+        yOffset = maxYOffset;
+      move(xOffset, yOffset);
+
+      headerIsInitialized_ = true;
+    }
+}
+
+void ExeSchedWindow::run(ExSubtask **subtaskPtr)
+{
+    ensureVisible();
+    keepProcessingEvents_ = true;
+    subtaskPtr_ = subtaskPtr;
+
+    while (keepProcessingEvents_)
+    {
+        GlobGuiApplication->sendPostedEvents();
+        GlobGuiApplication->processEvents(
+             QEventLoop::WaitForMoreEvents |
+             QEventLoop::EventLoopExec);
+    }
+    subtaskPtr_ = NULL;
+    ensureInvisible();
+}
+
+void ExeSchedWindow::ensureVisible()
+{
+  if (!isVisible_)
+    {
+      if (hasSavedGeometry_)
+        setGeometry(savedGeometry_);
+      show();
+      isVisible_ = true;
+    }
+}
+
+void ExeSchedWindow::ensureInvisible()
+{
+  if (isVisible_)
+    {
+      savedGeometry_ = geometry();
+      hasSavedGeometry_ = true;
+      hide();
+      isVisible_ = false;
+    }
+}
+
+bool ExeSchedWindow::needToStop(void *subtask, void *scheduler)
+{
+    ExSubtask *st = static_cast<ExSubtask *>(subtask);
+    ExScheduler *sch = static_cast<ExScheduler *>(scheduler);
+
+    if (scheduler != NULL &&
+        (stopAtAllTasks_ ||
+         (st && st->getBreakPoint() && stopAtBreakpoints_)))
+      {
+        initializeStaticInfo(sch);
+
+        if (tcbTreeView_ && st && st->getTcb())
+          tcbTreeView_->displayTcbTree(st->getTcb(), st, sch);
+        return true;
+      }
+
+    return false;
+}
+
+void ExeSchedWindow::on_finishButton_clicked()
+{
+    keepProcessingEvents_ = false;
+    stopAtBreakpoints_ = false;
+    stopAtAllTasks_ = false;
+}
+
+void ExeSchedWindow::on_nextBptButton_clicked()
+{
+    keepProcessingEvents_ = false;
+    stopAtBreakpoints_ = true;
+    stopAtAllTasks_ = false;
+}
+
+void ExeSchedWindow::on_nextTaskButton_clicked()
+{
+    keepProcessingEvents_ = false;
+    stopAtBreakpoints_ = true;
+    stopAtAllTasks_ = true;
+}
+bool ExeSchedWindow::stopAtAllTasks() const
+{
+    return stopAtAllTasks_;
+}
+
+void ExeSchedWindow::setStopAtAllTasks(bool stopAtAllTasks)
+{
+    stopAtAllTasks_ = stopAtAllTasks;
+  }
+
+ExeSchedWindow *ExeSchedWindow::findInstance(ExScheduler *sched)
+{
+    int fragInstId = sched->getFragInstIdForGui();
+
+    if (fragInstId >= GlobGuiExeFragInstancesLen)
+      {
+        if (fragInstId >= GlobGuiExeMaxFragInstances)
+          // this is not handled right now
+          return NULL;
+
+        // fill the array that is now used with NULLs
+        for (int i=GlobGuiExeFragInstancesLen; i<=fragInstId; i++)
+          GlobGuiExeSchedWindow[i] = NULL;
+        GlobGuiExeFragInstancesLen = fragInstId+1;
+      }
+    if (GlobGuiExeSchedWindow[fragInstId] == NULL)
+      GlobGuiExeSchedWindow[fragInstId] = new ExeSchedWindow();
+
+    return GlobGuiExeSchedWindow[fragInstId];
+  }
+
+void ExeSchedWindow::deleteInstance(void *scheduler)
+{
+  ExScheduler *sched = static_cast<ExScheduler *>(scheduler);
+  int fragInstId = sched->getFragInstIdForGui();
+
+  if (fragInstId >= 0 && fragInstId < GlobGuiExeFragInstancesLen)
+    {
+      delete GlobGuiExeSchedWindow[fragInstId];
+      GlobGuiExeSchedWindow[fragInstId] = NULL;
+    }
+  }
+
+void ExeSchedWindow::deleteAllInstances()
+{
+  for (int i=0; i<GlobGuiExeFragInstancesLen; i++)
+    if (GlobGuiExeSchedWindow[i])
+      delete GlobGuiExeSchedWindow[i];
+  GlobGuiExeFragInstancesLen = 0;
+}
+
+bool ExeSchedWindow::stopAtBreakpoints() const
+{
+    return stopAtBreakpoints_;
+}
+
+void ExeSchedWindow::setStopAtBreakpoints(bool stopAtBreakpoints)
+{
+    stopAtBreakpoints_ = stopAtBreakpoints;
+}
+
+bool ExeSchedWindow::keepProcessingEvents() const
+{
+    return keepProcessingEvents_;
+}
+
+void ExeSchedWindow::setKeepProcessingEvents(bool keepProcessingEvents)
+{
+    keepProcessingEvents_ = keepProcessingEvents;
+}
+
diff --git a/core/sql/SqlCompilerDebugger/ExeSchedWindow.h b/core/sql/SqlCompilerDebugger/ExeSchedWindow.h
new file mode 100644
index 0000000..038a62d
--- /dev/null
+++ b/core/sql/SqlCompilerDebugger/ExeSchedWindow.h
@@ -0,0 +1,94 @@
+// @@@ START COPYRIGHT @@@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+// @@@ END COPYRIGHT @@@
+#ifndef EXESCHEDWINDOW_H
+#define EXESCHEDWINDOW_H
+
+#include <QMainWindow>
+#include "TCBTreeView.h"
+
+namespace Ui {
+class ExeSchedWindow;
+}
+
+class ExSubtask;
+class ExScheduler;
+
+class ExeSchedWindow : public QMainWindow
+{
+    Q_OBJECT
+
+public:
+    explicit ExeSchedWindow(QWidget *parent = 0);
+    ~ExeSchedWindow();
+
+    // initialize the info at the top of the window
+    void initializeStaticInfo(ExScheduler *sched);
+
+    // drive the event loop for the window until we
+    // are ready to resume with the executor tasks
+    void run(ExSubtask **subtaskPtr);
+    // ensure the window is visible/invisible
+    void ensureVisible();
+    void ensureInvisible();
+    // check whether the user requested to see the
+    // GUI for this particular subtask
+    bool needToStop(void *subtask, void *scheduler);
+
+    // should the run() method continue to process events?
+    bool keepProcessingEvents() const;
+    void setKeepProcessingEvents(bool keepProcessingEvents);
+
+    bool stopAtBreakpoints() const;
+    void setStopAtBreakpoints(bool stopAtBreakpoints);
+
+    bool stopAtAllTasks() const;
+    void setStopAtAllTasks(bool stopAtAllTasks);
+
+    // find the instance id of a TCB tree, given the
+    // scheduler
+    static ExeSchedWindow *findInstance(ExScheduler *sched);
+    static void deleteInstance(void *scheduler);
+    static void deleteAllInstances();
+
+    // get the main window
+    ExSubtask **getSubtaskPtr() { return subtaskPtr_; }
+
+private slots:
+    void on_finishButton_clicked();
+
+    void on_nextBptButton_clicked();
+
+    void on_nextTaskButton_clicked();
+
+private:
+    Ui::ExeSchedWindow *ui;
+    bool headerIsInitialized_;
+    bool isVisible_;
+    bool keepProcessingEvents_;
+    bool stopAtBreakpoints_;
+    bool stopAtAllTasks_;
+    QRect savedGeometry_;
+    bool hasSavedGeometry_;
+    ExSubtask **subtaskPtr_;
+    TCBTreeView *tcbTreeView_;
+};
+
+#endif // EXESCHEDWINDOW_H
diff --git a/core/sql/SqlCompilerDebugger/ExeSchedWindow.ui b/core/sql/SqlCompilerDebugger/ExeSchedWindow.ui
new file mode 100644
index 0000000..7492b72
--- /dev/null
+++ b/core/sql/SqlCompilerDebugger/ExeSchedWindow.ui
@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<ui version="4.0">
+ <class>ExeSchedWindow</class>
+ <widget class="QMainWindow" name="ExeSchedWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>627</width>
+    <height>547</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>MainWindow</string>
+  </property>
+  <property name="windowIcon">
+   <iconset>
+    <normaloff>Resource/Main/SQ_Logo.png</normaloff>Resource/Main/SQ_Logo.png</iconset>
+  </property>
+  <widget class="QWidget" name="centralwidget">
+   <layout class="QVBoxLayout" name="verticalLayout">
+    <item>
+     <layout class="QVBoxLayout" name="verticalLayout_2" stretch="1,16,2">
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_2">
+        <item>
+         <widget class="QLabel" name="fNidPid">
+          <property name="text">
+           <string>Nid, pid, proc:</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QLabel" name="nidPidLabel">
+          <property name="text">
+           <string>nnnn, pppppp, $XXXXXX</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <spacer name="horizontalSpacer_2">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>40</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <widget class="QMdiArea" name="mdiArea"/>
+      </item>
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_3">
+        <item>
+         <spacer name="horizontalSpacer">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>40</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+        <item>
+         <widget class="QPushButton" name="nextTaskButton">
+          <property name="toolTip">
+           <string>Process the current task</string>
+          </property>
+          <property name="text">
+           <string>Next Task</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QPushButton" name="nextBptButton">
+          <property name="toolTip">
+           <string>Run to the next breakpoint, if any</string>
+          </property>
+          <property name="text">
+           <string>Next Breakpoint</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QPushButton" name="finishButton">
+          <property name="toolTip">
+           <string>Close this window and finish processisng without stopping</string>
+          </property>
+          <property name="text">
+           <string>Finish</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+     </layout>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>627</width>
+     <height>26</height>
+    </rect>
+   </property>
+   <widget class="QMenu" name="menuFragment_x_instance_y_of_z">
+    <property name="title">
+     <string>File</string>
+    </property>
+   </widget>
+   <widget class="QMenu" name="menuTools">
+    <property name="title">
+     <string>Tools</string>
+    </property>
+   </widget>
+   <addaction name="menuFragment_x_instance_y_of_z"/>
+   <addaction name="menuTools"/>
+  </widget>
+  <widget class="QStatusBar" name="statusbar"/>
+  <widget class="QToolBar" name="toolBar">
+   <property name="windowTitle">
+    <string>toolBar</string>
+   </property>
+   <attribute name="toolBarArea">
+    <enum>TopToolBarArea</enum>
+   </attribute>
+   <attribute name="toolBarBreak">
+    <bool>false</bool>
+   </attribute>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/core/sql/SqlCompilerDebugger/ExportFunctionSqlCmpDbg.cpp b/core/sql/SqlCompilerDebugger/ExportFunctionSqlCmpDbg.cpp
index d78868c..61afbe0 100644
--- a/core/sql/SqlCompilerDebugger/ExportFunctionSqlCmpDbg.cpp
+++ b/core/sql/SqlCompilerDebugger/ExportFunctionSqlCmpDbg.cpp
@@ -21,71 +21,75 @@
 #include <QtGui>
 #include "ExportFunctionSqlCmpDbg.h"
 #include "MainWindow.h"
-#include "QueryData.h" 
+#include "QueryData.h"
+#include "ExeSchedWindow.h"
 
 #define DISPLAY_WARNING 1032
- 
-extern MainWindow *mainWindow_;
-extern SqlcmpdbgExpFuncs exportFunctions_;
-extern QApplication* application_;
+
+// defined in MainWindow.cpp
+extern MainWindow *GlobGuiMainWindow;
+extern SqlcmpdbgExpFuncs GlobGuiExportFunctions;
+extern QApplication* GlobGuiApplication;
+
 static int argc = 1;
 static char **argv;	
 
-SqlcmpdbgExpFuncs * GetSqlcmpdbgExpFuncs(void) 
+SqlcmpdbgExpFuncs * GetSqlcmpdbgExpFuncs()
 {
-  if (application_ == NULL)
-     application_ = new QApplication(argc, argv);
-     
-  if(mainWindow_)
-    delete mainWindow_;
-  mainWindow_ = new MainWindow();
-  exportFunctions_.fpDisplayQueryTree = DisplayQueryTree;
-  exportFunctions_.fpSqldbgSetPointers = SqldbgSetPointers;
-  exportFunctions_.fpDoMemoStep = DoMemoStep;
-  exportFunctions_.fpHideQueryTree = HideQueryTree;
-  exportFunctions_.fpDisplayTDBTree = DisplayTDBTree;
-  exportFunctions_.fpDisplayExecution = DisplayExecution;
-  exportFunctions_.fpCleanUp = CleanUp;
-  return &exportFunctions_;
+  if (GlobGuiApplication == NULL)
+     GlobGuiApplication = new QApplication(argc, argv);
+
+  GlobGuiExportFunctions.fpDisplayQueryTree = DisplayQueryTree;
+  GlobGuiExportFunctions.fpSqldbgSetCmpPointers = SqldbgSetCmpPointers;
+  GlobGuiExportFunctions.fpDoMemoStep = DoMemoStep;
+  GlobGuiExportFunctions.fpHideQueryTree = HideQueryTree;
+  GlobGuiExportFunctions.fpDisplayTDBTree = DisplayTDBTree;
+  GlobGuiExportFunctions.fpExecutionDisplayIsEnabled = ExecutionDisplayIsEnabled;
+  GlobGuiExportFunctions.fpSqldbgSetExePointers = SqldbgSetExePointers;
+  GlobGuiExportFunctions.fpDisplayExecution = DisplayExecution;
+  GlobGuiExportFunctions.fpCleanUp = CleanUp;
+  return &GlobGuiExportFunctions;
 }
 
 void DisplayQueryTree(Sqlcmpdbg::CompilationPhase phase, 
                         void *tree, void *plan) 
 {
-  if (MainWindow::IsQuiting)
+  if (MainWindow::IsQuitting)
     return;
-  mainWindow_->SetDocumentTitle(phase);
-  mainWindow_->show();
-  if (!mainWindow_->NeedToDisplay(phase)) 
+
+  GlobGuiMainWindow->SetDocumentTitle(phase);
+  GlobGuiMainWindow->show();
+  if (!GlobGuiMainWindow->NeedToDisplay(phase)) 
   {
-      mainWindow_->hide();
+      GlobGuiMainWindow->hide();
       return;
   }
-  mainWindow_->m_querydata->SetPhase(phase);
-  mainWindow_->m_querydata->SetData(tree, plan);
-  mainWindow_->syncMemoWithDoc();
+  GlobGuiMainWindow->m_querydata->SetPhase(phase);
+  GlobGuiMainWindow->m_querydata->SetData(tree, plan);
+  GlobGuiMainWindow->syncMemoWithDoc();
   
-  mainWindow_->UpdateAllViews();
-  mainWindow_->Run();
-  mainWindow_->hide();
+  GlobGuiMainWindow->UpdateAllViews();
+  GlobGuiMainWindow->Run();
+  GlobGuiMainWindow->hide();
 }
 
-void SqldbgSetPointers(void *memoptr , void *tasklist ,
-                         void *analysis , void *currentContext ,
-                         void *ClusterInfo ) 
+void SqldbgSetCmpPointers(void *memoptr , void *tasklist ,
+                          void *analysis , void *currentContext ,
+                          void *ClusterInfo ) 
 {
-  if (MainWindow::IsQuiting)
+  if (MainWindow::IsQuitting)
     return;
-  mainWindow_->m_querydata->SetMemo(memoptr);
-  mainWindow_->m_querydata->SetAnalysis(analysis);
-  mainWindow_->m_querydata->SetTaskList(tasklist);
+
+  ExeSchedWindow::deleteAllInstances();
+
+  if (GlobGuiMainWindow == NULL)
+    GlobGuiMainWindow = new MainWindow();
+
+  GlobGuiMainWindow->m_querydata->SetMemo(memoptr);
+  GlobGuiMainWindow->m_querydata->SetAnalysis(analysis);
+  GlobGuiMainWindow->m_querydata->SetTaskList(tasklist);
   cmpCurrentContext = (CmpContext *) currentContext;
 
-  CURRSTMT_OPTGLOBALS->memo = (CascadesMemo *) memoptr;
-  
-  // Initialize the GUI pointer to the compiler's global cluster info:
-  gpClusterInfo = (NAClusterInfo *) ClusterInfo;
-  
   // --------------------------------------------------------------
   // initialize optimization defaults
   // This is needed to initialize re-calibration constants
@@ -96,29 +100,29 @@
 void DoMemoStep(Int32 passNo, Int32 groupNo, Int32 taskNo, void *task,
                   void *expr, void *plan) 
 {
-  if (MainWindow::IsQuiting)
+  if (MainWindow::IsQuitting)
     return;
-  if (mainWindow_->NeedToStop(passNo,groupNo,taskNo,(CascadesTask *)task, (ExprNode *)expr,(CascadesPlan *)plan))
+  if (GlobGuiMainWindow->NeedToStop(passNo,groupNo,taskNo,(CascadesTask *)task, (ExprNode *)expr,(CascadesPlan *)plan))
   {
-     mainWindow_->show();
-     mainWindow_->Run();
+     GlobGuiMainWindow->show();
+     GlobGuiMainWindow->Run();
   }
 }
 
 void HideQueryTree(BOOL flag) 
 {
-  if (MainWindow::IsQuiting)
+  if (MainWindow::IsQuitting)
     return;
-  mainWindow_->setVisible(flag);
+  GlobGuiMainWindow->setVisible(flag);
 }
 
 void DisplayTDBTree(Sqlcmpdbg::CompilationPhase phase, 
                       void *tdb, void *fragDir) 
 {
-  if (MainWindow::IsQuiting)
+  if (MainWindow::IsQuitting)
     return;
 
-  if (!mainWindow_->NeedToDisplay(phase)) 
+  if (!GlobGuiMainWindow->NeedToDisplay(phase)) 
     return;
   //-----------------------------------------------------------------------------
   // GSH : The document class of the SQL/debug MDI DLL holds all the data that 
@@ -129,25 +133,58 @@
   // member function setDocumentData(ExprNode* tree = NULL, CascadesPlan* plan=NULL) 
   // function to set the private data members of the document object.
   //-----------------------------------------------------------------------------
-  mainWindow_->CreateTDBView();
-  mainWindow_->m_querydata->SetTDBData(tdb, fragDir);
-  mainWindow_->m_querydata->SetPhase(phase);
-  mainWindow_->show();
-  mainWindow_->UpdateAllViews();
-  mainWindow_->Run();
-  mainWindow_->hide();
+  GlobGuiMainWindow->CreateTDBView();
+  GlobGuiMainWindow->m_querydata->SetTDBData(tdb, fragDir);
+  GlobGuiMainWindow->m_querydata->SetPhase(phase);
+  GlobGuiMainWindow->show();
+  GlobGuiMainWindow->UpdateAllViews();
+  GlobGuiMainWindow->Run();
+  GlobGuiMainWindow->hide();
 }
 
-NABoolean DisplayExecution(void)
+int  ExecutionDisplayIsEnabled(void)
 {
-  *CmpCommon::diags() << DgSqlCode(DISPLAY_WARNING);
-  return FALSE;
+  return GlobGuiMainWindow->MainWindow::NeedToDisplay(
+       Sqlcmpdbg::DURING_EXECUTION);
+}
+
+void SqldbgSetExePointers(void *rootTcb,
+                          void *cliGlobals,
+                          void *dummy)
+{
+  // TODO: determine if this is needed, scheduler has all ptrs
+}
+
+void DisplayExecution(ExSubtask **subtask, ExScheduler *scheduler)
+{
+  ExeSchedWindow *myWindow = ExeSchedWindow::findInstance(scheduler);
+
+  if (GlobGuiMainWindow)
+    {
+      delete GlobGuiMainWindow;
+      GlobGuiMainWindow = NULL;
+    }
+
+  if (subtask == NULL)
+    {
+      // passing a NULL subtask is a sign that
+      // we are done, delete the window
+      if (scheduler)
+        ExeSchedWindow::deleteInstance(scheduler);
+      return;
+    }
+
+  if (!myWindow->needToStop(*subtask, scheduler))
+    // no need to stop at this task
+    return;
+
+  myWindow->run(subtask);
 }
 
 void CleanUp(void)
 {
-  if(mainWindow_)
-    delete mainWindow_;
-  mainWindow_ = NULL;
+  if(GlobGuiMainWindow)
+    delete GlobGuiMainWindow;
+  GlobGuiMainWindow = NULL;
 }
 
diff --git a/core/sql/SqlCompilerDebugger/ExportFunctionSqlCmpDbg.h b/core/sql/SqlCompilerDebugger/ExportFunctionSqlCmpDbg.h
index 28a1186..3328f44 100644
--- a/core/sql/SqlCompilerDebugger/ExportFunctionSqlCmpDbg.h
+++ b/core/sql/SqlCompilerDebugger/ExportFunctionSqlCmpDbg.h
@@ -25,14 +25,14 @@
 using namespace std;
 
 #include "CommonSqlCmpDbg.h"
-extern "C" Q_DECL_EXPORT SqlcmpdbgExpFuncs * GetSqlcmpdbgExpFuncs (void);
+extern "C" Q_DECL_EXPORT SqlcmpdbgExpFuncs * GetSqlcmpdbgExpFuncs ();
 extern "C" Q_DECL_EXPORT void DisplayQueryTree (Sqlcmpdbg::CompilationPhase
 						phase, void *tree =
 						NULL, void *plan = NULL);
-extern "C" Q_DECL_EXPORT void SqldbgSetPointers (void *memo, void *tasklist,
-						 void *analysis,
-						 void *currentContext,
-						 void *ClusterInfo);
+extern "C" Q_DECL_EXPORT void SqldbgSetCmpPointers (void *memo, void *tasklist,
+                                                    void *analysis,
+                                                    void *currentContext,
+                                                    void *ClusterInfo);
 extern "C" Q_DECL_EXPORT void DoMemoStep (Int32 passNo = -1, Int32 groupNo =
 					  -1, Int32 taskNo = -1, void *task =
 					  NULL, void *expr =
@@ -41,7 +41,11 @@
 extern "C" Q_DECL_EXPORT void DisplayTDBTree (Sqlcmpdbg::CompilationPhase
 					      phase, void *tdb,
 					      void *fragDir);
-extern "C" Q_DECL_EXPORT NABoolean DisplayExecution (void);
+extern "C" Q_DECL_EXPORT int  ExecutionDisplayIsEnabled (void);
+extern "C" Q_DECL_EXPORT void SqldbgSetExePointers (void *rootTcb,
+                                                    void *cliGlobals,
+                                                    void *dummy);
+extern "C" Q_DECL_EXPORT void DisplayExecution (ExSubtask**, ExScheduler *);
 
 extern "C" Q_DECL_EXPORT void CleanUp(void);
 #endif // EXPORTFUNCTIONSQLCMPDBG_H
diff --git a/core/sql/SqlCompilerDebugger/MainWindow.cpp b/core/sql/SqlCompilerDebugger/MainWindow.cpp
index 17d75df..ee8d87d 100644
--- a/core/sql/SqlCompilerDebugger/MainWindow.cpp
+++ b/core/sql/SqlCompilerDebugger/MainWindow.cpp
@@ -35,20 +35,20 @@
   The QApplication should be constructed before any UI control variables, e.g. the MainWindow.
   Otherwise, the UI cannot be launch due to errors.
 */
-QApplication* application_ = NULL;
+QApplication* GlobGuiApplication = NULL;
 
 /*
   The MainWindow must be constucted after the QApplication.
   Otherwise, the UI cannot be launch due to errors.
 
-  For every display query sesion,
-  MainWindow one object will be created when GetSqlcmpdbgExpFuncs is called,
-  and delete at end of DisplayTDBTree
+  For every display query session, the MainWindow global
+  object will be created when SqldbgSetCmpPointers is called
+  for the first time.
 */
 
-MainWindow *mainWindow_ = NULL;
-SqlcmpdbgExpFuncs exportFunctions_;
-NABoolean MainWindow::IsQuiting = false;
+MainWindow *GlobGuiMainWindow = NULL;
+SqlcmpdbgExpFuncs GlobGuiExportFunctions;
+NABoolean MainWindow::IsQuitting = false;
 
 
 MainWindow::MainWindow(QWidget * parent):QMainWindow(parent), ui(new Ui::MainWindow),
@@ -57,7 +57,7 @@
     ui->setupUi(this);
     //Initialize
     m_FinishAllOptimizePass = FALSE;
-    IsQuiting = FALSE;
+    IsQuitting = FALSE;
     // Set center screen
     QDesktopWidget *desktop = QApplication::desktop();
     move((desktop->width() - this->width()) / 2,
@@ -86,13 +86,14 @@
 NABoolean MainWindow::Run()
 {
     IsBackToSqlCompiler_ = FALSE;
-    IsQuiting = FALSE;
+    IsQuitting = FALSE;
     while (!IsBackToSqlCompiler_)
     {
-        if (!IsQuiting)
+        if (!IsQuitting)
         {
-            application_->processEvents(QEventLoop::WaitForMoreEvents |
-                                       QEventLoop::EventLoopExec);
+            GlobGuiApplication->processEvents(
+                 QEventLoop::WaitForMoreEvents |
+                 QEventLoop::EventLoopExec);
         }
         else
         {
@@ -185,7 +186,7 @@
         retval = m_breakpoint->brkAfterTDBgen;
         break;
     case Sqlcmpdbg::DURING_EXECUTION:
-        retval = FALSE;
+        retval = m_breakpoint->brkDuringExecution;
         break;
     case Sqlcmpdbg::DURING_MEMOIZATION:
         retval = TRUE;
@@ -718,7 +719,7 @@
     }
     else
     {
-      IsQuiting = TRUE;
+      IsQuitting = TRUE;
       event->accept();
     }
 }
diff --git a/core/sql/SqlCompilerDebugger/MainWindow.h b/core/sql/SqlCompilerDebugger/MainWindow.h
index 8386162..9e80f1a 100644
--- a/core/sql/SqlCompilerDebugger/MainWindow.h
+++ b/core/sql/SqlCompilerDebugger/MainWindow.h
@@ -54,9 +54,10 @@
   void CreateTDBView();
   void RestoreGeometry();
   void SaveGeometry();
+  NABoolean IsDisplayExecutionEnabled();
 
   NABoolean IsBackToSqlCompiler_;
-  static NABoolean IsQuiting;
+  static NABoolean IsQuitting;
   QueryData *m_querydata;
 
 protected:
diff --git a/core/sql/SqlCompilerDebugger/QueryMemoView.cpp b/core/sql/SqlCompilerDebugger/QueryMemoView.cpp
index b007e8c..144a0aa 100644
--- a/core/sql/SqlCompilerDebugger/QueryMemoView.cpp
+++ b/core/sql/SqlCompilerDebugger/QueryMemoView.cpp
@@ -23,7 +23,8 @@
 #include "QueryData.h"
 #include "MainWindow.h"
 
-extern MainWindow *mainWindow_;
+// defined in MainWindow.cpp
+extern MainWindow *GlobGuiMainWindow;
 
 
 DirtyGrid::DirtyGrid(Int32 row, Int32 col,const QIcon & pict) :
@@ -164,10 +165,10 @@
 void QueryMemoView::syncToDocument() 
 {
   // make Grp No and Exp No consistent with the plan in the document.
-  m_memo =  (CascadesMemo*)(mainWindow_->m_querydata->GetMemo());
+  m_memo =  (CascadesMemo*)(GlobGuiMainWindow->m_querydata->GetMemo());
   void *plan = NULL;
   void *query = NULL;
-  mainWindow_->m_querydata->GetData(&query, &plan);
+  GlobGuiMainWindow->m_querydata->GetData(&query, &plan);
   if(plan)
     syncGrpNoExpNoToPlan((CascadesPlan *)plan);
 }
@@ -220,13 +221,13 @@
   {
        logprint("m_stopTask:%p => task:%p\n", m_stopTask, task);
        m_hold = TRUE;
-       m_memo =  (CascadesMemo*)(mainWindow_->m_querydata->GetMemo());
-       m_cascadesTask = (CascadesTaskList*)(mainWindow_->m_querydata->GetTaskList());
+       m_memo =  (CascadesMemo*)(GlobGuiMainWindow->m_querydata->GetMemo());
+       m_cascadesTask = (CascadesTaskList*)(GlobGuiMainWindow->m_querydata->GetTaskList());
        //------------------------------------------------------------------
        // GSH : First we need to update the memo view with the latest memo
        // and task list.
        //------------------------------------------------------------------
-       m_analysis = (QueryAnalysis*)(mainWindow_->m_querydata->GetAnalysis());
+       m_analysis = (QueryAnalysis*)(GlobGuiMainWindow->m_querydata->GetAnalysis());
 
        UpdateGroupList();
 
@@ -474,7 +475,7 @@
   // display the text describing each task in the m_task List control of
   // the Memo View.
   //---------------------------------------------------------------------
-  m_cascadesTask = (CascadesTaskList*)(mainWindow_->m_querydata->GetTaskList());
+  m_cascadesTask = (CascadesTaskList*)(GlobGuiMainWindow->m_querydata->GetTaskList());
   //---------------------------------------------------------------------
   // GSH : Don't do anything if we aren't optimizing
   //---------------------------------------------------------------------
@@ -605,14 +606,14 @@
 void QueryMemoView::setDisplayExpr(RelExpr* expr, CascadesPlan* plan)
 {
   // need to update m_currGrpNo & m_currExpNo
-  mainWindow_->m_querydata->SetData(expr, plan);
-  //mainWindow_->UpdateAllViews();
-  mainWindow_->UpdateQueryTreeView();
+  GlobGuiMainWindow->m_querydata->SetData(expr, plan);
+  //GlobGuiMainWindow->UpdateAllViews();
+  GlobGuiMainWindow->UpdateQueryTreeView();
 }
 
 void QueryMemoView::DrawMemo(void)
 { 	
-  m_memo = (CascadesMemo*)(mainWindow_->m_querydata->GetMemo());
+  m_memo = (CascadesMemo*)(GlobGuiMainWindow->m_querydata->GetMemo());
   if(!m_memo){
     m_currGrpNo = 0;
     m_currExpNo = 0;
@@ -918,7 +919,7 @@
 {
   ResetMemoStops();
   StopAtNextTask(TRUE);
-  mainWindow_->IsBackToSqlCompiler_ = true;
+  GlobGuiMainWindow->IsBackToSqlCompiler_ = true;
   turnOffMemoTrack();
 }
 
@@ -932,7 +933,7 @@
     }
     ResetMemoStops();
     StopAtTaskNo(ui->task_spin->value(), TRUE);		
-    mainWindow_->IsBackToSqlCompiler_ = true;
+    GlobGuiMainWindow->IsBackToSqlCompiler_ = true;
 }
 
 void QueryMemoView::OnMemoStepTask()
@@ -946,7 +947,7 @@
          return;
        ResetMemoStops();
        StopAtTask(task, TRUE);
-       mainWindow_->IsBackToSqlCompiler_ = true;
+       GlobGuiMainWindow->IsBackToSqlCompiler_ = true;
     }
 }
 
@@ -954,27 +955,27 @@
 {
   ResetMemoStops();
   StopAtExpr(ui->group_spin->value(), -1, TRUE);	
-  mainWindow_->IsBackToSqlCompiler_ = true;
+  GlobGuiMainWindow->IsBackToSqlCompiler_ = true;
 }
 
 void QueryMemoView::OnMemoStepexpr() 
 {
   ResetMemoStops();
   StopAtExpr(ui->group_spin->value(), ui->expr_spin->value(), TRUE);		
-  mainWindow_->IsBackToSqlCompiler_ = true;
+  GlobGuiMainWindow->IsBackToSqlCompiler_ = true;
 }
 
 void QueryMemoView::OnMemoFinish() 
 {
   ResetMemoStops();
-  mainWindow_->IsBackToSqlCompiler_ = true;
+  GlobGuiMainWindow->IsBackToSqlCompiler_ = true;
   turnOffMemoTrack();
 }
 
 void QueryMemoView::OnMemoFinishpass() 
 {
   ResetMemoStops();
-  mainWindow_->IsBackToSqlCompiler_ = true;
+  GlobGuiMainWindow->IsBackToSqlCompiler_ = true;
   turnOffMemoTrack();
 }
 
@@ -1064,7 +1065,7 @@
 	}
     }
     //set tree root of query viewer
-    mainWindow_->m_querydata->SetData(e, p);
-    mainWindow_->UpdateQueryTreeView();
+    GlobGuiMainWindow->m_querydata->SetData(e, p);
+    GlobGuiMainWindow->UpdateQueryTreeView();
   }
 }
diff --git a/core/sql/SqlCompilerDebugger/QueryTreeView.cpp b/core/sql/SqlCompilerDebugger/QueryTreeView.cpp
index fc9c1f1..da6caa2 100644
--- a/core/sql/SqlCompilerDebugger/QueryTreeView.cpp
+++ b/core/sql/SqlCompilerDebugger/QueryTreeView.cpp
@@ -23,7 +23,8 @@
 #include "MainWindow.h"
 #include "QueryData.h"
 
-extern MainWindow *mainWindow_;
+// defined in MainWindow.cpp
+extern MainWindow *GlobGuiMainWindow;
 
 QueryTreeView::QueryTreeView(QWidget * parent):
 QWidget(parent), ui(new Ui::QueryTreeView)
@@ -63,7 +64,7 @@
     //------------------------------------------------------------------
     void *tree;
     void *plan;
-    mainWindow_->m_querydata->GetData(&tree, &plan);
+    GlobGuiMainWindow->m_querydata->GetData(&tree, &plan);
     DisplayQueryTree(tree, plan, NULL);
     ui->m_tree->expandAll();
     for (int i = 0; i < ui->m_tree->columnCount(); i++)
@@ -410,8 +411,8 @@
     DFTDETAILS *pDft = v.value < DFTDETAILS * >();
     if (NULL != pDft)
     {
-        mainWindow_->m_querydata->SetCurrExprAndPlan(pDft->currNode,
-                                                     pDft->currPlan);
-        mainWindow_->popUpContextMenu(QCursor::pos());
+        GlobGuiMainWindow->m_querydata->SetCurrExprAndPlan(pDft->currNode,
+                                                           pDft->currPlan);
+        GlobGuiMainWindow->popUpContextMenu(QCursor::pos());
     }
 }
diff --git a/core/sql/SqlCompilerDebugger/SqlCmpDbg.pro b/core/sql/SqlCompilerDebugger/SqlCmpDbg.pro
index 09df424..6b1e10a 100644
--- a/core/sql/SqlCompilerDebugger/SqlCmpDbg.pro
+++ b/core/sql/SqlCompilerDebugger/SqlCmpDbg.pro
@@ -56,7 +56,10 @@
     QueryAnalysisView.cpp \
     TDBDlgExprList.cpp \
     TDBDlgMdamNet.cpp \
-    vers_compilerDebugger.cpp
+    vers_compilerDebugger.cpp \
+    ExeSchedWindow.cpp \
+    TCBTreeView.cpp \
+    ExeQueueDisplay.cpp
 
 HEADERS  += MainWindow.h \
     BreakpointDialog.h \
@@ -73,7 +76,10 @@
     RulesDialog.h \
     QueryAnalysisView.h \
     TDBDlgExprList.h \
-    TDBDlgMdamNet.h
+    TDBDlgMdamNet.h \
+    ExeSchedWindow.h \
+    TCBTreeView.h \
+    ExeQueueDisplay.h
  
 FORMS    += MainWindow.ui \
     BreakpointDialog.ui \
@@ -87,7 +93,10 @@
     RulesDialog.ui \
     QueryAnalysisView.ui \
     TDBDlgExprList.ui \
-    TDBDlgMdamNet.ui
+    TDBDlgMdamNet.ui \
+    ExeSchedWindow.ui \
+    TCBTreeView.ui \
+    ExeQueueDisplay.ui
 
 RESOURCES += \
     Resource.qrc
@@ -119,7 +128,9 @@
                ../../sqf/export/include \
                ../../sqf/commonLogger \
                $$(LOG4CXX_INC_DIR) \
-               $$(LOG4CXX_INC_DIR)/lib4cxx
+               $$(LOG4CXX_INC_DIR)/lib4cxx \
+               $$(JAVA_HOME)/include \
+               $$(JAVA_HOME)/include/linux
 
 
 INCLUDEPATH += ../../sqf/sql/inc \
diff --git a/core/sql/SqlCompilerDebugger/TCBTreeView.cpp b/core/sql/SqlCompilerDebugger/TCBTreeView.cpp
new file mode 100644
index 0000000..f3c67fa
--- /dev/null
+++ b/core/sql/SqlCompilerDebugger/TCBTreeView.cpp
@@ -0,0 +1,364 @@
+// @@@ START COPYRIGHT @@@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+// @@@ END COPYRIGHT @@@
+#include <typeinfo>
+#include "TCBTreeView.h"
+#include "ExeSchedWindow.h"
+#include "ExeQueueDisplay.h"
+#include "ui_TCBTreeView.h"
+#include "CommonSqlCmpDbg.h"
+#include "ComTdb.h"
+#include "ex_tcb.h"
+#include "ExScheduler.h"
+
+TCBTreeView::TCBTreeView(ExeSchedWindow *mainExeWindow,
+                         QWidget *parent) :
+    QWidget(parent),
+    ui(new Ui::TCBTreeView),
+    mainExeWindow_(mainExeWindow)
+{
+    currTcb_ = NULL;
+    ui->setupUi(this);
+    QStringList header;
+    header << "TCB/Task Tree" << "Break" << "Scheduled" << "Down" << "Up";
+    QTreeWidgetItem *hdrItem = new QTreeWidgetItem(header);
+    hdrItem->setIcon(0, QIcon(":/file/Resource/Main/Sqlnode.bmp"));
+    ui->treeWidget->setHeaderItem(hdrItem);
+    ui->treeWidget->setSelectionBehavior(QAbstractItemView::SelectItems);
+    ui->treeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
+    ui->treeWidget->setIconSize(QSize(32, 32));
+    ui->treeWidget->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
+    ui->treeWidget->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
+}
+
+TCBTreeView::~TCBTreeView()
+{
+    delete ui;
+}
+
+void TCBTreeView::on_treeWidget_itemClicked(QTreeWidgetItem *item, int column)
+{
+  QVariant itemData = item->data(0, Qt::UserRole);
+  TcbTreeDetails *itemDetails = itemData.value <TcbTreeDetails *>();
+
+  switch (column)
+    {
+    case 0:
+      if (itemDetails->currTask)
+        {
+          // clicking on a task name:
+          // set the next task to be executed to this one
+          ExSubtask **subtaskPtr = mainExeWindow_->getSubtaskPtr();
+
+          if (subtaskPtr && *subtaskPtr)
+            *subtaskPtr = itemDetails->currTask;
+        }
+      break;
+
+    case 1:
+      if (itemDetails->currTask)
+        {
+          // clicking on a breakpoint cell of a task:
+          // toggle the breakpoint between on/off
+          int brkpt = itemDetails->currTask->getBreakPoint();
+
+          if (brkpt)
+            brkpt = 0;
+          else
+            brkpt = 1;
+          itemDetails->currTask->setBreakPoint(brkpt);
+        }
+      break;
+
+    case 2:
+      if (itemDetails->currTask)
+        // clicking on the "scheduled" field of a task: schedule
+        itemDetails->currTask->schedule();
+      break;
+
+    case 3:
+      if (itemDetails->currTask == NULL)
+        {
+          // clicking on the number of rows in the down queue:
+          if (!itemDetails->currDnQueueDisplay)
+            {
+              itemDetails->currDnQueueDisplay = new ExeQueueDisplay(
+                   itemDetails->currTcb,
+                   false,
+                   this);
+              itemDetails->currDnQueueDisplay->show();
+            }
+        }
+      break;
+
+    case 4:
+      if (itemDetails->currTask == NULL)
+        {
+          // clicking on the number of rows in the up queue:
+          if (!itemDetails->currUpQueueDisplay)
+            {
+              itemDetails->currUpQueueDisplay = new ExeQueueDisplay(
+                   itemDetails->currTcb,
+                   true,
+                   this);
+              itemDetails->currUpQueueDisplay->show();
+            }
+        }
+      break;
+
+    default:
+      break;
+    }
+
+  if (itemDetails->currTask)
+    setBreakSchedInfo(item,
+                      (itemDetails->currTask->getBreakPoint() > 0 ? 1 : 0),
+                      (itemDetails->currTask->isScheduled() ? "*" : ""));
+}
+
+void TCBTreeView::UpdateView()
+{
+    //------------------------------------------------------------------
+    // Delete the existing Tree.
+    //------------------------------------------------------------------
+}
+
+void TCBTreeView::displayTcbTree(const ex_tcb *tcb,
+                                 ExSubtask *currSubtask,
+                                 ExScheduler *sched,
+                                 bool includeTasks,
+                                 QTreeWidgetItem * parentTreeItem)
+{
+    if (parentTreeItem == NULL)
+      {
+        // for the top-level caller, start with the fragment root TCB
+        currTcb_ = tcb;
+        tcb = sched->getLocalRootTcbForGui();
+      }
+
+    if (tcb != NULL)
+      {
+        const ComTdb *tdb = tcb->getTdb();
+        int arity = tcb->numChildren();
+        Int32 bitmapIndex;
+        QString nodeText;
+        const char *breakText = " ";
+        const char *scheduledText = " ";
+        TcbTreeDetails *itemDetails = new TcbTreeDetails(tcb, sched);
+
+        getOperatorImageText(tdb, bitmapIndex, nodeText);
+
+        QStringList rowValues;
+        ex_queue_pair parentQueue = tcb->getParentQueue();
+        rowValues.append(nodeText);
+        QTreeWidgetItem *tcbTreeItem = new QTreeWidgetItem(rowValues);
+
+        if (parentQueue.down)
+          {
+            tcbTreeItem->setText(3, QString("%1").arg(parentQueue.down->getLength()));
+            if (parentQueue.down->isFull())
+              tcbTreeItem->setBackgroundColor(3, QColor("mistyrose"));
+          }
+        if (parentQueue.up)
+          {
+            tcbTreeItem->setText(4, QString("%1").arg(parentQueue.up->getLength()));
+            if (parentQueue.up->isFull())
+              tcbTreeItem->setBackgroundColor(4, QColor("mistyrose"));
+          }
+
+        tcbTreeItem->setIcon(0, QIcon(":/file/Resource/Main/Sqlnode.bmp"));
+        QString tip = QString("%1@0x%2").arg(typeid(*tcb).name()).arg((ulong)tcb, 0, 16);
+        tcbTreeItem->setToolTip(0, tip);
+        if (tcb == currTcb_ && !includeTasks)
+          tcbTreeItem->setBackgroundColor(0, QColor("salmon"));
+        if (parentTreeItem == NULL)
+          {
+            ui->treeWidget->clear();
+            ui->treeWidget->addTopLevelItem(tcbTreeItem);
+          }
+        else
+          {
+            parentTreeItem->addChild(tcbTreeItem);
+          }
+
+        itemDetails->currTcb = tcb;
+        itemDetails->currSched = sched;
+        itemDetails->currTask = NULL;
+        QVariant itemData = qVariantFromValue(itemDetails);
+        tcbTreeItem->setData(0, Qt::UserRole, itemData);
+        //set column alignment for each row
+        tcbTreeItem->setTextAlignment(1, Qt::AlignCenter | Qt::AlignVCenter);
+        tcbTreeItem->setTextAlignment(2, Qt::AlignCenter | Qt::AlignVCenter);
+
+        if (nodeText.compare(QString("NULL")))
+          {
+            tcbTreeItem->setText(1, QString(breakText));
+            tcbTreeItem->setText(2, QString(scheduledText));
+          }
+
+        displayTcbTasks(tcb, currSubtask, sched, includeTasks, tcbTreeItem);
+
+        for (Int32 i = arity - 1; i >= 0; i--)
+          {
+            const ex_tcb *childTcb = tcb->getChild(i);
+
+            displayTcbTree(childTcb, currSubtask, sched, includeTasks, tcbTreeItem);
+          }
+        if (parentTreeItem == NULL)
+          {
+            // make some final adjustments
+            ui->treeWidget->expandAll();
+            for (int i = 0; i < ui->treeWidget->columnCount(); i++)
+              {
+                ui->treeWidget->resizeColumnToContents(i);
+                int width = ui->treeWidget->columnWidth(i);
+                if (i == 2 && width > 70)
+                  // restrict the last column (breakpoints)
+                  // to a small size, otherwise the resize
+                  // process expands it all the way
+                  width = 70;
+                ui->treeWidget->setColumnWidth(i, width + 20);
+              }
+          }
+      }  //tdbTree != NULL
+}
+
+void TCBTreeView::displayTcbTasks(const ex_tcb *tcb,
+                                  ExSubtask *currSubtask,
+                                  ExScheduler *sched,
+                                  bool expandTasks,
+                                  QTreeWidgetItem *tcbTreeItem)
+{
+   ExSubtask *subtask = sched->getSubtasksForGui();
+   int numBreakpoints = 0;
+   std::string isScheduled;
+   while (subtask)
+     {
+       if (subtask->getTcb() == tcb)
+         {
+           if (expandTasks)
+             {
+               QString nodeTextData = QString(QLatin1String(subtask->getTaskName()));
+               QStringList rowValues;
+               rowValues.append(nodeTextData);
+               QTreeWidgetItem *taskTreeItem = new QTreeWidgetItem(rowValues);
+               TcbTreeDetails *itemDetails = new TcbTreeDetails(tcb, sched, subtask);
+
+               taskTreeItem->setIcon(0, QIcon(":/file/Resource/Main/T.bmp"));
+               QString tip = QString("%1@0x%2").arg(typeid(*subtask).name()).arg((ulong)subtask, 0, 16);
+               taskTreeItem->setToolTip(0, tip);
+               tcbTreeItem->addChild(taskTreeItem);
+
+               itemDetails->currTcb = tcb;
+               itemDetails->currSched = sched;
+               itemDetails->currTask = subtask;
+               QVariant itemData = qVariantFromValue(itemDetails);
+               taskTreeItem->setData(0, Qt::UserRole, itemData);
+               //set column alignment for each row
+               taskTreeItem->setTextAlignment(1, Qt::AlignCenter | Qt::AlignVCenter);
+               taskTreeItem->setTextAlignment(2, Qt::AlignCenter | Qt::AlignVCenter);
+
+               if (nodeTextData.compare(QString("NULL")))
+                 {
+                   setBreakSchedInfo(taskTreeItem,
+                                     (subtask->getBreakPoint() > 0 ? 1 : 0),
+                                     (subtask->isScheduled() ? "*" : ""));
+                   if (subtask == currSubtask)
+                     taskTreeItem->setBackgroundColor(0, QColor("salmon"));
+                 }
+             } // expandTasks
+           else
+             {
+               // aggregate breakpoint and scheduled information at the task level
+               if (subtask->isScheduled())
+                 numBreakpoints++;
+               if (subtask->getBreakPoint() > 0)
+                 {
+                   std::string taskText(subtask->getTaskName());
+
+                   if (taskText.length() == 0 || taskText.at(0) == ' ')
+                     taskText = "*";
+                   taskText.append(",");
+                   if (isScheduled.find(taskText) != std::string::npos)
+                     {
+                       isScheduled.append(subtask->getTaskName());
+                       isScheduled.append(",");
+                     }
+                 }
+             } // don't list tasks in the tree view
+         } // task is for the current TCB
+       subtask = subtask->getNextForGUI();
+     } // loop over all subtasks
+   setBreakSchedInfo(tcbTreeItem, numBreakpoints, isScheduled.c_str());
+}
+
+void TCBTreeView::getOperatorImageText (const ComTdb *tdb,
+                                        Int32 & bitmapIndex,
+                                        QString &nodeText)
+{
+    nodeText = QString("%1 (Id: %2 Ex: %3)").
+                arg(tdb->getNodeName()).
+                arg(tdb->getTdbId()).
+                arg(tdb->getExplainNodeId());
+    ComTdb::ex_node_type opType = tdb->getNodeType();
+    switch (opType)
+      {
+      case ComTdb::ex_ROOT:
+        bitmapIndex = IDX_ROOT;
+        break;
+      case ComTdb::ex_ONLJ:
+      case ComTdb::ex_MJ:
+      case ComTdb::ex_HASHJ:
+      case ComTdb::ex_TUPLE_FLOW:
+        bitmapIndex = IDX_JOIN;
+        break;
+      case ComTdb::ex_HBASE_ACCESS:
+      case ComTdb::ex_HDFS_SCAN:
+        bitmapIndex = IDX_SCAN;
+        break;
+      default:
+        bitmapIndex = IDX_GENERIC;
+      }
+}
+
+void TCBTreeView::setBreakSchedInfo(QTreeWidgetItem *treeItem,
+                                    int numBreakpoints,
+                                    const char *schedTasks)
+{
+    std::string schedText(schedTasks);
+
+    if (numBreakpoints > 0)
+      {
+        treeItem->setText(1, QString("*"));
+        treeItem->setBackgroundColor(1,"orangered");
+      }
+    else
+      {
+        treeItem->setText(1, QString(" "));
+      }
+    if (schedText.length() > 0 && schedText.at(schedText.length()-1) == ',')
+      schedText.erase(schedText.length()-1);
+    if (schedText.length() > 16)
+      schedText = "*";
+    treeItem->setText(2, QString(schedText.c_str()));
+    if (schedText.length() > 0)
+      treeItem->setBackgroundColor(2,"lightblue");
+}
+
diff --git a/core/sql/SqlCompilerDebugger/TCBTreeView.h b/core/sql/SqlCompilerDebugger/TCBTreeView.h
new file mode 100644
index 0000000..276723b
--- /dev/null
+++ b/core/sql/SqlCompilerDebugger/TCBTreeView.h
@@ -0,0 +1,98 @@
+// @@@ START COPYRIGHT @@@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+// @@@ END COPYRIGHT @@@
+#ifndef TCBTREEVIEW_H
+#define TCBTREEVIEW_H
+
+#include <QtGui>
+#include "CommonSqlCmpDbg.h"
+
+namespace Ui {
+class TCBTreeView;
+}
+
+class ex_tcb;
+class ExScheduler;
+class ExSubtask;
+class ExeQueueDisplay;
+class ExeSchedWindow;
+
+struct TcbTreeDetails : public QObject
+{
+  const ex_tcb *currTcb;
+  ExScheduler *currSched;
+  ExSubtask *currTask;
+  ExeQueueDisplay *currDnQueueDisplay;
+  ExeQueueDisplay *currUpQueueDisplay;
+
+  TcbTreeDetails(const ex_tcb *tcb,
+                 ExScheduler *sched,
+                 ExSubtask *subtask = NULL)
+  {
+    currTcb = tcb;
+    currSched = sched;
+    currTask = subtask;
+    currDnQueueDisplay = NULL;
+    currUpQueueDisplay = NULL;
+  }
+
+};
+
+Q_DECLARE_METATYPE (TcbTreeDetails *);	// This is for QTreeWidgetItem.setData()
+
+class TCBTreeView : public QWidget
+{
+    Q_OBJECT
+
+public:
+    explicit TCBTreeView(ExeSchedWindow *mainExeWindow,
+                         QWidget *parent = 0);
+    ~TCBTreeView();
+
+  void UpdateView();
+  void displayTcbTree(const ex_tcb *tcb,
+                      ExSubtask *currSubtask,
+                      ExScheduler *sched,
+                      bool includeTasks = true,
+                      QTreeWidgetItem *parentTreeItem = NULL);
+
+private slots:
+    void on_treeWidget_itemClicked(QTreeWidgetItem *item, int column);
+
+private:
+    Ui::TCBTreeView *ui;
+
+    void displayTcbTasks(const ex_tcb *tcb,
+                         ExSubtask *currSubtask,
+                         ExScheduler *sched,
+                         bool expandTasks,
+                         QTreeWidgetItem *tcbTreeItem);
+    void getOperatorImageText(const ComTdb *tdb,
+                              Int32 & bitmapIndex,
+                              QString &nodeText);
+    void setBreakSchedInfo(QTreeWidgetItem *treeItem,
+                           int numBreakpoints,
+                           const char *schedTasks);
+    // currently active TCB and subtask
+    const ex_tcb *currTcb_;
+    ExeSchedWindow *mainExeWindow_;
+};
+
+#endif // TCBTREEVIEW_H
diff --git a/core/sql/SqlCompilerDebugger/TCBTreeView.ui b/core/sql/SqlCompilerDebugger/TCBTreeView.ui
new file mode 100644
index 0000000..5721c82
--- /dev/null
+++ b/core/sql/SqlCompilerDebugger/TCBTreeView.ui
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<ui version="4.0">
+ <class>TCBTreeView</class>
+ <widget class="QWidget" name="TCBTreeView">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>418</width>
+    <height>249</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <property name="leftMargin">
+    <number>2</number>
+   </property>
+   <property name="topMargin">
+    <number>2</number>
+   </property>
+   <property name="rightMargin">
+    <number>2</number>
+   </property>
+   <property name="bottomMargin">
+    <number>2</number>
+   </property>
+   <item>
+    <widget class="QScrollArea" name="scrollArea">
+     <property name="verticalScrollBarPolicy">
+      <enum>Qt::ScrollBarAlwaysOn</enum>
+     </property>
+     <property name="horizontalScrollBarPolicy">
+      <enum>Qt::ScrollBarAlwaysOn</enum>
+     </property>
+     <property name="widgetResizable">
+      <bool>true</bool>
+     </property>
+     <widget class="QWidget" name="scrollAreaWidgetContents">
+      <property name="geometry">
+       <rect>
+        <x>0</x>
+        <y>0</y>
+        <width>397</width>
+        <height>228</height>
+       </rect>
+      </property>
+      <property name="sizePolicy">
+       <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+        <horstretch>0</horstretch>
+        <verstretch>0</verstretch>
+       </sizepolicy>
+      </property>
+      <layout class="QVBoxLayout" name="verticalLayout_2">
+       <item>
+        <widget class="QTreeWidget" name="treeWidget">
+         <attribute name="headerVisible">
+          <bool>true</bool>
+         </attribute>
+         <attribute name="headerDefaultSectionSize">
+          <number>104</number>
+         </attribute>
+         <column>
+          <property name="text">
+           <string notr="true">1</string>
+          </property>
+         </column>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/core/sql/SqlCompilerDebugger/TDBTreeView.cpp b/core/sql/SqlCompilerDebugger/TDBTreeView.cpp
index e883494..df1ccd8 100644
--- a/core/sql/SqlCompilerDebugger/TDBTreeView.cpp
+++ b/core/sql/SqlCompilerDebugger/TDBTreeView.cpp
@@ -25,7 +25,8 @@
 #include "TDBDlgMdamNet.h"
 #include "TDBDlgExprList.h"
 
-extern MainWindow *mainWindow_;
+// defined in MainWindow.cpp
+extern MainWindow *GlobGuiMainWindow;
 
 TDBTreeView::TDBTreeView(QWidget * parent):
 QWidget(parent), ui(new Ui::TDBTreeView)
@@ -175,7 +176,7 @@
   ExFragDir* fragDir;
   Lng32 baseAddr;
 
-  mainWindow_->m_querydata->GetTDBData((void**) &tdb, (void**) &fragDir, baseAddr);
+  GlobGuiMainWindow->m_querydata->GetTDBData((void**) &tdb, (void**) &fragDir, baseAddr);
   //------------------------------------------------------------------
   // GSH : Delete the existing Tree.
   //------------------------------------------------------------------
diff --git a/core/sql/arkcmp/CmpErrLog.cpp b/core/sql/arkcmp/CmpErrLog.cpp
index 8cf82ac..bc41974 100644
--- a/core/sql/arkcmp/CmpErrLog.cpp
+++ b/core/sql/arkcmp/CmpErrLog.cpp
@@ -133,19 +133,19 @@
   // On Linux determine the log location based off of TRAF_HOME environment
   // variable.
   char logFilePath[MAX_LOGFILE_NAME_LEN+1];
-  char *sqroot = getenv("TRAF_HOME");
+  char *sqlogs = getenv("TRAF_LOG");
 
   // Use a generated path for the logfile if 3 conditions are met:
-  //   1. TRAF_HOME is set in the environment.
+  //   1. TRAF_LOG is set in the environment.
   //   2. The first character of the logfile starts with a character or digit.
   //   3. The complete path can fit into the size of the "logFilePath" buffer.
-  if ((sqroot != NULL) && 
+  if ((sqlogs != NULL) &&
       (isalnum(logFileName[0])) &&
-      (strlen(sqroot) + strlen(logFileName) < sizeof(logFilePath) - 7))
+      (strlen(sqlogs) + strlen(logFileName) < sizeof(logFilePath) - 2))
   {
     // Create the full path to the log file in the logFilePath buffer.
-    snprintf(logFilePath, sizeof(logFilePath), "%s/logs/%s",
-             sqroot, logFileName);
+    snprintf(logFilePath, sizeof(logFilePath), "%s/%s",
+             sqlogs, logFileName);
 
     // Call renameBigLogFile() to check the size and rename the file
     // if it is too big.
diff --git a/core/sql/bin/SqlciErrors.txt b/core/sql/bin/SqlciErrors.txt
index 6f88b9f..a5ce81c 100644
--- a/core/sql/bin/SqlciErrors.txt
+++ b/core/sql/bin/SqlciErrors.txt
@@ -334,7 +334,7 @@
 1336 ZZZZZ 99999 ADVANCED MAJOR DBADMIN INITIALIZE SQL must specify a $0~String0 statement for the $1~String1.  INITIALIZE SQL fails.
 1337 ZZZZZ 99999 BEGINNER MINOR DBADMIN $0~String0 is a reserved authorization identifier.
 1338 ZZZZZ 99999 ADVANCED MAJOR DBADMIN Role $0~string0 is not defined in the database.
-1339 ZZZZZ 99999 BEGINNER MINOR DBADMIN $0~string0 is not a grantable role.
+1339 ZZZZZ 99999 BEGINNER MINOR DBADMIN $0~string0 is not a role.
 1340 ZZZZZ 99999 BEGINNER MINOR DBADMIN $0~string0 is not a user.
 1341 ZZZZZ 99999 BEGINNER MINOR DBADMIN --- unused ---
 1342 ZZZZZ 99999 BEGINNER MINOR DBADMIN --- unused ---
@@ -670,6 +670,7 @@
 2242 ZZZZZ 99999 BEGINNER MINOR LOGONLY Compiler process unable to log its status and health information to the repository.
 2243 ZZZZZ 99999 BEGINNER MAJOR DBADMIN Using DISPLAY in trafci or DBMgr is not supported.
 2244 ZZZZZ 99999 BEGINNER MAJOR DBADMIN ULOG file path invalid : $0~string0.
+2245 ZZZZZ 99999 BEGINNER MAJOR DBADMIN Error loading libSqlCompilerDebugger.so DLL for the display GUI: $0~string0.
 2900 ZZZZZ 99999 BEGINNER MAJOR DBADMIN in file $0~string0 at line $1~int0:
 2980 ZZZZZ 99999 BEGINNER MAJOR DBADMIN ? Option -g requires an argument.
 2981 ZZZZZ 99999 BEGINNER MAJOR DBADMIN ? Unrecognized argument in option -g
diff --git a/core/sql/bin/SqlciMain.cpp b/core/sql/bin/SqlciMain.cpp
index fc02077..b45f108 100644
--- a/core/sql/bin/SqlciMain.cpp
+++ b/core/sql/bin/SqlciMain.cpp
@@ -216,6 +216,7 @@
     {
       statsGlobals->removeProcess(cliGlobals->myPin());
       statsGlobals->releaseStatsSemaphore(cliGlobals->getSemId(), cliGlobals->myPin());
+      statsGlobals->logProcessDeath(cliGlobals->myCpu(), cliGlobals->myPin(), "Normal process death");
     }
     else if (error == 4011)
     {
diff --git a/core/sql/cli/Cli.cpp b/core/sql/cli/Cli.cpp
index 9fdc051..e6008e4 100644
--- a/core/sql/cli/Cli.cpp
+++ b/core/sql/cli/Cli.cpp
@@ -6248,8 +6248,9 @@
 
 Lng32 SQLCLI_GetRoleList(
    CliGlobals * cliGlobals,
-   Int32 &numRoles,
-   Int32 *&roleIDs)
+   Int32 &numEntries,
+   Int32 *& roleIDs,
+   Int32 *& granteeIDs)
 
 {
    Lng32 retcode = 0;
@@ -6262,7 +6263,7 @@
    ContextCli &currContext = *(cliGlobals->currContext());
    ComDiagsArea &diags = currContext.diags();
 
-   retcode = currContext.getRoleList(numRoles,roleIDs);
+   retcode = currContext.getRoleList(numEntries,roleIDs,granteeIDs);
 
    return CliEpilogue(cliGlobals, NULL, retcode);
 
@@ -6414,31 +6415,37 @@
   }
   else if (attrName == SQL_ATTR_QUERY_TYPE)
   {
-    //for display query e.g. display select ...
-    //just return SUCCESS to suppress error message
-    if(stmt.isDISPLAY())
-    {
-      return SQLCLI_ReturnCode(&context, DISPLAY_DONE_WARNING);
-    }
     if (!stmt.getRootTdb())
     {
-      diags << DgSqlCode(-CLI_STMT_NOT_EXISTS);
-      return SQLCLI_ReturnCode(&context, -CLI_STMT_NOT_EXISTS);
+      //for display query e.g. display select ...
+      //just return SUCCESS to suppress error message
+      if(stmt.isDISPLAY())
+        {
+          return SQLCLI_ReturnCode(&context, DISPLAY_DONE_WARNING);
+        }
+      else
+        {
+          diags << DgSqlCode(-CLI_STMT_NOT_EXISTS);
+          return SQLCLI_ReturnCode(&context, -CLI_STMT_NOT_EXISTS);
+        }
     }
     *numeric_value = stmt.getRootTdb()->getQueryType();
   }
   else if (attrName == SQL_ATTR_SUBQUERY_TYPE)
   {
-    //for display query e.g. display select ...
-    //just return SUCCESS to suppress error message
-    if(stmt.isDISPLAY())
-    {
-      return SQLCLI_ReturnCode(&context, DISPLAY_DONE_WARNING);
-    } 
     if (!stmt.getRootTdb())
     {
-      diags << DgSqlCode(-CLI_STMT_NOT_EXISTS);
-      return SQLCLI_ReturnCode(&context, -CLI_STMT_NOT_EXISTS);
+      //for display query e.g. display select ...
+      //just return SUCCESS to suppress error message
+      if(stmt.isDISPLAY())
+        {
+          return SQLCLI_ReturnCode(&context, DISPLAY_DONE_WARNING);
+        }
+      else
+        {
+          diags << DgSqlCode(-CLI_STMT_NOT_EXISTS);
+          return SQLCLI_ReturnCode(&context, -CLI_STMT_NOT_EXISTS);
+        }
     }
     *numeric_value = stmt.getRootTdb()->getSubqueryType();
   }
@@ -10537,9 +10544,9 @@
       cliRC = cqdCliInterface->holdAndSetCQD("traf_no_dtm_xn", "ON");
     }
 
-  Lng32 numTries = 0;
+  Lng32 numTries = 0, maxRetryNum = sga->getSGRetryNum();
   NABoolean isOk = FALSE;
-  while ((NOT isOk) && (numTries < 10))
+  while ((NOT isOk) && (numTries < maxRetryNum))
     {
       if (startLocalXn)
         {
@@ -10606,8 +10613,11 @@
         }
       
       numTries++;
-      
-      DELAY(100 + numTries*25);
+      Lng32 delayTime = 100 + numTries*25 + rand()%10; 
+      if( delayTime < 1000)   //MAX is 1 second
+          DELAY(delayTime);
+      else
+          DELAY( 900 + rand() % 100);
     }
 
     // could not update it after 10 tries. Return error.
diff --git a/core/sql/cli/Cli.h b/core/sql/cli/Cli.h
index a8a6b9a..c5aa690 100644
--- a/core/sql/cli/Cli.h
+++ b/core/sql/cli/Cli.h
@@ -536,9 +536,10 @@
 
 Lng32 SQLCLI_GetRoleList(
    CliGlobals *cliGlobals,
-   Int32 &numRoles,
-   Int32 *&roleIDs);
-                         
+   Int32 &numEntries,
+   Int32 *& roleIDs,
+   Int32 *& granteeIDs);
+
 Lng32 SQLCLI_ResetRoleList (
     /*IN*/            CliGlobals *cliGlobals);
 
diff --git a/core/sql/cli/CliExtern.cpp b/core/sql/cli/CliExtern.cpp
index 69e4717..7091d14 100644
--- a/core/sql/cli/CliExtern.cpp
+++ b/core/sql/cli/CliExtern.cpp
@@ -4346,8 +4346,9 @@
 
 
 Lng32 SQL_EXEC_GetRoleList(
-   Int32 &numRoles,
-   Int32 *&roleIDs)
+   Int32 &numEntries,
+   Int32 *& roleIDs,
+   Int32 *& granteeIDs)
 
 {
 
@@ -4363,8 +4364,9 @@
       threadContext->incrNumOfCliCalls();
       retcode =
       SQLCLI_GetRoleList(GetCliGlobals(),
-                         numRoles,
-                         roleIDs);
+                         numEntries,
+                         roleIDs,
+                         granteeIDs);
    }
    catch(...)
    {
diff --git a/core/sql/cli/Context.cpp b/core/sql/cli/Context.cpp
index 46310d9..fc66151 100644
--- a/core/sql/cli/Context.cpp
+++ b/core/sql/cli/Context.cpp
@@ -173,6 +173,7 @@
     arkcmpInitFailed_(&exHeap_),
     trustedRoutines_(&exHeap_),
     roleIDs_(NULL),
+    granteeIDs_(NULL),
     numRoles_(0),
     unusedBMOsMemoryQuota_(0)
 {
@@ -3974,7 +3975,9 @@
    char localNameBuf[32];
    char isValidFromUsersTable[3];
 
-   if (queryType == USERS_QUERY_BY_USER_ID)
+   if (queryType == USERS_QUERY_BY_USER_ID ||
+       queryType == ROLE_QUERY_BY_ROLE_ID ||
+       queryType == ROLES_QUERY_BY_AUTH_ID) 
    {
       sprintf(localNameBuf, "%d", (int) authID);
       nameForDiags = localNameBuf;
@@ -4040,7 +4043,24 @@
       case ROLES_QUERY_BY_AUTH_ID:
       {
          authInfoPtr = &authInfo;
-         authStatus = authInfo.getRoleIDs(authID, roleIDs);
+         std::vector<int32_t> roleIDs;
+         std::vector<int32_t> granteeIDs;
+         authStatus = authInfo.getRoleIDs(authID, roleIDs, granteeIDs);
+         ex_assert((roleIDs.size() == granteeIDs.size()), "mismatch between roleIDs and granteeIDs");
+         numRoles_ = roleIDs.size() + 1; // extra for public role
+         roleIDs_ = new (&exHeap_) Int32[numRoles_];
+         granteeIDs_ = new (&exHeap_) Int32[numRoles_];
+
+         for (size_t i = 0; i < roleIDs.size(); i++)
+         {
+           roleIDs_[i] = roleIDs[i];
+           granteeIDs_[i] = granteeIDs[i];
+         }
+
+         // Add the public user to the last entry
+         Int32 lastEntry = numRoles_ - 1;
+         roleIDs_[lastEntry] = PUBLIC_USER;
+         granteeIDs_[lastEntry] = databaseUserID_;
       }   
       break;
 
@@ -4199,19 +4219,35 @@
 // *
 // * Function: ContextCli::getRoleList
 // *
-// * Return the role IDs granted to the current user 
+// * Return the role IDs and their grantees for the current user.  
 // *   If the list of roles is already stored, just return this list.
 // *   If the list of roles does not exist extract the roles granted to the
 // *     current user from the Metadata and store in roleIDs_.
 // *
 // ****************************************************************************
 RETCODE ContextCli::getRoleList(
-  Int32 &numRoles,
-  Int32 *&roleIDs)
+  Int32 &numEntries,
+  Int32 *& roleIDs,
+  Int32 *& granteeIDs)
 {
   // If role list has not been created, go read metadata
   if (roleIDs_ == NULL)
   {
+    // If authorization is not enabled, just setup the PUBLIC role
+    CmpContext *cmpCntxt = CmpCommon::context();
+    ex_assert(cmpCntxt, "No compiler context exists");
+    if (!cmpCntxt->isAuthorizationEnabled())
+    {
+      numRoles_ = 1;
+      roleIDs_ = new (&exHeap_) Int32[numRoles_];
+      roleIDs_[0] = PUBLIC_USER;
+      granteeIDs = new (&exHeap_) Int32[numRoles_];
+      granteeIDs[0] = databaseUserID_;
+      numEntries = numRoles_;
+      roleIDs = roleIDs_;
+      return SUCCESS;
+    }
+
     // Get roles for userID
     char usersNameFromUsersTable[MAX_USERNAME_LEN +1];
     Int32 userIDFromUsersTable;
@@ -4225,19 +4261,11 @@
                                 myRoles);  // OUT
     if (result != SUCCESS)
       return result;
-
-    // Include the public user
-    myRoles.push_back(PUBLIC_USER);
-
-    // Add role info to ContextCli
-    numRoles_ = myRoles.size();
-    roleIDs_ = new (&exHeap_) Int32[numRoles_];
-    for (size_t i = 0; i < numRoles_; i++)
-      roleIDs_[i] = myRoles[i];
   }
 
-  numRoles = numRoles_;
+  numEntries = numRoles_;
   roleIDs = roleIDs_;
+  granteeIDs = granteeIDs_;
 
   return SUCCESS;
 }
@@ -4256,6 +4284,11 @@
   if (roleIDs_)
     NADELETEBASIC(roleIDs_, &exHeap_);
   roleIDs_ = NULL;
+
+  if (granteeIDs_)
+    NADELETEBASIC(granteeIDs_, &exHeap_);
+  granteeIDs_ = NULL;
+
   numRoles_ = 0;
 
   return SUCCESS;
diff --git a/core/sql/cli/Context.h b/core/sql/cli/Context.h
index c000714..23846d6 100644
--- a/core/sql/cli/Context.h
+++ b/core/sql/cli/Context.h
@@ -150,8 +150,9 @@
 
 
   // functions to get and set roles for the current user
-  RETCODE getRoleList(Int32  &numRoles,
-                      Int32  *&roleIDs);
+  RETCODE getRoleList(Int32  &numEntries,
+                      Int32 *& roleIDs,
+                      Int32 *& granteeIDs);
 
   RETCODE resetRoleList();
 
@@ -258,8 +259,9 @@
   char *databaseUserName_;
 
   // List of active roles for the databaseUser
-  Int32  *roleIDs_;
   Int32   numRoles_;
+  Int32  *roleIDs_;
+  Int32  *granteeIDs_;
 
   NABoolean userNameChanged_;
 
diff --git a/core/sql/cli/Globals.cpp b/core/sql/cli/Globals.cpp
index 6f498fb..014a2ef 100644
--- a/core/sql/cli/Globals.cpp
+++ b/core/sql/cli/Globals.cpp
@@ -206,6 +206,7 @@
       }
       else
       {
+        bool reincarnated;
         error = statsGlobals_->getStatsSemaphore(semId_, myPin_);
 
         statsHeap_ = (NAHeap *)statsGlobals_->
@@ -221,10 +222,12 @@
 	  NAHeap("Process Stats Heap", statsGlobals_->getStatsHeap(),
 		 8192,
 		 0);
-	statsGlobals_->addProcess(myPin_, statsHeap_);
+	reincarnated = statsGlobals_->addProcess(myPin_, statsHeap_);
         processStats_ = statsGlobals_->getExProcessStats(myPin_);
         processStats_->setStartTime(myStartTime_);
 	statsGlobals_->releaseStatsSemaphore(semId_, myPin_);
+        if (reincarnated)
+           statsGlobals_->logProcessDeath(myCpu_, myPin_, "Process reincarnated before RIP");
       }
     }
     // create a default context and make it the current context
@@ -298,6 +301,7 @@
     error = statsGlobals_->getStatsSemaphore(semId_, myPin_);
     statsGlobals_->removeProcess(myPin_);
     statsGlobals_->releaseStatsSemaphore(semId_, myPin_);
+    statsGlobals_->logProcessDeath(myCpu_, myPin_, "Normal process death");
     sem_close((sem_t *)semId_);
   }
 }
diff --git a/core/sql/cli/SQLCLIdev.h b/core/sql/cli/SQLCLIdev.h
index 3dddf9e..59646be 100644
--- a/core/sql/cli/SQLCLIdev.h
+++ b/core/sql/cli/SQLCLIdev.h
@@ -310,8 +310,9 @@
 	        /*IN*/ Lng32     sqlErrorCode);  
 
 Lng32 SQL_EXEC_GetRoleList(
-   Int32 &numRoles,
-   Int32 *&roleIDs);
+   Int32 &numEntries,
+   Int32 *& roleIDs,
+   Int32 *& granteeIDs);
 
 Lng32 SQL_EXEC_ResetRoleList_Internal ();
 
diff --git a/core/sql/comexe/ComTdb.h b/core/sql/comexe/ComTdb.h
index 5271784..67f2b7b 100644
--- a/core/sql/comexe/ComTdb.h
+++ b/core/sql/comexe/ComTdb.h
@@ -1117,7 +1117,7 @@
 
   virtual Int32 size() { return sizeof(ComTdbVirtTablePrivInfo);}
 
-  NAList<PrivMgrDesc>     *privmgr_desc_list;     
+  PrivMgrDescList         *privmgr_desc_list;     
 };
 
 class ComTdbVirtTableLibraryInfo : public ComTdbVirtTableBase
diff --git a/core/sql/comexe/ComTdbRoot.h b/core/sql/comexe/ComTdbRoot.h
index f35ce54..d5def37 100644
--- a/core/sql/comexe/ComTdbRoot.h
+++ b/core/sql/comexe/ComTdbRoot.h
@@ -41,7 +41,6 @@
 #include "ComTdb.h"
 #include "SqlTableOpenInfo.h" // for SqlTableOpenInfo
 #include "exp_expr.h" // for InputOutputExpr
-#include "ComSqlexedbg.h" // for SqlexeDbgExpFuncs
 #include "FragDir.h"
 #include "LateBindInfo.h"
 #include "ComTransInfo.h"
diff --git a/core/sql/common/ComDistribution.cpp b/core/sql/common/ComDistribution.cpp
index 14bb378..a741536 100644
--- a/core/sql/common/ComDistribution.cpp
+++ b/core/sql/common/ComDistribution.cpp
@@ -301,6 +301,10 @@
   {COM_QI_GRANT_ROLE, COM_QI_GRANT_ROLE_LIT},
   {COM_QI_USER_GRANT_ROLE, COM_QI_USER_GRANT_ROLE_LIT},
   {COM_QI_ROLE_GRANT_ROLE, COM_QI_ROLE_GRANT_ROLE_LIT},
+  {COM_QI_COLUMN_SELECT, COM_QI_COLUMN_SELECT_LIT},
+  {COM_QI_COLUMN_INSERT, COM_QI_COLUMN_INSERT_LIT},
+  {COM_QI_COLUMN_UPDATE, COM_QI_COLUMN_UPDATE_LIT},
+  {COM_QI_COLUMN_REFERENCES, COM_QI_COLUMN_REFERENCES_LIT},
   {COM_QI_OBJECT_SELECT, COM_QI_OBJECT_SELECT_LIT},
   {COM_QI_OBJECT_INSERT, COM_QI_OBJECT_INSERT_LIT},
   {COM_QI_OBJECT_DELETE, COM_QI_OBJECT_DELETE_LIT},
diff --git a/core/sql/common/ComSecurityKey.cpp b/core/sql/common/ComSecurityKey.cpp
index 567d9ee..a2b4706 100644
--- a/core/sql/common/ComSecurityKey.cpp
+++ b/core/sql/common/ComSecurityKey.cpp
@@ -46,7 +46,9 @@
 NABoolean qiSubjectMatchesRole(uint32_t subjectKey)
 {
   NAList <Int32> roleIDs(NULL);
-  ComUser::getCurrentUserRoles(roleIDs);
+  if (ComUser::getCurrentUserRoles(roleIDs) != 0)
+    return TRUE;  // force recompilation if can't get current roles
+
   for (int i = 0; i < roleIDs.entries(); i++)
   {
     if (subjectKey = ComSecurityKey::generateHash(roleIDs[i]))
@@ -84,6 +86,7 @@
     {
       // Indicates that the DDL of the object has changed. 
       case COM_QI_OBJECT_REDEF:
+
       // Indicates that the histogram statistics of the object has changed.
       case COM_QI_STATS_UPDATED:
       {
@@ -95,6 +98,10 @@
       // Scan the passed-in object keys to find any that match the subject, 
       // object, and key type. That is, the subject has the privilege
       // (invalidation key type) on the object or a column of the object.
+      case COM_QI_COLUMN_SELECT:
+      case COM_QI_COLUMN_INSERT:
+      case COM_QI_COLUMN_UPDATE:
+      case COM_QI_COLUMN_REFERENCES:
       case COM_QI_OBJECT_SELECT:
       case COM_QI_OBJECT_INSERT:
       case COM_QI_OBJECT_DELETE:
@@ -117,6 +124,7 @@
           }
         }
         break;
+
       case COM_QI_USER_GRANT_SPECIAL_ROLE:
       case COM_QI_USER_GRANT_ROLE:
       {
@@ -146,19 +154,36 @@
 // Function that builds query invalidation keys for privileges. A separate
 // invalidation key is added for each granted DML privilege. 
 //
+// Parameters:
+//    roleGrantees - needed to create invalidation keys to represent:
+//                   all authorization ID that have been granted the role
+//    granteeID - the authID which has been granted one or more privileges
+//                could be a userID, a role the userID is granted or PUBLIC
+//    objectUID - the object (object) granted privilege
+//    privs - the list of DML privileges
+//    secKeySet - the list of invalidation keys generated
+//
+// secKeySet is a set so it automatically silently ignores duplicate entries
+//
 // Types of keys available for privs:
-//   OBJECT_IS_SCHEMA - not supported until we support schema level privs
+//   OBJECT_IS_SCHEMA - not supported
 //   OBJECT_IS_OBJECT - supported for granting privs to user
-//   OBJECT_IS_COLUMN - not supported at this time
+//     grant <priv-list> on <object> to <granteeID>
+//   OBJECT_IS_COLUMN - partially supported
+//     grant <priv-list> (col-list) on <object> to <granteeID>
 //   OBJECT_IS_SPECIAL_ROLE - key for PUBLIC authorization ID
+//     grant <priv-list> [(col-list)] on <object> to PUBLIC
 //   SUBJECT_IS_USER - support for granting roles to user
-//   SUBJECT_IS_ROLE - not supported until we grant roles to roles
+//     grant role <granteeID> to <grantRoleAuthID>
+//   SUBJECT_IS_ROLE - support for granting roles to role
+//     grant <priv-list> on <object> to <role>
 //
 // returns false is unable to build keys
 // ****************************************************************************
-bool buildSecurityKeys( const int32_t userID,
+bool buildSecurityKeys( const NAList<int32_t> &roleGrantees,
                         const int32_t granteeID,
                         const int64_t objectUID,
+                        const bool isColumn,
                         const PrivMgrCoreDesc &privs,
                         ComSecurityKeySet &secKeySet )
 {
@@ -166,7 +191,7 @@
     return true;
 
   NABoolean doDebug = (getenv("DBUSER_DEBUG") ? TRUE : FALSE);
-  std::string  msg ("Method: buildSecurityKeys: ");
+  std::string  msg ("Method: buildSecurityKeys ");
   if (doDebug)
   {
     printf("[DBUSER:%d] %s\n", (int) getpid(), msg.c_str());
@@ -191,33 +216,41 @@
       return false;
   }
 
-  // If the grantee is a role, generate a special security key
-  // If the role is revoked from the user, this key takes affect
+  // If the grantee is a role, generate special security keys, one for
+  // the user and one for each of the user's roles. 
+  // If the role is revoked from the user these key takes affect
   if (PrivMgr::isRoleID(granteeID))
   {
-    ComSecurityKey key (userID, granteeID, ComSecurityKey::SUBJECT_IS_USER);
-    if (doDebug)
+    char buf [200];
+    for (CollIndex r = 0; r < roleGrantees.entries(); r++)
     {
-      NAString msg = key.print(userID, granteeID);
-      printf("[DBUSER:%d]   (role) %s\n",
-             (int) getpid(), msg.data());
-      fflush(stdout);
-    }
+      ComSecurityKey::QIType qiType = ComSecurityKey::SUBJECT_IS_USER;
+      ComSecurityKey key (roleGrantees[r], granteeID, qiType);
+      if (doDebug)
+      {
+        NAString msg = key.print(roleGrantees[r], granteeID);
+        printf("[DBUSER:%d]   (role) %s\n",
+               (int) getpid(), msg.data());
+        fflush(stdout);
+      }
 
-    if (key.isValid())
-     secKeySet.insert(key);
-    else
-      return false;
+      if (key.isValid())
+        secKeySet.insert(key);
+      else
+        return false;
+    }
   }
 
-  // Generate object invalidation keys
-  // Only need to generate keys for DML privileges
+  // Generate keys one per granted DML privilege
   for ( size_t i = FIRST_DML_PRIV; i <= LAST_DML_PRIV; i++ )
   {
     if ( privs.getPriv(PrivType(i)))
     {
-      ComSecurityKey key (granteeID, objectUID, PrivType(i), 
-                          ComSecurityKey::OBJECT_IS_OBJECT);
+      ComSecurityKey::QIType qiType = (isColumn) ?
+           ComSecurityKey::OBJECT_IS_COLUMN :
+           ComSecurityKey::OBJECT_IS_OBJECT;
+
+      ComSecurityKey key (granteeID, objectUID, PrivType(i), qiType);
       if (doDebug)
       {
         NAString msg = key.print(granteeID, objectUID);
@@ -270,7 +303,7 @@
   if (doDebug)
   {
     sprintf(buf, ": num keys(%d)", numInvalidationKeys);
-    printf("[DBUSER:%d] Method: qiInvalidationType%s\n",
+    printf("[DBUSER:%d] Method: qiInvalidationType (what should be invalidated) %s\n",
            (int) getpid(), buf);
     fflush(stdout);
     sprintf(buf, "Not applicable");
@@ -491,14 +524,14 @@
     case SELECT_PRIV:
       if (inputType == OBJECT_IS_OBJECT)
         result = COM_QI_OBJECT_SELECT;
-      //else 
-      //  result = COM_QI_COLUMN_SELECT;
+      else 
+        result = COM_QI_COLUMN_SELECT;
       break;
     case INSERT_PRIV:
       if (inputType == OBJECT_IS_OBJECT)
         result = COM_QI_OBJECT_INSERT;
-      //else 
-      //  result = COM_QI_COLUMN_INSERT;
+      else 
+        result = COM_QI_COLUMN_INSERT;
       break;
     case DELETE_PRIV:
       if (inputType == OBJECT_IS_OBJECT)
@@ -507,8 +540,8 @@
     case UPDATE_PRIV:
       if (inputType == OBJECT_IS_OBJECT)
         result = COM_QI_OBJECT_UPDATE;
-      //else 
-      //  result = COM_QI_COLUMN_UPDATE;
+      else 
+        result = COM_QI_COLUMN_UPDATE;
       break;
     case USAGE_PRIV:
       if (inputType == OBJECT_IS_OBJECT)
@@ -517,12 +550,12 @@
     case REFERENCES_PRIV:
       if (inputType == OBJECT_IS_OBJECT)
         result = COM_QI_OBJECT_REFERENCES;
+      else
+        result = COM_QI_COLUMN_REFERENCES;
       break;
     case EXECUTE_PRIV:  
       if (inputType == OBJECT_IS_OBJECT)
         result = COM_QI_OBJECT_EXECUTE;
-      else if (inputType == OBJECT_IS_SCHEMA)
-        result = COM_QI_SCHEMA_EXECUTE;
       break;
     default:
       result = COM_QI_INVALID_ACTIONTYPE;
@@ -560,6 +593,18 @@
     case COM_QI_ROLE_GRANT_ROLE:
       actionString = COM_QI_ROLE_GRANT_ROLE_LIT;
       break;
+    case COM_QI_COLUMN_SELECT:
+      actionString = COM_QI_COLUMN_SELECT_LIT;
+      break;
+    case COM_QI_COLUMN_INSERT:
+      actionString = COM_QI_COLUMN_INSERT_LIT;
+      break;
+    case COM_QI_COLUMN_UPDATE:
+      actionString = COM_QI_COLUMN_UPDATE_LIT;
+      break;
+    case COM_QI_COLUMN_REFERENCES:
+      actionString = COM_QI_COLUMN_REFERENCES_LIT;
+      break;
     case COM_QI_OBJECT_SELECT:
       actionString = COM_QI_OBJECT_SELECT_LIT;
       break;
@@ -618,17 +663,17 @@
     case COM_QI_ROLE_GRANT_ROLE:
       typeString = "ROLE_GRANT_ROLE";
       break;
-    case COM_QI_SCHEMA_SELECT:
-      typeString = "SCHEMA_SELECT";
+    case COM_QI_COLUMN_SELECT:
+      typeString = "COLUMN_SELECT";
       break;
-    case COM_QI_SCHEMA_INSERT:
-      typeString = "SCHEMA_INSERT";
+    case COM_QI_COLUMN_INSERT:
+      typeString = "COLUMN_INSERT";
       break;
-    case COM_QI_SCHEMA_DELETE:
-      typeString = "SCHEMA_DELETE";
+    case COM_QI_COLUMN_UPDATE:
+      typeString = "COLUMN_UPDATE";
       break;
-    case COM_QI_SCHEMA_UPDATE:
-      typeString = "SCHEMA_UPDATE";
+    case COM_QI_COLUMN_REFERENCES:
+      typeString = "COLUMN_REFERENCES";
       break;
     case COM_QI_OBJECT_SELECT:
       typeString = "OBJECT_SELECT";
diff --git a/core/sql/common/ComSecurityKey.h b/core/sql/common/ComSecurityKey.h
index 8f90d16..3a06779 100644
--- a/core/sql/common/ComSecurityKey.h
+++ b/core/sql/common/ComSecurityKey.h
@@ -37,9 +37,10 @@
 
 typedef NASet<ComSecurityKey>  ComSecurityKeySet;
 
-bool buildSecurityKeys( const int32_t userID,
-                        const int32_t granteeID,
+bool buildSecurityKeys( const NAList <Int32> &roleGrantees,
+                        const int32_t roleID,
                         const int64_t objectUID,
+                        const bool isColumn,
                         const PrivMgrCoreDesc &privs,
                         ComSecurityKeySet &secKeySet);
 
@@ -101,13 +102,22 @@
   ComSecurityKey(
    const int32_t subjectUserID, 
    const int64_t objectUserID, 
-   const QIType typeOfSubject = SUBJECT_IS_USER);
+   const QIType typeOfSubject);
 
   // Constructor for a special role grant to an authID.
   ComSecurityKey(
     const int32_t subjectUserID, 
     const QIType typeOfObject);
 
+  // Constructor for generating revoke role from subject
+  ComSecurityKey(
+    const uint32_t subjectHashValue,
+    const uint32_t objectHashValue)
+  : subjectHash_(subjectHashValue),
+    objectHash_ (objectHashValue),
+    actionType_(COM_QI_USER_GRANT_ROLE)
+  {};
+
   ComSecurityKey();  // do not use
   bool operator == (const ComSecurityKey &other) const;
    
diff --git a/core/sql/common/ComSmallDefs.h b/core/sql/common/ComSmallDefs.h
index db99f28..c18662d 100644
--- a/core/sql/common/ComSmallDefs.h
+++ b/core/sql/common/ComSmallDefs.h
@@ -1309,6 +1309,10 @@
                      , COM_QI_OBJECT_REDEF
                      , COM_QI_STATS_UPDATED
                      , COM_QI_GRANT_ROLE
+                     , COM_QI_COLUMN_SELECT
+                     , COM_QI_COLUMN_INSERT
+                     , COM_QI_COLUMN_UPDATE
+                     , COM_QI_COLUMN_REFERENCES
                      } ;
 
 #define COM_QI_INVALID_ACTIONTYPE_LIT  "  "
@@ -1332,6 +1336,11 @@
 #define COM_QI_OBJECT_REDEF_LIT        "OR"
 #define COM_QI_STATS_UPDATED_LIT       "US"
 #define COM_QI_GRANT_ROLE_LIT          "GG"
+#define COM_QI_COLUMN_SELECT_LIT       "CS"
+#define COM_QI_COLUMN_INSERT_LIT       "CI"
+#define COM_QI_COLUMN_UPDATE_LIT       "CU"
+#define COM_QI_COLUMN_REFERENCES_LIT   "CF"
+
 
 
 
diff --git a/core/sql/common/ComSqlcmpdbg.h b/core/sql/common/ComSqlcmpdbg.h
index 092abf0..10e6efd 100644
--- a/core/sql/common/ComSqlcmpdbg.h
+++ b/core/sql/common/ComSqlcmpdbg.h
@@ -28,7 +28,7 @@
  * File:         ComSqlcmpdbg.h
  * Description:  This file contains declarations common to arkcmp components 	
  *               and tdm_sqlcmpdbg, the GUI tool used to display query
- *		 compilation.
+ *		 compilation and execution.
  *
  * Created:      06/25/97
  * Modified:     $Author:
@@ -39,7 +39,10 @@
  *****************************************************************************
  */
 
-#include "Platform.h"  // 64-BIT
+#include "Platform.h"
+
+class ExScheduler;
+class ExSubtask;
 
 class Sqlcmpdbg {
   // This class exists merely to give a nice naming scope for this enum
@@ -62,17 +65,19 @@
 			 };
 };
 
-typedef struct tagSqlcmpdbgExpFuncs {
+struct SqlcmpdbgExpFuncs {
   void (*fpDisplayQueryTree) (Sqlcmpdbg::CompilationPhase,void* , void* );
-  void (*fpSqldbgSetPointers) (void*, void*, void*, void*, void* );
+  void (*fpSqldbgSetCmpPointers) (void*, void*, void*, void*, void* );
   void (*fpDoMemoStep) (Int32, Int32, Int32, void*, void*, void*);
   void (*fpHideQueryTree) (BOOL);
   void (*fpDisplayTDBTree) (Sqlcmpdbg::CompilationPhase, void*, void*);
-  BOOL (*fpDisplayExecution) (void);
+  int  (*fpExecutionDisplayIsEnabled) (void);
+  void (*fpSqldbgSetExePointers) (void *, void *, void *);
+  void (*fpDisplayExecution) (ExSubtask**, ExScheduler *);
   void (*fpCleanUp)(void);
-} SqlcmpdbgExpFuncs;
+};
 
-typedef SqlcmpdbgExpFuncs* (*fpGetSqlcmpdbgExpFuncs) (void); 
+typedef SqlcmpdbgExpFuncs* (*fpGetSqlcmpdbgExpFuncs) ();
 
 #endif
 	
diff --git a/core/sql/common/ComSqlexedbg.h b/core/sql/common/ComSqlexedbg.h
deleted file mode 100644
index 4e13606..0000000
--- a/core/sql/common/ComSqlexedbg.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef COMSQLEXEDBG_H
-#define COMSQLEXEDBG_H
-/* -*-C++-*-
- *****************************************************************************
- *
- * File:         ComSqlcmpdbg.h
- * Description:  This file contains declarations common to arkcmp components 	
- *               and tdm_sqlcmpdbg the GUI tool used to display query 
- *               compilation.
- *               
- * Created:      06/25/97
- * Modified:     $Author:
- * Language:     C++
- *
- *
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-// @@@ END COPYRIGHT @@@
- *
- *
- *****************************************************************************
- */
-
-// forward reference
-class ExSubtask;
-class ExScheduler;
-class ex_tcb;
-
-typedef struct tagSqlexedbgExpFuncs {
-  void (*fpDisplayTCBTree) (ExSubtask**, ExScheduler*);
-  void (*fpSetRootTCB) (ex_tcb*);
-} SqlexedbgExpFuncs;
-
-typedef SqlexedbgExpFuncs* (*fpGetSqlexedbgExpFuncs) (void); 
-
-#endif
-	
diff --git a/core/sql/common/ComUser.cpp b/core/sql/common/ComUser.cpp
index 2b6831f..516d411 100644
--- a/core/sql/common/ComUser.cpp
+++ b/core/sql/common/ComUser.cpp
@@ -362,7 +362,8 @@
 {
   Int32 numRoles = 0;
   Int32 *roleIDs = 0;
-  if (SQL_EXEC_GetRoleList(numRoles, roleIDs) < 0)
+  Int32 *granteeIDs = NULL;
+  if (SQL_EXEC_GetRoleList(numRoles, roleIDs, granteeIDs) < 0)
     return false;
 
   for (Int32 i = 0; i < numRoles; i++)
@@ -374,15 +375,64 @@
   return false;
 }
 
-void ComUser::getCurrentUserRoles(NAList <Int32> &roleList)
+// ----------------------------------------------------------------------------
+// method: getCurrentUserRoles
+//
+// Gets the active roles for the current user as a list of Int32's
+// There should be at least one role in this list (PUBLIC)
+//
+// Returns:
+//   -1 -- unexpected error getting roles
+//    0 -- successful
+// ----------------------------------------------------------------------------
+Int16 ComUser::getCurrentUserRoles(NAList <Int32> &roleIDs)
 {
   Int32 numRoles = 0;
-  Int32 *roleIDs = 0;
-  Int32 retcode = SQL_EXEC_GetRoleList(numRoles, roleIDs);
-  assert(retcode == 0);
+  Int32 *cachedRoleIDs = NULL;
+  Int32 *cachedGranteeIDs = NULL;
+  RETCODE retcode =
+    GetCliGlobals()->currContext()->getRoleList(numRoles, cachedRoleIDs, cachedGranteeIDs);
+
+  if (retcode != SUCCESS)
+    return -1;
 
   for (Int32 i = 0; i < numRoles; i++)
-    roleList.insert (roleIDs[i]);
+  {
+    // in case there are duplicates
+    if (!roleIDs.contains(cachedRoleIDs[i]))
+      roleIDs.insert (cachedRoleIDs[i]);
+  }
+  return 0;
+}
+
+// ----------------------------------------------------------------------------
+// method: getCurrentUserRoles
+//
+// Gets the active roles and grantees for the current user as a list of Int32's
+// There should be at least one role in this list (PUBLIC)
+//
+// Returns:
+//   -1 -- unexpected error getting roles
+//    0 -- successful
+// ----------------------------------------------------------------------------
+Int16 ComUser::getCurrentUserRoles(NAList<Int32> &roleIDs, NAList<Int32> &granteeIDs)
+{
+  Int32 numRoles = 0;
+  Int32 *cachedRoleIDs = NULL;
+  Int32 *cachedGranteeIDs = NULL;
+  RETCODE retcode =
+    GetCliGlobals()->currContext()->getRoleList(numRoles, cachedRoleIDs, cachedGranteeIDs);
+
+  if (retcode != SUCCESS)
+    return -1;
+
+  for (Int32 i = 0; i < numRoles; i++)
+  {
+    roleIDs.insert (cachedRoleIDs[i]);
+    granteeIDs.insert (cachedGranteeIDs[i]);
+  }
+
+  return 0;
 }
 
 
diff --git a/core/sql/common/ComUser.h b/core/sql/common/ComUser.h
index eb5db65..8a24de9 100644
--- a/core/sql/common/ComUser.h
+++ b/core/sql/common/ComUser.h
@@ -91,7 +91,10 @@
                                          Int32 & authID);
 
      static bool currentUserHasRole(Int32 roleID);
-     static void getCurrentUserRoles(NAList <Int32> &roleList);
+     static Int16 getCurrentUserRoles(NAList <Int32> &roleIDs);
+     static Int16 getCurrentUserRoles(NAList <Int32> &roleIDs,
+                                     NAList <Int32> &granteeIDs);
+
 
      static Int32 getRoleList (char *roleList,
                                Int32 &actualLen,
diff --git a/core/sql/common/Ipc.cpp b/core/sql/common/Ipc.cpp
index 7807778..06b0ad9 100644
--- a/core/sql/common/Ipc.cpp
+++ b/core/sql/common/Ipc.cpp
@@ -368,6 +368,14 @@
     }
 }
 
+std::string IpcProcessId::toString() const
+{
+  char outb[100];
+
+  toAscii(outb, sizeof(outb));
+  return outb;
+}
+
 Int32 IpcProcessId::toAscii(char *outBuf, Int32 outBufLen) const
 {
   // process names shouldn't be longer than 300 bytes
diff --git a/core/sql/common/Ipc.h b/core/sql/common/Ipc.h
index 85a4edb..8e69930 100644
--- a/core/sql/common/Ipc.h
+++ b/core/sql/common/Ipc.h
@@ -424,6 +424,7 @@
   const GuaProcessHandle &getPhandle() const;
   IpcNodeName getNodeName() const;
   IpcCpuNum getCpuNum() const;
+  std::string toString() const;
   Int32 toAscii(char *outBuf, Int32 outBufLen) const;
   void addProcIdToDiagsArea(ComDiagsArea &diags, Int32 stringno = 0) const;
 
diff --git a/core/sql/common/SequenceGeneratorAttributes.h b/core/sql/common/SequenceGeneratorAttributes.h
index 2220781..714f38e 100644
--- a/core/sql/common/SequenceGeneratorAttributes.h
+++ b/core/sql/common/SequenceGeneratorAttributes.h
@@ -80,7 +80,8 @@
     sgCache_(psgCache),
     sgNextValue_(psgNextValue),
     sgEndValue_(psgEndValue),
-    sgRedefTime_(psgRedefTime)
+    sgRedefTime_(psgRedefTime),
+    sgRetryNum_(100)
   {}
 
       
@@ -98,7 +99,8 @@
     sgCache_(0),
     sgNextValue_(0),
     sgEndValue_(0),
-    sgRedefTime_(0)
+    sgRedefTime_(0),
+    sgRetryNum_(100)
       {}
   
   // copy ctor
@@ -117,7 +119,8 @@
     sgCache_(sga.sgCache_),
     sgNextValue_(sga.sgNextValue_),
     sgEndValue_(sga.sgEndValue_),
-    sgRedefTime_(sga.sgRedefTime_)
+    sgRedefTime_(sga.sgRedefTime_),
+    sgRetryNum_(100)
       {}
   
   // ---------------------------------------------------------------------
@@ -138,6 +141,11 @@
   const Int64                      &getSGNextValue()   const     { return sgNextValue_; }
   const Int64                      &getSGEndValue()   const     { return sgEndValue_; }
   const Int64                      &getSGRedefTime() const     { return sgRedefTime_; }
+  const UInt32			&getSGRetryNum() const     { return sgRetryNum_; }
+
+  void setSGRetryNum(const UInt32 v) 
+  { sgRetryNum_ = v; }
+
   void setSGStartValue(const Int64 psgStartValue)
   { sgStartValue_= psgStartValue; }
 
@@ -205,6 +213,7 @@
   Int64                        sgNextValue_;
   Int64                        sgEndValue_;
   Int64                        sgRedefTime_;
+  UInt32			sgRetryNum_;
 }; // class SequenceGeneratorAttributes
 
 #endif  /* SEQUENCEGENERATORATTRIBUTES_H */
diff --git a/core/sql/executor/ExExeUtilCli.cpp b/core/sql/executor/ExExeUtilCli.cpp
index 1c827f6..434e4dd 100644
--- a/core/sql/executor/ExExeUtilCli.cpp
+++ b/core/sql/executor/ExExeUtilCli.cpp
@@ -46,8 +46,8 @@
   : numEntries_(numEntries)
 {
   
-   ex_assert( numEntries <= MAX_OUTPUT_ENTRIES, "try to fetch more than max rows allowed");
-  
+   ex_assert( numEntries <= MAX_OUTPUT_ENTRIES, "try to fetch more than max columns allowed");
+
    for (Int32 i = 0; i < numEntries_; i++)
     {
       data_[i] = NULL;
diff --git a/core/sql/executor/ExExeUtilGet.cpp b/core/sql/executor/ExExeUtilGet.cpp
index b9d4c68..86e6a7b 100644
--- a/core/sql/executor/ExExeUtilGet.cpp
+++ b/core/sql/executor/ExExeUtilGet.cpp
@@ -177,7 +177,7 @@
   {" select translate(rtrim(RU.role_name) using ucs2toutf8) "},
   {"   from %s.\"%s\".%s RU "},
   {" where (RU.grantor_ID != -2) and "},
-  {"       (RU.grantee_name='%s') %s "},
+  {"       (RU.grantee_name='%s') "},
   {" union select * from (values ('PUBLIC')) "},
   {" order by 1 "},
   {" ; "}
@@ -348,7 +348,7 @@
   {" ; "}
 };
 
-static const QueryString getTrafIndexesForUser[] =
+static const QueryString getTrafIndexesForAuth[] =
 {
   {" select trim(T2.catalog_name) || '.\"' || trim(T2.schema_name) || '\".' || trim(T2.object_name) "},
   {" from %s.\"%s\".%s I, "},
@@ -385,20 +385,21 @@
   {"  ; "}
 };
 
-static const QueryString getTrafLibrariesForUser[] =
+static const QueryString getTrafLibrariesForAuthQuery[] =
 {
-  {" select distinct object_name  from "},
-  {"   %s.\"%s\".%s T, %s.\"%s\".%s R  "},
-  {"  where T.catalog_name = '%s' and T.object_type = 'LB' and "},
-  {"        T.object_uid = R.library_uid %s "},
+  {" select distinct trim(catalog_name) || '.\"' || "},
+  {"     trim(schema_name) || '\".' || trim(object_name) "},
+  {"  from %s.\"%s\".%s "},
+  {"  where catalog_name = '%s' and object_type = 'LB' %s "},
   {"  order by 1 "},
   {"  ; "}
 };
 
 static const QueryString getTrafRoutinesForAuthQuery[] =
 {
-  {" select distinct object_name  from "},
-  {"   %s.\"%s\".%s T, %s.\"%s\".%s R  "},
+  {" select distinct trim(catalog_name) || '.\"' || "},
+  {"     trim(schema_name) || '\".' || trim(object_name) "},
+  {"  from %s.\"%s\".%s T, %s.\"%s\".%s R  "},
   {"  where T.catalog_name = '%s' and "},
   {"        T.object_type = 'UR' and "},
   {"        T.object_uid = R.udr_uid and "},
@@ -536,8 +537,9 @@
   {" select T.schema_name "},
   {"   from %s.\"%s\".%s T, "},
   {"        %s.\"%s\".%s A "},
-  {"  where (T.object_type = 'PS' or T.object_type = 'SS') and "},
-  {"         A.auth_db_name = '%s' and T.object_owner = A.auth_id "},
+  {"  where T.object_type in ('PS', 'SS') and "},
+  {"         T.object_owner = A.auth_id and "},
+  {"         A.auth_id in %s "},
   {" order by 1 "},
   {"  ; "}
 };
@@ -1273,7 +1275,7 @@
     break;
 
     case ComTdbExeUtilGetMetadataInfo::LIBRARIES_FOR_ROLE_:
-        str_sprintf(headingBuf_,"Libraries for User %s", getMItdb().getParam1());
+        str_sprintf(headingBuf_,"Libraries for Role %s", getMItdb().getParam1());
     break;
 
     case ComTdbExeUtilGetMetadataInfo::PROCEDURES_FOR_LIBRARY_:
@@ -1308,6 +1310,10 @@
         str_sprintf(headingBuf_,"Roles for User %s",getMItdb().getParam1());
     break;
 
+    case ComTdbExeUtilGetMetadataInfo::SCHEMAS_FOR_ROLE_:
+        str_sprintf(headingBuf_,"Schemas for Role %s",getMItdb().getParam1());
+    break;
+
     case ComTdbExeUtilGetMetadataInfo::SCHEMAS_FOR_USER_:
         str_sprintf(headingBuf_,"Schemas for User %s",getMItdb().getParam1());
     break;
@@ -1507,6 +1513,12 @@
 // Reads the "_MD_".auths table to get the auth_id from the passed in authName.
 // If relationship not found for any reason, return 0, otherwise return
 // the authID.
+//
+// TBD - should replace this with a call to currContext->getAuthIDFromName
+//       this function checks for special authID and looks at cache before
+//       calling metadata.  Currently there is an issue because privilege 
+//       error are returned when trying to read AUTHS table.  Need to set 
+//       parserflag 131072.
 // ----------------------------------------------------------------------------
 Int32 ExExeUtilGetMetadataInfoTcb::getAuthID(
   const char *authName,
@@ -1593,6 +1605,9 @@
   const char *schName,
   const char *objName)
 {
+  // Always include PUBLIC
+  NAString roleList("(-1");
+
   short rc      = 0;
   Lng32 cliRC   = 0;
 
@@ -1604,23 +1619,22 @@
   numOutputEntries_ = 1;
   cliRC = fetchAllRows(infoList_, queryBuf_, numOutputEntries_, FALSE, rc);
   if (cliRC < 0)
-  {
-    cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
-    return NULL;
-  }
+    {
+      cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
+      return NULL;
+    }
 
-  NAString roleList("(-1");
   char buf[30];
   infoList_->position();
   while (NOT infoList_->atEnd())
     {
       OutputInfo * vi = (OutputInfo*)infoList_->getCurr();
       if (vi)
-      {
-        str_sprintf(buf, ", %d", *(Lng32*)vi->get(0));
-        roleList += buf;
-      }
-      infoList_->advance();
+        {
+          str_sprintf(buf, ", %d", *(Lng32*)vi->get(0));
+          roleList += buf;
+        }
+          infoList_->advance();
     }
   str_sprintf(buf, ", %d)", userID);
   roleList += buf;
@@ -1651,10 +1665,10 @@
   if (ComUser::isRootUserID())
     return FALSE;
 
-  // any user granted the DB__ROOTROLE sees everything
   Int32 numRoles;
   Int32 *roleList;
-  if (currContext->getRoleList(numRoles, roleList) == SUCCESS)
+  Int32 *granteeList;
+  if (currContext->getRoleList(numRoles, roleList, granteeList) == SUCCESS)
   {
     char authIDAsChar[sizeof(Int32)+10];
     NAString auths;
@@ -1672,8 +1686,7 @@
   privMDLoc += "\"";
   PrivMgrComponentPrivileges componentPrivileges(privMDLoc,getDiagsArea());
 
-  if (componentPrivileges.hasSQLPriv(ComUser::getCurrentUser(),SQLOperation::SHOW,true))
-    return FALSE;
+  if (componentPrivileges.hasSQLPriv(ComUser::getCurrentUser(),SQLOperation::SHOW,true)) return FALSE;
 
   // Check component privilege based on QueryType
   switch (queryType)
@@ -1976,6 +1989,7 @@
             // used in a select "IN" clause.  Include the current user
             NAString authList;
             NAString colPrivsStmt;
+            NAString var;
 
             if (CmpCommon::context()->isAuthorizationEnabled())
             {
@@ -1987,7 +2001,8 @@
                // add list of roles stored in context
                Int32 numRoles;
                Int32 *roleList;
-               if (currContext->getRoleList(numRoles, roleList) != SUCCESS)
+               Int32 *granteeList;
+               if (currContext->getRoleList(numRoles, roleList, granteeList) != SUCCESS)
                  numRoles = 0;
                for (Int32 i = 0; i < numRoles; i++)
                {
@@ -2284,8 +2299,8 @@
                   param_[10] = getMItdb().sch_;
                   param_[11] = getMItdb().obj_;
                   if (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::VIEWS_ON_TABLE_)
-                    strcpy(ausStr, " and T1.object_type = 'BT' ");
-                  param_[12] = ausStr;
+                    var = " and T1.object_type = 'BT' ";
+                  param_[12] = (char *)var.data();
                   param_[13] = (char *)privWhereClause.data();
 
 		}
@@ -2306,20 +2321,98 @@
                   param_[4] = (char *) privWhereClause.data();
 		}
 	      break;
-              case ComTdbExeUtilGetMetadataInfo::SCHEMAS_FOR_USER_:
-		{
-		  qs = getTrafSchemasForAuthIDQuery;
-		  sizeOfqs = sizeof(getTrafSchemasForAuthIDQuery);
 
-		  param_[0] = cat;
-		  param_[1] = sch;
-		  param_[2] = tab;
-		  param_[3] = cat;
-		  param_[4] = sch;
-		  param_[5] = auths;
-		  param_[6] = getMItdb().getParam1();
+              case ComTdbExeUtilGetMetadataInfo::SCHEMAS_FOR_USER_:
+              case ComTdbExeUtilGetMetadataInfo::SCHEMAS_FOR_ROLE_:
+                {
+                  qs = getTrafSchemasForAuthIDQuery;
+                  sizeOfqs = sizeof(getTrafSchemasForAuthIDQuery);
+
+                  bool isRole = (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::SCHEMAS_FOR_ROLE_);
+
+                  Int32 authID = *currContext->getDatabaseUserID();
+                  if (!(strcmp(getMItdb().getParam1(), currContext->getDatabaseUserName()) == 0))
+                    authID = getAuthID(getMItdb().getParam1(), cat, sch, auths);
+
+                  if (isRole)
+                    {
+                      // if incorrect auth type, return error
+                      if (!CmpSeabaseDDLauth::isRoleID(authID) && !ComUser::isPublicUserID(authID))
+                        {
+                          ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_IS_NOT_A_ROLE, 
+                              NULL, NULL, NULL,
+                              getMItdb().getParam1());
+                          step_ = HANDLE_ERROR_;
+                          break;
+                        }
+
+                      // Cannot get schemas if current user not granted role
+                      if (doPrivCheck && !ComUser::currentUserHasRole(authID))
+                        {
+                          ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_NOT_AUTHORIZED);
+                          step_ = HANDLE_ERROR_;
+                          break;
+                        }
+
+                        // Return schemas that are owned by the specified role -> authID = roleID
+                        char buf[30];
+                        str_sprintf(buf, "(%d)", authID);
+                        privWhereClause = buf;
+                    }
+
+                  else /* isUser*/ 
+                    {
+                      // if incorrect auth type, return error
+                      if (!CmpSeabaseDDLauth::isUserID(authID))
+                      {
+                        ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_IS_NOT_A_USER, 
+                          NULL, NULL, NULL,
+                          getMItdb().getParam1());
+                        step_ = HANDLE_ERROR_;
+                        break;
+                      }
+
+                      // Cannot get schemas for user other than the current user
+                      if (doPrivCheck && authID != ComUser::getCurrentUser())
+                        {
+                          ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_NOT_AUTHORIZED);
+                          step_ = HANDLE_ERROR_;
+                          break;
+                        }
+                    
+                      // Get list of roles assigned to user, return all schemas
+                      // owned by user and user's roles
+
+                      if (authID == ComUser::getCurrentUser())
+                        privWhereClause = authList;
+                      else
+                        {
+                          char *userRoleList = getRoleList(authID, cat, pmsch, role_usage);
+                          if (userRoleList)
+                            {
+                              privWhereClause = userRoleList;
+                              NADELETEBASIC(userRoleList, getHeap());
+                            }
+                          else
+                            {
+                              // Unable to read metadata 
+                              ExRaiseSqlError(getHeap(), &diagsArea_, -8001);
+                              step_ = HANDLE_ERROR_;
+                              break;
+                            }
+                        }
+                    }
+
+                  param_[0] = cat;
+                  param_[1] = sch;
+                  param_[2] = tab;
+                  param_[3] = cat;
+                  param_[4] = sch;
+                  param_[5] = auths;
+                  param_[6] = (char *) privWhereClause.data();
 		}
 	      break;
+
               case ComTdbExeUtilGetMetadataInfo::USERS_:
                 {
                   qs = getTrafUsers;
@@ -2422,89 +2515,126 @@
                 break ;
 
               case ComTdbExeUtilGetMetadataInfo::PROCEDURES_FOR_USER_:
-              case ComTdbExeUtilGetMetadataInfo::PROCEDURES_FOR_ROLE_:
               case ComTdbExeUtilGetMetadataInfo::FUNCTIONS_FOR_USER_:
-              case ComTdbExeUtilGetMetadataInfo::FUNCTIONS_FOR_ROLE_:
               case ComTdbExeUtilGetMetadataInfo::TABLE_FUNCTIONS_FOR_USER_:
-              case ComTdbExeUtilGetMetadataInfo::TABLE_FUNCTIONS_FOR_ROLE_:
                 {
-                  NABoolean isUser =
-                     (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PROCEDURES_FOR_USER_ ||
-                      getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::TABLE_FUNCTIONS_FOR_USER_ ||
-                      getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::FUNCTIONS_FOR_USER_);
+                  qs = getTrafRoutinesForAuthQuery;
+                  sizeOfqs = sizeof(getTrafRoutinesForAuthQuery);
 
                   // Get the authID associated with the specified user
                   Int32 authID = *currContext->getDatabaseUserID();
                   if (!(strcmp(getMItdb().getParam1(), currContext->getDatabaseUserName()) == 0))
                     authID = getAuthID(getMItdb().getParam1(), cat, sch, auths);
 
-                  // Verify that the user is a user, or the role is a role
-                  if (isUser  && !CmpSeabaseDDLauth::isUserID(authID) ||
-                      !isUser && !CmpSeabaseDDLauth::isRoleID(authID))
+                  // If not a user, we are done, don't return data
+                  if (!CmpSeabaseDDLauth::isUserID(authID))
                     {
-                      NAString type = (isUser ? "user" : "role");
-                      ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_IS_NOT_CORRECT_AUTHID,
-                          NULL, NULL, NULL,
-                          getMItdb().getParam1(),
-                          type.data());
+                      ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_IS_NOT_A_USER);
                       step_ = HANDLE_ERROR_;
                       break;
                     }
 
-                  qs = getTrafRoutinesForAuthQuery;
-                  sizeOfqs = sizeof(getTrafRoutinesForAuthQuery);
+                  // Non elevated user cannot view routines for another user
+                  if (doPrivCheck && authID != ComUser::getCurrentUser())
+                    {
+                      ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_NOT_AUTHORIZED);
+                      step_ = HANDLE_ERROR_;
+                      break;
+                    }
+                  
+                  // Determine routine type
+                  if (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PROCEDURES_FOR_USER_)
+                    var = COM_PROCEDURE_TYPE_LIT;
+                  else if (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::FUNCTIONS_FOR_USER_)
+                    var = COM_SCALAR_UDF_TYPE_LIT;
+                  else
+                    var = COM_TABLE_UDF_TYPE_LIT;
 
-                  NAString routineType;
-                  if ((getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PROCEDURES_FOR_USER_) ||
-                      (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PROCEDURES_FOR_ROLE_))
-                    routineType = COM_PROCEDURE_TYPE_LIT;
-                  else if ((getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::FUNCTIONS_FOR_USER_) ||
-                      (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::FUNCTIONS_FOR_ROLE_))
-                    routineType = COM_SCALAR_UDF_TYPE_LIT;
-                  else 
-                    routineType = COM_TABLE_UDF_TYPE_LIT;
+                  // Limit results to privileges allowed for specified user
 
-                  // Getting objects for the current user
-                  if (strcmp(getMItdb().getParam1(), currContext->getDatabaseUserName()) == 0)
-                    privWhereClause = getGrantedPrivCmd(authList, cat, NAString ("T.object_uid"));
-
-                  // Getting objects for a user other than the current user
+                  if (authID == ComUser::getCurrentUser())
+                    privWhereClause = getGrantedPrivCmd(authList, cat);
                   else
                     {
-                      if (doPrivCheck)
+                      char *userRoleList = getRoleList(authID, cat, pmsch, role_usage);
+                      if (userRoleList)
                         {
-                          // User cannot view privileges for another user
-                          ExRaiseSqlError(getHeap(), &diagsArea_, -1017);
-                          step_ = HANDLE_ERROR_;
-                          break;
+                          privWhereClause = getGrantedPrivCmd(userRoleList, cat, NAString ("T.object_uid"));
+                          NADELETEBASIC(userRoleList, getHeap());
                         }
                       else
                         {
-                          // get the list of roles for this other user.
-                          char *userRoleList = getRoleList(authID, cat, pmsch, role_usage);
-                          if (userRoleList)
-                            {
-                              privWhereClause = getGrantedPrivCmd(userRoleList, cat, NAString ("T.object_uid"));
-                              NADELETEBASIC(userRoleList, getHeap());
-                            }
-                          else
-                            {
-                              // Unable to read metadata
-                              ExRaiseSqlError(getHeap(), &diagsArea_, -8001);
-                              step_ = HANDLE_ERROR_;
-                              break;
-                            }
+                          // Unable to read metadata
+                          ExRaiseSqlError(getHeap(), &diagsArea_, -8001);
+                          step_ = HANDLE_ERROR_;
+                          break;
                         }
                     }
 
-		  param_[0] = cat;
-		  param_[1] = sch;
-		  param_[2] = tab;
+                  param_[0] = cat;
+                  param_[1] = sch;
+                  param_[2] = tab;
                   param_[3] = cat;
-		  param_[4] = sch;
-		  param_[5] = routine;
-		  param_[6] = getMItdb().cat_;
-                  param_[7] = (char *)routineType.data();
+                  param_[4] = sch;
+                  param_[5] = routine;
+                  param_[6] = getMItdb().cat_;
+                  param_[7] = (char *)var.data();
+                  param_[8] = (char *) privWhereClause.data();
+                }
+                break ;
+
+              case ComTdbExeUtilGetMetadataInfo::PROCEDURES_FOR_ROLE_:
+              case ComTdbExeUtilGetMetadataInfo::FUNCTIONS_FOR_ROLE_:
+              case ComTdbExeUtilGetMetadataInfo::TABLE_FUNCTIONS_FOR_ROLE_:
+                {
+                  qs = getTrafRoutinesForAuthQuery;
+                  sizeOfqs = sizeof(getTrafRoutinesForAuthQuery);
+
+                  // Get the authID associated with the specified role
+                  Int32 authID = *currContext->getDatabaseUserID();
+                  if (!(strcmp(getMItdb().getParam1(), currContext->getDatabaseUserName()) == 0))
+                    authID = getAuthID(getMItdb().getParam1(), cat, sch, auths);
+
+                  // If not a role, we are done, don't return data
+                  if (!CmpSeabaseDDLauth::isRoleID(authID) && !ComUser::isPublicUserID(authID)) 
+                    {
+                      ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_IS_NOT_A_ROLE, 
+                          NULL, NULL, NULL,
+                          getMItdb().getParam1());
+                      step_ = HANDLE_ERROR_;
+                      break;
+                    }
+
+                  // non elevated user has to be granted role
+                  if (doPrivCheck && !ComUser::currentUserHasRole(authID))
+                    {
+                      // No priv
+                      ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_NOT_AUTHORIZED);
+                      step_ = HANDLE_ERROR_;
+                      break;
+                    }
+
+                  // determine routine type
+                  if (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PROCEDURES_FOR_ROLE_)
+                    var = COM_PROCEDURE_TYPE_LIT;
+                  else if (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::FUNCTIONS_FOR_ROLE_)
+                    var = COM_SCALAR_UDF_TYPE_LIT;
+                  else 
+                    var = COM_TABLE_UDF_TYPE_LIT;
+
+                  // Only return rows where role (authID) has been granted privs
+                  char buf[30];
+                  str_sprintf(buf, "(%d)", authID);
+                  privWhereClause = getGrantedPrivCmd(buf, cat, NAString ("T.object_uid"));
+
+                  param_[0] = cat;
+                  param_[1] = sch;
+                  param_[2] = tab;
+                  param_[3] = cat;
+                  param_[4] = sch;
+                  param_[5] = routine;
+                  param_[6] = getMItdb().cat_;
+                  param_[7] = (char *)var.data();
                   param_[8] = (char *) privWhereClause.data();
                 }
                 break ;
@@ -2532,12 +2662,12 @@
                   param_[10] = getMItdb().sch_;
                   param_[11] = getMItdb().obj_;
                   if (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PROCEDURES_FOR_LIBRARY_)
-                    strcpy(ausStr, " R.udr_type = 'P ' ");
+                    var = " R.udr_type = 'P ' ";
                   else if (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::FUNCTIONS_FOR_LIBRARY_)
-                    strcpy(ausStr, " R.udr_type = 'F ' ");
+                    var = " R.udr_type = 'F ' ";
                   else
-                    strcpy(ausStr, " R.udr_type = 'T ' ");
-                  param_[12] = ausStr;
+                    var = " R.udr_type = 'T ' ";
+                  param_[12] = (char *) var.data();
                   param_[13] = (char *) privWhereClause.data();
                 }
                 break ;
@@ -2550,6 +2680,7 @@
 
                   if (doPrivCheck)
                   {
+                     // return roles granted to current user
                      char buf[authList.length() + 100];
                      str_sprintf(buf, " and auth_id in %s", authList.data());
                      privWhereClause = buf;
@@ -2566,10 +2697,23 @@
                 {
                   qs = getUsersForRoleQuery;
                   sizeOfqs = sizeof(getUsersForRoleQuery);
-                  
-                  // return the name if the role has been granted to the current user
-                  if (doPrivCheck)  
-                     privWhereClause = " and grantee_name = CURRENT_USER ";
+
+                  if (doPrivCheck)
+                    {
+                      // If user not granted role, return an error
+                      Int32 authID = *currContext->getDatabaseUserID();
+                      if (!(strcmp(getMItdb().getParam1(), currContext->getDatabaseUserName()) == 0))
+                        authID = getAuthID(getMItdb().getParam1(), cat, sch, auths);
+                      if (!ComUser::currentUserHasRole(authID))
+                        {
+                           ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_NOT_AUTHORIZED);
+                           step_ = HANDLE_ERROR_;
+                           break;
+                         }
+
+                       // limit users to the current user only
+                       privWhereClause = " and grantee_name = CURRENT_USER ";
+                     }
 
                   param_[0] = cat;
                   param_[1] = pmsch;
@@ -2584,115 +2728,157 @@
                   qs = getRolesForUserQuery;
                   sizeOfqs = sizeof(getRolesForUserQuery);
                   
-                  // return the name if the current user was granted the role
                   if (doPrivCheck)  
-                     privWhereClause = " and CURRENT_USER=RU.grantee_name ";
+                    {
+                      // If user not the current user, return an error
+                      // TBD - the current context contains a list of roles, 
+                      //       return list to avoid metadata I/O
+                      if (strcmp(getMItdb().getParam1(), currContext->getDatabaseUserName()) != 0)
+                       {
+                          ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_NOT_AUTHORIZED);
+                          step_ = HANDLE_ERROR_;
+                          break;
+                        } 
+                    }
+                  else
+                    {
+                      // Get the authID for the request
+                      Int32 authID = *currContext->getDatabaseUserID();
+                      if (!(strcmp(getMItdb().getParam1(), currContext->getDatabaseUserName()) == 0))
+                        authID = getAuthID(getMItdb().getParam1(), cat, sch, auths);
+                      if (!CmpSeabaseDDLauth::isUserID(authID))
+                        {
+                          ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_IS_NOT_A_USER,
+                              NULL, NULL, NULL,
+                              getMItdb().getParam1());
+                          step_ = HANDLE_ERROR_;
+                          break;
+                        }
+                    }
 
                   param_[0] = cat;
                   param_[1] = pmsch;
                   param_[2] = role_usage;
                   param_[3] = getMItdb().getParam1();
-                  param_[4] = (char *) privWhereClause.data();
                 }
               break;
               
               case ComTdbExeUtilGetMetadataInfo::PRIVILEGES_FOR_ROLE_:
-              case ComTdbExeUtilGetMetadataInfo::PRIVILEGES_FOR_USER_:
                 {
-                  NABoolean isRole = 
-                     (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PRIVILEGES_FOR_ROLE_); 
-              
-                  // Get the authID associated with the current user
-                  Int32 authID = getAuthID(getMItdb().getParam1(), cat, sch, auths);
+                  // Get the authID for the request
+                  Int32 authID = *currContext->getDatabaseUserID();
+                  if (!(strcmp(getMItdb().getParam1(), currContext->getDatabaseUserName()) == 0))
+                    authID = getAuthID(getMItdb().getParam1(), cat, sch, auths);
 
-                  // If the authID was not found for various reasons just return
-                  // Other "get" commands continue and return no rows but it is
-                  // easier to just return with an error.
-                  if (authID == 0)
-                    { 
-                      ExRaiseSqlError(getHeap(), &diagsArea_, -8732,
+                  char buf[authList.length() + 100];
+
+                  // Verify that requested authID is actually a role
+                  if (!CmpSeabaseDDLauth::isRoleID(authID) && !ComUser::isPublicUserID(authID))
+                    {
+                      ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_IS_NOT_A_ROLE,
                           NULL, NULL, NULL,
                           getMItdb().getParam1());
                       step_ = HANDLE_ERROR_;
                       break;
                     }
 
-                  if (isRole)
+                  // Non elevated users need to be granted role
+                  if (doPrivCheck && !ComUser::currentUserHasRole(authID))
                     {
-                       // treating PUBLIC (-1) as a role in this instance, return
-                       // error if authID is not a role
-                       if (!CmpSeabaseDDLauth::isRoleID(authID) && authID != PUBLIC_USER)
-                        {
-                          ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_IS_NOT_A_ROLE, 
-                              NULL, NULL, NULL,
-                              getMItdb().getParam1());
-                          step_ = HANDLE_ERROR_;
-                          break;
-                        }
+                      ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_NOT_AUTHORIZED);
+                      step_ = HANDLE_ERROR_;
+                      break;
                     }
 
-                  else
-                    {
-                      // Return an error if authID is not a user
-                      if (!CmpSeabaseDDLauth::isUserID(authID))
-                        {
-                          ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_IS_NOT_A_USER, 
-                              NULL, NULL, NULL,
-                              getMItdb().getParam1());
-                          step_ = HANDLE_ERROR_;
-                          break;
-                        }
-                    }
-               
+                  // return all privs for the role
+                  str_sprintf(buf, " = %d ", authID);
+                  privWhereClause = buf;
+
                   qs = getPrivsForAuthsQuery;
                   sizeOfqs = sizeof(getPrivsForAuthsQuery);
 
-                  char buf[authList.length() + 100];
-                  if (isRole)
+                  // This request performs a union between 4 entities:
+                  //  1. object_privileges table
+                  //  2. schema_privileges table
+                  //  3. column privileges table
+                  //  4. hive metadata tables to retrieve column details
+                  // The call to colPrivsFrag returns the required the union 
+                  // statement(s) for items 3 and 4. See colPrivsFrag for details
+                  if (colPrivsFrag(getMItdb().getParam1(), cat, privWhereClause, colPrivsStmt) < 0)
                   {
-                    if (doPrivCheck)
-                      // Only return name if current user has been
-                      // granted the role
-                      str_sprintf(buf, " = %d and %d in %s ", 
-                                  authID, authID, authList.data());
-                    else
-                      // return all role grantees
-                      str_sprintf(buf, " = %d ", authID );
+                    step_ = HANDLE_ERROR_;
+                    break;
                   }
-                  else
-                  {
-                    if (doPrivCheck)
+
+                  // Union privileges between object, column and schema
+                  // object privs
+                  param_[0] = cat;
+                  param_[1] = pmsch;
+                  param_[2] = objPrivs;
+                  param_[3] = (char *) privWhereClause.data();
+
+                  // schema privs
+                  param_[4] = cat;
+                  param_[5] = pmsch;
+                  param_[6] = schPrivs;
+                  param_[7] = (char *) privWhereClause.data();
+
+                  // column privs
+                  param_[8] = (char *) colPrivsStmt.data();
+
+                  numOutputEntries_ = 2;
+                }
+              break;
+
+              case ComTdbExeUtilGetMetadataInfo::PRIVILEGES_FOR_USER_:
+                {
+                  // Get the authID for the request
+                  Int32 authID = *currContext->getDatabaseUserID();
+                  if (!(strcmp(getMItdb().getParam1(), currContext->getDatabaseUserName()) == 0))
+                    authID = getAuthID(getMItdb().getParam1(), cat, sch, auths);
+
+                  // Verify that authID is a user
+                  if (!CmpSeabaseDDLauth::isUserID(authID))
                     {
-                      // If asking for privileges for a user other than CURRENT_USER, 
-                      // use -2 (special user called _SYSTEM), privileges can never 
-                      // be granted to _SYSTEM. This returns an empty list 
-                      // which match other "get" statements behavior.
-                      if (strcmp(getMItdb().getParam1(), currContext->getDatabaseUserName()) != 0)
-                        str_sprintf(buf, " = -2 ");
-                      else
-                       // return all privs for the user and the users roles
-                       str_sprintf(buf, " in %s ", authList.data());
+                      ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_IS_NOT_A_USER,
+                          NULL, NULL, NULL,
+                          getMItdb().getParam1());
+                      step_ = HANDLE_ERROR_;
+                      break;
                     }
 
-                    else
-                      if (*currContext->getDatabaseUserID() == authID)
-                        str_sprintf(buf, " in %s ", authList.data());
-                      else
+                  // Non elevated user cannot get privileges for another user
+                  char buf[authList.length() + 100];
+                  if (doPrivCheck) 
+                    {
+                      if (authID != ComUser::getCurrentUser())
                         {
-                          // If getting privileges for a user other than the CURRENT USER,
-                          // get the list of roles for this other user.
-                          char *userRoleList = getRoleList(authID, cat, pmsch, role_usage);
-                          if (userRoleList)
-                          {
-                            str_sprintf(buf, " in %s ", userRoleList);
-                            NADELETEBASIC(userRoleList, getHeap());
-                          }
-                          else 
-                            str_sprintf(buf, " = %d ", authID);
+                          ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_NOT_AUTHORIZED);
+                          step_ = HANDLE_ERROR_;
+                          break;
                         }
-                  }
+
+                      // return privs for the current user and their roles
+                      str_sprintf(buf, " in %s ", authList.data());
+                    }
+
+                  else
+                    {
+                      // Get role list for requested user
+                      char *userRoleList = getRoleList(authID, cat, pmsch, role_usage);
+                      if (userRoleList)
+                      {
+                        str_sprintf(buf, " in %s ", userRoleList);
+                        NADELETEBASIC(userRoleList, getHeap());
+                      }
+                      else
+                        str_sprintf(buf, " = %d ", authID);
+                    }
                   privWhereClause = buf;
 
+                  qs = getPrivsForAuthsQuery;
+                  sizeOfqs = sizeof(getPrivsForAuthsQuery);
+
                   // This request performs a union between 4 entities:
                   //  1. object_privileges table
                   //  2. schema_privileges table
@@ -2727,6 +2913,7 @@
               break;
 
 
+
               case ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_TABLE_:
               case ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_VIEW_:
               case ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_SEQUENCE_:
@@ -2737,24 +2924,40 @@
                 sizeOfqs = sizeof(getTrafPrivsOnObject);
 
                 // Determine the type of object
-                NAString objType;
                 if (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_TABLE_)
-                  objType = COM_BASE_TABLE_OBJECT_LIT;
+                  var = COM_BASE_TABLE_OBJECT_LIT;
                 else if (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_VIEW_)
-                  objType = COM_VIEW_OBJECT_LIT;
+                  var = COM_VIEW_OBJECT_LIT;
                 else if (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_SEQUENCE_)
-                  objType = COM_SEQUENCE_GENERATOR_OBJECT_LIT;
+                  var = COM_SEQUENCE_GENERATOR_OBJECT_LIT;
                 else if (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_LIBRARY_)
-                  objType = COM_LIBRARY_OBJECT_LIT;
+                  var = COM_LIBRARY_OBJECT_LIT;
                 else
-                  objType = COM_USER_DEFINED_ROUTINE_OBJECT_LIT;
+                  var = COM_USER_DEFINED_ROUTINE_OBJECT_LIT;
 
                 char buf[authList.length() + 100];
+
+                Int32 authID = 0;
+                if (getMItdb().getParam1())
+                  {
+                    authID = *currContext->getDatabaseUserID();
+                    if (!(strcmp(getMItdb().getParam1(), currContext->getDatabaseUserName()) == 0))
+                      authID = getAuthID(getMItdb().getParam1(), cat, sch, auths);
+                  }
+
                 if (doPrivCheck)
                   {
-                    if (getMItdb().getParam1() && 
-                        (strcmp(getMItdb().getParam1(), currContext->getDatabaseUserName()) != 0))
-                          str_sprintf(buf, "and grantee_id = -2 ");
+                    if (getMItdb().getParam1())
+                      {
+                        if ((CmpSeabaseDDLauth::isRoleID(authID) && !ComUser::currentUserHasRole(authID)) ||
+                            (CmpSeabaseDDLauth::isUserID(authID) && authID != ComUser::getCurrentUser()))
+                          {
+                            ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_NOT_AUTHORIZED);
+                            step_ = HANDLE_ERROR_;
+                            break;
+                          }     
+                        str_sprintf(buf, " and grantee_id in %s ", authList.data());
+                      }
                     else
                         str_sprintf(buf, " and grantee_id in %s ", authList.data());
                     privWhereClause = buf;
@@ -2767,7 +2970,6 @@
                           str_sprintf(buf, " and grantee_id in %s ", authList.data());
                         else
                           {
-                            Int32 authID = getAuthID(getMItdb().getParam1(), cat, sch, auths);
                             char *userRoleList = getRoleList(authID, cat, pmsch, role_usage);
                             if (userRoleList)
                               {
@@ -2790,7 +2992,7 @@
                 param_[6] = getMItdb().cat_;
                 param_[7] = getMItdb().sch_;
                 param_[8] = getMItdb().obj_;
-                param_[9] = (char *)objType.data();
+                param_[9] = (char *)var.data();
                 param_[10] = (char *)privWhereClause.data();
                 param_[11] = cat;
                 param_[12] = pmsch;
@@ -2801,7 +3003,7 @@
                 param_[17] = getMItdb().cat_;
                 param_[18] = getMItdb().sch_;
                 param_[19] = getMItdb().obj_;
-                param_[20] = (char *)objType.data();
+                param_[20] = (char *)var.data();
                 param_[21] = (char *)privWhereClause.data();
 
                 numOutputEntries_ = 2;
@@ -2809,46 +3011,54 @@
               }
 
               case ComTdbExeUtilGetMetadataInfo::INDEXES_FOR_USER_:
-              case ComTdbExeUtilGetMetadataInfo::INDEXES_FOR_ROLE_:
                 {
-                  qs = getTrafIndexesForUser;
-                  sizeOfqs = sizeof(getTrafIndexesForUser);
+                  qs = getTrafIndexesForAuth;
+                  sizeOfqs = sizeof(getTrafIndexesForAuth);
 
-                  // Getting objects for the current user
-                  if (strcmp(getMItdb().getParam1(), currContext->getDatabaseUserName()) == 0)
-                    privWhereClause = getGrantedPrivCmd(authList, cat, NAString ("T.object_uid"));
+                  // Get the authID associated with the specified user
+                  Int32 authID = *currContext->getDatabaseUserID();
+                  if (!(strcmp(getMItdb().getParam1(), currContext->getDatabaseUserName()) == 0))
+                    authID = getAuthID(getMItdb().getParam1(), cat, sch, auths);
 
-                  // Getting objects for a user other than the current user
+                  // If not a user, we are done, don't return data
+                  if (!CmpSeabaseDDLauth::isUserID(authID))
+                    {
+                      ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_IS_NOT_A_USER, 
+                          NULL, NULL, NULL,
+                          getMItdb().getParam1());
+                      step_ = HANDLE_ERROR_;
+                      break;
+                    }
+
+                  // Non elevated user cannot view indexes for another user
+                  if (doPrivCheck && authID != ComUser::getCurrentUser())
+                    {
+                      ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_NOT_AUTHORIZED);
+                      step_ = HANDLE_ERROR_;
+                      break;
+                    }
+
+                  // Limit results to privileges allowed for specified user
+                  
+                  if (authID == ComUser::getCurrentUser())
+                    privWhereClause = getGrantedPrivCmd(authList, cat, NAString("T.object_uid"));
                   else
                     {
-                      if (doPrivCheck)
+                      char *userRoleList = getRoleList(authID, cat, pmsch, role_usage);
+                      if (userRoleList)
                         {
-                          // User cannot view privileges for another user
-                          ExRaiseSqlError(getHeap(), &diagsArea_, -1017);
-                          step_ = HANDLE_ERROR_;
-                          break;
+                          privWhereClause = getGrantedPrivCmd(userRoleList, cat, NAString ("T.object_uid"));
+                          NADELETEBASIC(userRoleList, getHeap());
                         }
                       else
                         {
-                          // Get the authID associated with the requested user
-                          Int32 authID = getAuthID(getMItdb().getParam1(), cat, sch, auths);
-
-                          // get the list of roles for this other user.
-                          char *userRoleList = getRoleList(authID, cat, pmsch, role_usage);
-                          if (userRoleList)
-                            {
-                              privWhereClause = getGrantedPrivCmd(userRoleList, cat, NAString ("T.object_uid"));
-                              NADELETEBASIC(userRoleList, getHeap());
-                            }
-                          else
-                            {
-                              // Unable to read metadata
-                              ExRaiseSqlError(getHeap(), &diagsArea_, -8001);
-                              step_ = HANDLE_ERROR_;
-                              break;
-                            }
+                          // Unable to read metadata
+                          ExRaiseSqlError(getHeap(), &diagsArea_, -8001);
+                          step_ = HANDLE_ERROR_;
+                          break;
                         }
                     }
+
                   param_[0] = cat;
                   param_[1] = sch;
                   param_[2] = indexes;
@@ -2863,163 +3073,281 @@
                 }
                 break;
 
-              case ComTdbExeUtilGetMetadataInfo::TABLES_FOR_USER_:
-              case ComTdbExeUtilGetMetadataInfo::TABLES_FOR_ROLE_:
-              case ComTdbExeUtilGetMetadataInfo::VIEWS_FOR_USER_:
-              case ComTdbExeUtilGetMetadataInfo::VIEWS_FOR_ROLE_:
+              case ComTdbExeUtilGetMetadataInfo::INDEXES_FOR_ROLE_:
                 {
-                  NABoolean isUser = 
-                     (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::TABLES_FOR_USER_ ||
-                      getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::VIEWS_FOR_USER_);
+                  qs = getTrafIndexesForAuth;
+                  sizeOfqs = sizeof(getTrafIndexesForAuth);
+
+                  // Get the authID associated with the specified role
+                  Int32 authID = *currContext->getDatabaseUserID();
+                  if (!(strcmp(getMItdb().getParam1(), currContext->getDatabaseUserName()) == 0))
+                    authID = getAuthID(getMItdb().getParam1(), cat, sch, auths);
+
+                  // Verify that the authID is actually a role
+                  if (!CmpSeabaseDDLauth::isRoleID(authID) && !ComUser::isPublicUserID(authID))
+                    {
+                      ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_IS_NOT_A_ROLE, 
+                          NULL, NULL, NULL,
+                          getMItdb().getParam1());
+                      step_ = HANDLE_ERROR_;
+                      break;
+                    }
+
+                  // Non elevated users need to be granted role
+                  if (doPrivCheck && !ComUser::currentUserHasRole(authID))
+                    {
+                      ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_NOT_AUTHORIZED);
+                      step_ = HANDLE_ERROR_;
+                      break;
+                    }
+
+                  // Only return indexes that role (authID) has been granted privs
+                  char buf[30];
+                  str_sprintf(buf, "(%d)", authID);
+                  privWhereClause = getGrantedPrivCmd(buf, cat, NAString ("T.object_uid"));
+
+                  param_[0] = cat;
+                  param_[1] = sch;
+                  param_[2] = indexes;
+                  param_[3] = cat;
+                  param_[4] = sch;
+                  param_[5] = tab;
+                  param_[6] = cat;
+                  param_[7] = sch;
+                  param_[8] = tab;
+                  param_[9] = getMItdb().cat_;
+                  param_[10] = (char *)privWhereClause.data();
+                }
+                break;
+
+
+              case ComTdbExeUtilGetMetadataInfo::TABLES_FOR_USER_:
+              case ComTdbExeUtilGetMetadataInfo::VIEWS_FOR_USER_:
+                {
+                  qs = getTrafObjectsForUser;
+                  sizeOfqs = sizeof(getTrafObjectsForUser);
 
                   // Get the authID associated with the specified user
                   Int32 authID = *currContext->getDatabaseUserID();
                   if (!(strcmp(getMItdb().getParam1(), currContext->getDatabaseUserName()) == 0))
                     authID = getAuthID(getMItdb().getParam1(), cat, sch, auths);
 
-                  // Verify that the user is a user, or the role is a role
-                  NABoolean validAuth = FALSE;
-                  if (isUser  && CmpSeabaseDDLauth::isUserID(authID))
-                    validAuth = TRUE;
-                  if (!isUser && CmpSeabaseDDLauth::isRoleID(authID))
-                    validAuth = TRUE;
-
-                  if (!validAuth)
+                  // Verify that the authID is actually a user
+                  if (!CmpSeabaseDDLauth::isUserID(authID))
                     {
-                      NAString authName = (isUser) ? "user" : "role";
-                      ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_IS_NOT_CORRECT_AUTHID,
+                      ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_IS_NOT_A_USER, 
                           NULL, NULL, NULL,
-                          getMItdb().getParam1(),
-                          authName.data());
+                          getMItdb().getParam1());
                       step_ = HANDLE_ERROR_;
                       break;
                     }
   
-                  qs = getTrafObjectsForUser;
-                  sizeOfqs = sizeof(getTrafObjectsForUser);
+                  // Non elevated user cannot view objects for another user
+                  if (doPrivCheck && authID != ComUser::getCurrentUser())
+                    {
+                      ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_NOT_AUTHORIZED);
+                      step_ = HANDLE_ERROR_;
+                      break;
+                    }
 
-                  NAString objType;
-                  if ((getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::TABLES_FOR_USER_) ||
-                      (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::TABLES_FOR_ROLE_))
-                    objType = COM_BASE_TABLE_OBJECT_LIT;
+                  if (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::TABLES_FOR_USER_)
+                    var = COM_BASE_TABLE_OBJECT_LIT;
                   else
-                    objType = COM_VIEW_OBJECT_LIT;
+                    var = COM_VIEW_OBJECT_LIT;
 
-                  // Getting objects for the current user
-                  if (strcmp(getMItdb().getParam1(), currContext->getDatabaseUserName()) == 0)
+                  // Limit results to privileges allowed for specified user
+                  
+                  if (authID == ComUser::getCurrentUser())
                     privWhereClause = getGrantedPrivCmd(authList, cat, NAString ("T.object_uid"));
 
                   // Getting objects for a user other than the current user
                   else
                     {
-                      if (doPrivCheck)
+                      char *userRoleList = getRoleList(authID, cat, pmsch, role_usage);
+                      if (userRoleList)
                         {
-                          // User cannot view privileges for another user
-                          ExRaiseSqlError(getHeap(), &diagsArea_, -1017);
+                          privWhereClause = getGrantedPrivCmd(userRoleList, cat, NAString ("T.object_uid"));
+                          NADELETEBASIC(userRoleList, getHeap());
+                        }
+                      else 
+                        {
+                          // Unable to read metadata
+                          ExRaiseSqlError(getHeap(), &diagsArea_, -8001);
                           step_ = HANDLE_ERROR_;
                           break;
                         }
-                      else
-                        {
-                          // get the list of roles for this other user.
-                          char *userRoleList = getRoleList(authID, cat, pmsch, role_usage);
-                          if (userRoleList)
-                            {
-                              privWhereClause = getGrantedPrivCmd(userRoleList, cat, NAString ("T.object_uid"));
-                              NADELETEBASIC(userRoleList, getHeap());
-                            }
-                          else 
-                            {
-                              // Unable to read metadata
-                              ExRaiseSqlError(getHeap(), &diagsArea_, -8001);
-                              step_ = HANDLE_ERROR_;
-                              break;
-                            }
-                        }
                     }
 
                   param_[0] = cat;
                   param_[1] = sch;
                   param_[2] = tab;
                   param_[3] = getMItdb().cat_;
-                  param_[4] = (char *)objType.data();
+                  param_[4] = (char *)var.data();
                   param_[5] = (char *)privWhereClause.data();
                 }
               break;
 
-              case ComTdbExeUtilGetMetadataInfo::LIBRARIES_FOR_USER_:
-              case ComTdbExeUtilGetMetadataInfo::LIBRARIES_FOR_ROLE_:
+              case ComTdbExeUtilGetMetadataInfo::TABLES_FOR_ROLE_:
+              case ComTdbExeUtilGetMetadataInfo::VIEWS_FOR_ROLE_:
                 {
-                  NABoolean isUser =
-                     (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::LIBRARIES_FOR_USER_);
+                  qs = getTrafObjectsForUser;
+                  sizeOfqs = sizeof(getTrafObjectsForUser);
 
                   // Get the authID associated with the specified user
                   Int32 authID = *currContext->getDatabaseUserID();
                   if (!(strcmp(getMItdb().getParam1(), currContext->getDatabaseUserName()) == 0))
                     authID = getAuthID(getMItdb().getParam1(), cat, sch, auths);
 
-                  // Verify that the user is a user, or the role is a role
-                  NABoolean validAuth = FALSE;
-                  if (isUser  && CmpSeabaseDDLauth::isUserID(authID))
-                    validAuth = TRUE;
-                  if (!isUser && CmpSeabaseDDLauth::isRoleID(authID))
-                    validAuth = TRUE;
-
-                  if (!validAuth)
+                  // Verify that the specified authID is actually a role
+                  if (!CmpSeabaseDDLauth::isRoleID(authID) && !ComUser::isPublicUserID(authID)) 
                     {
-                      NAString authName = (isUser) ? "user" : "role";
-                      ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_IS_NOT_CORRECT_AUTHID,
+                      ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_IS_NOT_A_ROLE, 
                           NULL, NULL, NULL,
-                          getMItdb().getParam1(),
-                          authName.data());
+                          getMItdb().getParam1());
                       step_ = HANDLE_ERROR_;
                       break;
                     }
 
-                  qs = getTrafLibrariesForUser;
-                  sizeOfqs = sizeof(getTrafLibrariesForUser);
+                  // Non elevated users must be granted the specified role
+                  if (doPrivCheck && !ComUser::currentUserHasRole(authID))
+                    {
+                      ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_NOT_AUTHORIZED);
+                      step_ = HANDLE_ERROR_;
+                      break;
+                    }
 
-                  // Getting libraries for the current user
-                  if (strcmp(getMItdb().getParam1(), currContext->getDatabaseUserName()) == 0)
-                    privWhereClause += getGrantedPrivCmd(authList, cat, NAString("R.udr_uid"));
+                  if (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::TABLES_FOR_ROLE_)
+                    var = COM_BASE_TABLE_OBJECT_LIT;
+                  else
+                    var = COM_VIEW_OBJECT_LIT;
 
-                  // Getting libraries for a user other than the current user
+                  // Only return objects where role (authID) has been granted privs 
+                  char buf[30];
+                  str_sprintf(buf, "(%d)", authID);
+                  privWhereClause = getGrantedPrivCmd(buf, cat, NAString ("T.object_uid"));
+
+                  param_[0] = cat;
+                  param_[1] = sch;
+                  param_[2] = tab;
+                  param_[3] = getMItdb().cat_;
+                  param_[4] = (char *)var.data();
+                  param_[5] = (char *)privWhereClause.data();
+                }
+              break;
+
+              case ComTdbExeUtilGetMetadataInfo::LIBRARIES_FOR_USER_:
+                {
+                  qs = getTrafLibrariesForAuthQuery;
+                  sizeOfqs = sizeof(getTrafLibrariesForAuthQuery);
+
+                  // Get the authID associated with the specified user
+                  Int32 authID = *currContext->getDatabaseUserID();
+                  if (!(strcmp(getMItdb().getParam1(), currContext->getDatabaseUserName()) == 0))
+                    authID = getAuthID(getMItdb().getParam1(), cat, sch, auths);
+
+                  // Verify that the specified authID is actually a user
+                  if (!CmpSeabaseDDLauth::isUserID(authID))
+                    {
+                      ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_IS_NOT_A_USER, 
+                          NULL, NULL, NULL,
+                          getMItdb().getParam1());
+                      step_ = HANDLE_ERROR_;
+                      break;
+                    }
+
+                  // Non elevated user cannot view libraries for another user
+                  if (doPrivCheck && authID != ComUser::getCurrentUser())
+                    {
+                      ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_NOT_AUTHORIZED);
+                      step_ = HANDLE_ERROR_;
+                      break;
+                    }
+                  
+                  // Return libraries that are owned by the user/user's roles
+                  // or that the user/user's role have been granted privileges
+                    
+                  if (authID == ComUser::getCurrentUser())
+                    privWhereClause += getGrantedPrivCmd(authList, cat);
                   else
                     {
-                      if (doPrivCheck)
+                      char *userRoleList = getRoleList(authID, cat, pmsch, role_usage);
+                      if (userRoleList)
                         {
-                          // User cannot view privileges for another user
-                          ExRaiseSqlError(getHeap(), &diagsArea_, -1017);
-                          step_ = HANDLE_ERROR_;
-                          break;
+                          privWhereClause = getGrantedPrivCmd(userRoleList, cat);
+                          NADELETEBASIC(userRoleList, getHeap());
                         }
                       else
                         {
-                          // Get the list of roles for this other user.
-                          char *userRoleList = getRoleList(authID, cat, pmsch, role_usage);
-                          if (userRoleList)
-                            {
-                              privWhereClause = getGrantedPrivCmd(userRoleList, cat, NAString ("R.udr_uid"));
-                              NADELETEBASIC(userRoleList, getHeap());
-                            }
-                          else // return error?
-                            {
-                              // Unable to read metadata
-                              ExRaiseSqlError(getHeap(), &diagsArea_, -8001);
-                              step_ = HANDLE_ERROR_;
-                              break;
-                            }
+                          // Unable to read metadata 
+                          ExRaiseSqlError(getHeap(), &diagsArea_, -8001);
+                          step_ = HANDLE_ERROR_;
+                          break;
                         }
                     }
 
                   param_[0] = cat;
                   param_[1] = sch;
                   param_[2] = tab;
-                  param_[3] = cat;
-                  param_[4] = sch;
-                  param_[5] = routine;
-                  param_[6] = getMItdb().cat_;
-                  param_[7] = (char *) privWhereClause.data();
+                  param_[3] = getMItdb().cat_;
+                  param_[4] = (char *) privWhereClause.data();
+                }
+                break ;
+
+              case ComTdbExeUtilGetMetadataInfo::LIBRARIES_FOR_ROLE_:
+                {
+                  qs = getTrafLibrariesForAuthQuery;
+                  sizeOfqs = sizeof(getTrafLibrariesForAuthQuery);
+
+                  // Get the authID associated with the specified role
+                  Int32 authID = *currContext->getDatabaseUserID();
+                  if (!(strcmp(getMItdb().getParam1(), currContext->getDatabaseUserName()) == 0))
+                    authID = getAuthID(getMItdb().getParam1(), cat, sch, auths);
+
+                  // Verify that the specified authID is actually a role
+                  if (!CmpSeabaseDDLauth::isRoleID(authID) && !ComUser::isPublicUserID(authID)) 
+                    {
+                      ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_IS_NOT_A_ROLE, 
+                          NULL, NULL, NULL,
+                          getMItdb().getParam1());
+                      step_ = HANDLE_ERROR_;
+                      break;
+                    }
+
+                  // Non elevated users must be granted role
+                  if (doPrivCheck && !ComUser::currentUserHasRole(authID))
+                    {
+                      ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_NOT_AUTHORIZED);
+                      step_ = HANDLE_ERROR_;
+                      break;
+                    }
+
+                  // Return libraries that are owned by the user/user's roles
+                  // or that the user/user's role have been granted privileges
+
+                  if (authID == ComUser::getCurrentUser())
+                    privWhereClause += getGrantedPrivCmd(authList, cat);
+                  else
+                    {
+                      char *userRoleList = getRoleList(authID, cat, pmsch, role_usage);
+                      if (userRoleList)
+                        {
+                          privWhereClause = getGrantedPrivCmd(userRoleList, cat);
+                          NADELETEBASIC(userRoleList, getHeap());
+                        }
+                      else
+                        {
+                          // Unable to read metadata 
+                          ExRaiseSqlError(getHeap(), &diagsArea_, -8001);
+                          step_ = HANDLE_ERROR_;
+                          break;
+                        }
+                    }
+
+                  param_[0] = cat;
+                  param_[1] = sch;
+                  param_[2] = tab;
+                  param_[3] = getMItdb().cat_;
+                  param_[4] = (char *) privWhereClause.data();
                 }
                 break ;
 
@@ -3056,38 +3384,41 @@
                     // Get the authID associated with the request's auth name
                     // If can't find authID, NA_UserIdDefault is returned which 
                     // indicates an invalid authID.
-                    Int32 authID = getAuthID(getMItdb().getParam1(), cat, sch, auths);
+                    Int32 authID = *currContext->getDatabaseUserID();
+                    if (!(strcmp(getMItdb().getParam1(), currContext->getDatabaseUserName()) == 0))
+                      authID = getAuthID(getMItdb().getParam1(), cat, sch, auths);
+
+                    // if incorrect auth type, return error
+                    if (!CmpSeabaseDDLauth::isRoleID(authID) && !CmpSeabaseDDLauth::isUserID(authID) &&
+                        !ComUser::isPublicUserID(authID))
+                    {
+                      ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_IS_NOT_CORRECT_AUTHID,
+                          NULL, NULL, NULL,
+                          getMItdb().getParam1(), "user or role");
+                      step_ = HANDLE_ERROR_;
+                      break;
+                    }
 
                     if (doPrivCheck)
                     {
-                       // If asking for privileges for a user that has no privs
-                       //   authName is invalid
-                       //   authName is a user and not the current user
-                       //   authName is a role and not one of the current user roles
-                       // add a predicate to make operation fail with no rows
-                       // This matches other "get" statement's behavior.
-                       NABoolean hasPriv = TRUE;
-                       if ((authID == NA_UserIdDefault) ||
-                           (CmpSeabaseDDLauth::isUserID(authID) &&
-                             (strcmp(getMItdb().getParam1(), currContext->getDatabaseUserName()) != 0)) || 
-                           (CmpSeabaseDDLauth::isRoleID(authID) &&
-                             !ComUser::currentUserHasRole(authID)))
-                       {
-                          privWhereClause += "and (grantee_id = -2) ";
-                          hasPriv = FALSE;
+                      // If asking for privileges for a user that has no privs, return error
+                      if ((CmpSeabaseDDLauth::isRoleID(authID) && !ComUser::currentUserHasRole(authID)) ||
+                          (CmpSeabaseDDLauth::isUserID(authID) && authID != ComUser::getCurrentUser()))
+                      {
+                        ExRaiseSqlError(getHeap(), &diagsArea_, -CAT_NOT_AUTHORIZED);
+                        step_ = HANDLE_ERROR_;
+                        break;
                        }
-                       if (hasPriv)
-                       {
-                          privWhereClause += "and (grantee_name = '";
-                          privWhereClause += getMItdb().getParam1();
-                          privWhereClause += "'";
-                          if (CmpSeabaseDDLauth::isUserID(authID) && getMItdb().cascade())
-                          {
-                              privWhereClause += " or grantee_id in ";
-                              privWhereClause += authList.data();
-                          }
-                          privWhereClause += ")";
-                       }
+
+                       privWhereClause += "and (grantee_name = '";
+                       privWhereClause += getMItdb().getParam1();
+                       privWhereClause += "'";
+                       if (CmpSeabaseDDLauth::isUserID(authID) && getMItdb().cascade())
+                         {
+                            privWhereClause += " or grantee_id in ";
+                            privWhereClause += authList.data();
+                         }
+                        privWhereClause += ")";
                     }
                     else
                     { 
diff --git a/core/sql/executor/ExScheduler.cpp b/core/sql/executor/ExScheduler.cpp
index 76cb9be..8ceba9d 100644
--- a/core/sql/executor/ExScheduler.cpp
+++ b/core/sql/executor/ExScheduler.cpp
@@ -37,6 +37,7 @@
  */
 
 
+#include <dlfcn.h>  
 #include "Platform.h"
 #include "ex_stdh.h"
 #include "ComTdb.h"
@@ -54,6 +55,7 @@
 
 #include "ExCextdecs.h"
 #include "ComRtUtils.h"
+#include "ComSqlcmpdbg.h"
 
 const char *TraceDesc = "SubTask state trace in Scheduler";
 
@@ -75,6 +77,8 @@
   suspended_          = false;
   subtaskLoopCnt_     = 32;
   maxSubtaskLoops_    = 32;
+  localRootTcb_       = NULL;
+  pExpFuncs_          = NULL;
   Int32 i;
   for (i = 0; i < NumLastCalled; i++)
   {
@@ -133,6 +137,9 @@
   Space *space = glob_->getSpace();
   CollHeap *heap = glob_->getDefaultHeap();
   ExTimeStats *timer = NULL;
+#ifdef NA_DEBUG_GUI
+  ExSubtask *subtaskSetInGui = NULL;
+#endif
 
   if (suspended_)
     return WORK_OK;
@@ -206,27 +213,18 @@
 #ifdef NA_DEBUG_GUI
 
 	  //------------------------------------------------------
-	  // GSH : If using tdm_sqlexedbg dll then use the 
+	  // If using the GUI dll then use the 
 	  // appropriate dll function to display the TCB tree.
 	  //------------------------------------------------------
 	  if (msGui_)
 	    {
-	      ExSubtask *savedSubtask = subtask;
+	      subtaskSetInGui = subtask;
 
-	      // to turn the GUI on in the debugger, set msGui_ above
-	      // and reset it to 0 again before entering startGui().
-	      startGui();
+	      pExpFuncs_->fpDisplayExecution(&subtaskSetInGui, this);
 
-	      pExpFuncs_->fpDisplayTCBTree(&subtask, this);
-
-	      if (subtask != savedSubtask)
-		{
-		  // GUI changed the subtask to be executed, set
-		  // an indicator that we have done work, otherwise
-		  // the scheduler might exit because it thinks that
-		  // it has finished an entire round through all subtasks
-		  listHadWork = 1;
-		}
+              if (subtaskSetInGui == subtask)
+                // GUI did not alter the subtask
+                subtaskSetInGui = NULL;
 	    }
 #endif
 
@@ -410,6 +408,22 @@
       // subtasks)
 
       subtask = subtask->getNext();
+
+#ifdef NA_DEBUG_GUI
+      if (msGui_ && subtaskSetInGui && subtaskSetInGui->getNext() != subtask)
+        {
+          // if the user clicked on a task in the GUI, then
+          // schedule and execute that task next
+          subtask = subtaskSetInGui;
+          subtask->schedule();
+          subtaskSetInGui = NULL;
+          // the GUI changed the subtask to be executed, set
+          // an indicator that we have done work, otherwise
+          // the scheduler might exit because it thinks that
+          // it has finished an entire round through all subtasks
+          listHadWork = 1;
+        }
+#endif
       
       // -----------------------------------------------------------------
       // Each time we reach the end of the list, check whether any of the
@@ -557,6 +571,74 @@
 ///////////////////////////////////////////////////////////////////////////
 void ExScheduler::startGui()
 {
+  msGui_ = TRUE;
+
+  if (!pExpFuncs_ && getenv("DISPLAY"))
+    {
+      void* dlptr = dlopen("libSqlCompilerDebugger.so",RTLD_NOW);
+      if(dlptr != NULL)
+        {
+          fpGetSqlcmpdbgExpFuncs GetExportedFunctions;
+
+          GetExportedFunctions = (fpGetSqlcmpdbgExpFuncs) dlsym(
+               dlptr, "GetSqlcmpdbgExpFuncs");
+          if (GetExportedFunctions)
+            pExpFuncs_ = GetExportedFunctions();
+          if (pExpFuncs_ == NULL)
+            dlclose(dlptr);
+        }
+      else // dlopen() failed 
+        { 
+          char *msg = dlerror(); 
+        }
+      msGui_ = (pExpFuncs_ != NULL);
+    }
+}
+
+void ExScheduler::stopGui()
+{
+  msGui_ = FALSE;
+  if (pExpFuncs_)
+    pExpFuncs_->fpDisplayExecution(NULL, this);
+}
+
+void ExScheduler::getProcInfoForGui(int &frag,
+                                    int &inst,
+                                    int &numInst,
+                                    int &nid,
+                                    int &pid,
+                                    char *procNameBuf,
+                                    int procNameBufLen)
+{
+  ExExeStmtGlobals *glob = glob_->castToExExeStmtGlobals();
+  MyGuaProcessHandle myh;
+  Int32 myCpu, myPin, myNodeNum;
+  SB_Int64_Type mySeqNum;
+
+  frag = glob->getMyFragId();
+  inst = glob->getMyInstanceNumber();
+  numInst = glob->getNumOfInstances();
+  myh.decompose(myCpu, myPin, myNodeNum, mySeqNum);
+  nid = myCpu;
+  pid = myPin;
+  myh.toAscii(procNameBuf, procNameBufLen);
+}
+
+int ExScheduler::getFragInstIdForGui()
+{
+  ExExeStmtGlobals *stmtGlobals = glob_->castToExExeStmtGlobals();
+
+  ex_assert(stmtGlobals, "GUI not in master or ESP");
+
+  ExMasterStmtGlobals *masterGlobals = stmtGlobals->castToExMasterStmtGlobals();
+  ExEspStmtGlobals *espGlobals = stmtGlobals->castToExEspStmtGlobals();
+
+  if (masterGlobals)
+    // assume there is only one active fragment instance in the master
+    return 0;
+  ex_assert(espGlobals, "stmt globals in GUI inconsistent");
+
+  return espGlobals->getMyFragInstanceHandle();
 }
 
 ExSubtask * ExScheduler::addOrFindSubtask(
diff --git a/core/sql/executor/ExScheduler.h b/core/sql/executor/ExScheduler.h
index c6f4af5..c8bcd31 100644
--- a/core/sql/executor/ExScheduler.h
+++ b/core/sql/executor/ExScheduler.h
@@ -43,7 +43,7 @@
 
 
 #include "ex_god.h"
-#include "ComSqlexedbg.h"
+#include "ComSqlcmpdbg.h"
 #include "Platform.h"
 
 #include "ComExeTrace.h"
@@ -135,11 +135,6 @@
 
 class ExScheduler : public ExGod
 {
-  //---------------------------------------------------------------------
-  // GSH: These classes are defined in tdm_sqlexedbg component.
-  //---------------------------------------------------------------------
-  friend class CSqlexedbgTCBView;
-  friend class CSqlexedbgTaskView;
 
 public:
 
@@ -265,6 +260,14 @@
   // (this method can also be called from the debugger)!!!
   // ---------------------------------------------------------------------
   void startGui();
+  void stopGui();
+  void getProcInfoForGui(int &frag, int &inst, int &numInst,
+                         int &nid, int &pid, char *procNameBuf,
+                         int procNameBufLen);
+  ExSubtask *getSubtasksForGui() { return subtasks_; }
+  ex_tcb *getLocalRootTcbForGui() { return localRootTcb_; }
+  int getFragInstIdForGui();
+
   // ---------------------------------------------------------------------
   // Method to aid in diagnosing looping problems
   // ---------------------------------------------------------------------
@@ -314,8 +317,8 @@
 
   // should the GUI be displayed?
   NABoolean msGui_;
-  // function pointers for Microsoft GUI
-  SqlexedbgExpFuncs *pExpFuncs_;
+  // function pointers for GUI
+  SqlcmpdbgExpFuncs *pExpFuncs_;
   // root TCB
   ex_tcb *localRootTcb_;
 
@@ -359,13 +362,6 @@
 class ExSubtask
 {
   friend class ExScheduler;
-  //---------------------------------------------------------------------
-  // GSH: These classes are defined in tdm_sqlexedbg component.
-  //---------------------------------------------------------------------
-  friend class CSqlexedbgTCBView;
-  friend class CSqlexedbgTaskView;
-  friend class CSqlexedbgApp;
-
 
 public:
 
@@ -379,9 +375,10 @@
   //
   inline Int32 getBreakPoint() const      { return breakPoint_; }
   inline void setBreakPoint(Int32 val)     { breakPoint_ = val; }  
-  inline const char * getTaskName() const { return taskName_; }
+  inline const char * getTaskName() const   { return taskName_; }
   inline Int32 * getScheduledAddr()       { return &scheduled_; }
-  
+  inline ExSubtask *getNextForGUI()             { return next_; }
+
 protected:
 
   ExSubtask( 
diff --git a/core/sql/executor/ExSequence.cpp b/core/sql/executor/ExSequence.cpp
index 327fb96..bc29779 100644
--- a/core/sql/executor/ExSequence.cpp
+++ b/core/sql/executor/ExSequence.cpp
@@ -289,22 +289,8 @@
   qchild_  = child_tcb.getParentQueue(); 
 
   // Allocate the queue to communicate with parent
-  qparent_.down = new(space) ex_queue(ex_queue::DOWN_QUEUE,
-    myTdb.initialQueueSizeDown_,
-    myTdb.criDescDown_,
-    space);
-
-  // Allocate the private state in each entry of the down queue
-  ExSequencePrivateState *p 
-    = new(space) ExSequencePrivateState(this);
-  qparent_.down->allocatePstate(p, this);
-  delete p;
-
-  qparent_.up = new(space) ex_queue(ex_queue::UP_QUEUE,
-    myTdb.initialQueueSizeUp_,
-    myTdb.criDescUp_,
-    space);
-
+ 
+ allocateParentQueues(qparent_,TRUE);
   // Intialized processedInputs_ to the next request to process
   processedInputs_ = qparent_.down->getTailIndex();
 
@@ -375,6 +361,8 @@
       ex_assert( clusterDb_ , "Unlimited following and no clusterDb_") ;
       clusterDb_->ioEventHandler_ = ioEventHandler_ ;
     }
+    // the parent queues will be resizable, so register a resize subtask.
+    registerResizeSubtasks();
 };
 
 // Free Resources
@@ -1510,7 +1498,7 @@
 // Constructor and destructor private state
 //
 ExSequencePrivateState::ExSequencePrivateState
-(const ExSequenceTcb *  tcb)
+()
 {
   matchCount_ = 0;
   step_ = ExSequenceTcb::ExSeq_EMPTY;
@@ -1524,5 +1512,19 @@
 (const ex_tcb *tcb)
 {
   return new(((ex_tcb*)tcb)->getSpace()) 
-    ExSequencePrivateState((ExSequenceTcb*) tcb);
+    ExSequencePrivateState();
 };
+
+
+////////////////////////////////////////////////////////////////////////
+// Redefine virtual method allocatePstates, to be used by dynamic queue
+// resizing, as well as the initial queue construction.
+////////////////////////////////////////////////////////////////////////
+ex_tcb_private_state * ExSequenceTcb::allocatePstates(
+     Lng32 &numElems,      // inout, desired/actual elements
+     Lng32 &pstateLength)  // out, length of one element
+{
+  PstateAllocator<ExSequencePrivateState> pa;
+
+  return pa.allocatePstates(this, numElems, pstateLength);
+}
diff --git a/core/sql/executor/ExSequence.h b/core/sql/executor/ExSequence.h
index daf324f..dec0069 100644
--- a/core/sql/executor/ExSequence.h
+++ b/core/sql/executor/ExSequence.h
@@ -204,7 +204,9 @@
   
   virtual Int32 numChildren() const;
   virtual const ex_tcb* getChild(Int32 pos) const;
-
+  virtual ex_tcb_private_state * allocatePstates(
+       Lng32 &numElems,      // inout, desired/actual elements
+       Lng32 &pstateLength); // out, length of one element
 private:
   const ex_tcb * childTcb_;
   
@@ -361,7 +363,7 @@
   friend class ExSequenceTcb;
 
 public:
-  ExSequencePrivateState(const ExSequenceTcb * tcb);
+  ExSequencePrivateState();
   ex_tcb_private_state * allocate_new(const ex_tcb * tcb);
   ~ExSequencePrivateState();
 
diff --git a/core/sql/executor/ExTranspose.cpp b/core/sql/executor/ExTranspose.cpp
index ae2d2ff..2545462 100644
--- a/core/sql/executor/ExTranspose.cpp
+++ b/core/sql/executor/ExTranspose.cpp
@@ -124,30 +124,13 @@
   childQueue_.down->allocateAtps(glob->getSpace());
   
   // Allocate the queue to communicate with parent
-  // (Child allocates queue to communicate with Child)
-  //
-  qParent_.down = new(space) ex_queue(ex_queue::DOWN_QUEUE,
-				      transTdb().queueSizeDown_,
-				      transTdb().criDescDown_,
-				      space);
-
-  // Allocate the private state in each entry of the down queue
-  //
-  ExTransposePrivateState privateState(this);
-  qParent_.down->allocatePstate(&privateState, this);
-
-
+ 
+  allocateParentQueues(qParent_,TRUE);
   // Initialize processedInputs_ to refer to the queue entry
   // which will be used next.
   //
   processedInputs_ = qParent_.down->getHeadIndex();
   
-  // Allocate a queue to communicate with the parent node.
-  //
-  qParent_.up = new(space) ex_queue(ex_queue::UP_QUEUE,
-				    transTdb().queueSizeUp_,
-				    transTdb().criDescUp_,
-				    space);
 
   // fixup all expressions expressions
   //
@@ -238,6 +221,8 @@
   // (had returned WORK_OK).
   //
   sched->registerInsertSubtask(sWorkUp, this, childQueue_.up);
+ // the parent queues will be resizable, so register a resize subtask.
+  registerResizeSubtasks();
 }
 
 // ExTransposeTcb::start() ------------------------------------------
@@ -628,7 +613,7 @@
 
 // Constructor and destructor for ExTransposePrivateState
 //
-ExTransposePrivateState::ExTransposePrivateState(const ExTransposeTcb *) 
+ExTransposePrivateState::ExTransposePrivateState() 
 {
   init();
 }
@@ -656,6 +641,18 @@
 ExTransposePrivateState::allocate_new(const ex_tcb *tcb)
 {
   return new(((ex_tcb *)tcb)->getSpace())
-    ExTransposePrivateState((ExTransposeTcb *)tcb);
+    ExTransposePrivateState();
 }
 
+////////////////////////////////////////////////////////////////////////
+// Redefine virtual method allocatePstates, to be used by dynamic queue
+// resizing, as well as the initial queue construction.
+////////////////////////////////////////////////////////////////////////
+ex_tcb_private_state * ExTransposeTcb::allocatePstates(
+     Lng32 &numElems,      // inout, desired/actual elements
+     Lng32 &pstateLength)  // out, length of one element
+{
+  PstateAllocator<ExTransposePrivateState> pa;
+
+  return pa.allocatePstates(this, numElems, pstateLength);
+}
diff --git a/core/sql/executor/ExTranspose.h b/core/sql/executor/ExTranspose.h
index a2a537a..b574d15 100644
--- a/core/sql/executor/ExTranspose.h
+++ b/core/sql/executor/ExTranspose.h
@@ -267,7 +267,9 @@
     if(pos == 0) return childTcb_;
     return NULL;
   }
-
+  virtual ex_tcb_private_state * allocatePstates(
+       Lng32 &numElems,      // inout, desired/actual elements
+       Lng32 &pstateLength); // out, length of one element
 protected:
   
   // The child TCB of this Transpose node.
@@ -329,7 +331,7 @@
 
 public:
 
-  ExTransposePrivateState(const ExTransposeTcb * tcb); 
+  ExTransposePrivateState(); 
 
   ex_tcb_private_state * allocate_new(const ex_tcb * tcb);
 
diff --git a/core/sql/executor/JavaObjectInterface.cpp b/core/sql/executor/JavaObjectInterface.cpp
index 336e555..152cd32 100644
--- a/core/sql/executor/JavaObjectInterface.cpp
+++ b/core/sql/executor/JavaObjectInterface.cpp
@@ -307,15 +307,14 @@
 
   if (!isDefinedInOptions(options, "-XX:HeapDumpPath="))
     {
-      char *mySqRoot = getenv("TRAF_HOME");
+      char *mySqLogs = getenv("TRAF_LOG");
       int len;
-      if (mySqRoot != NULL)
+      if (mySqLogs != NULL)
         {
-          len = strlen(mySqRoot); 
+          len = strlen(mySqLogs); 
           oomDumpDir = new char[len+50];
           strcpy(oomDumpDir, "-XX:HeapDumpPath="); 
-          strcat(oomDumpDir, mySqRoot);
-          strcat(oomDumpDir, "/logs");
+          strcat(oomDumpDir, mySqLogs);
           jvm_options[numJVMOptions].optionString = (char *)oomDumpDir;
           jvm_options[numJVMOptions].extraInfo = NULL;
           numJVMOptions++;
diff --git a/core/sql/executor/ex_esp_frag_dir.cpp b/core/sql/executor/ex_esp_frag_dir.cpp
index e0205f0..a880ae8 100644
--- a/core/sql/executor/ex_esp_frag_dir.cpp
+++ b/core/sql/executor/ex_esp_frag_dir.cpp
@@ -131,6 +131,7 @@
     }
     else
     {
+      bool reincarnated;
       cliGlobals_->setStatsGlobals(statsGlobals_);
       cliGlobals_->setSemId(semId_);
       error = statsGlobals_->getStatsSemaphore(semId_, pid_);
@@ -142,12 +143,14 @@
       // We need to set up the cliGlobals, since addProcess will call getRTSSemaphore
       // and it uses these members
       cliGlobals_->setStatsHeap(statsHeap_);
-      statsGlobals_->addProcess(pid_, statsHeap_);
+      reincarnated = statsGlobals_->addProcess(pid_, statsHeap_);
       ExProcessStats *processStats = 
            statsGlobals_->getExProcessStats(pid_);
       processStats->setStartTime(cliGlobals_->myStartTime());
       cliGlobals_->setExProcessStats(processStats);
       statsGlobals_->releaseStatsSemaphore(semId_, pid_);
+      if (reincarnated)
+         statsGlobals_->logProcessDeath(cpu_, pid_, "Process reincarnated before RIP");
     }
   }
   cliGlobals_->setStatsHeap(statsHeap_);
@@ -191,6 +194,7 @@
     int error = statsGlobals_->getStatsSemaphore(semId_, pid_);
     statsGlobals_->removeProcess(pid_);
     statsGlobals_->releaseStatsSemaphore(semId_, pid_);
+    statsGlobals_->logProcessDeath(cpu_, pid_, "Normal process death");
     sem_close((sem_t *)semId_);
   }
 }
@@ -715,7 +719,7 @@
 	      case ACTIVE:
 
 #ifdef NA_DEBUG_GUI
-		if (instances_[currInst]->displayInGui_ == 2)
+		if (instances_[currInst]->displayInGui_ == 1)
 		  instances_[currInst]->globals_->getScheduler()->startGui();
 #endif
 		// To help debugging (dumps): Put current SB TCB in cli globals
@@ -764,6 +768,11 @@
                       loopAgain = TRUE;
                     }
                   }
+#ifdef NA_DEBUG_GUI
+		if (instances_[currInst]->fiState_ != ACTIVE &&
+                    instances_[currInst]->displayInGui_ == 1)
+		  instances_[currInst]->globals_->getScheduler()->stopGui();
+#endif
                 break;
 
               case WAIT_TO_RELEASE:
diff --git a/core/sql/executor/ex_esp_frag_dir.h b/core/sql/executor/ex_esp_frag_dir.h
index b494227..df7ebd8 100644
--- a/core/sql/executor/ex_esp_frag_dir.h
+++ b/core/sql/executor/ex_esp_frag_dir.h
@@ -41,7 +41,6 @@
 // -----------------------------------------------------------------------
 
 #include "Ex_esp_msg.h"
-#include "ComSqlexedbg.h"
 #include "Globals.h"
 
 // -----------------------------------------------------------------------
diff --git a/core/sql/executor/ex_exe_stmt_globals.h b/core/sql/executor/ex_exe_stmt_globals.h
index bd46988..fdfb0c6 100644
--- a/core/sql/executor/ex_exe_stmt_globals.h
+++ b/core/sql/executor/ex_exe_stmt_globals.h
@@ -683,6 +683,7 @@
   virtual void getMyNodeLocalInstanceNumber(
        Lng32 &myNodeLocalInstanceNumber,
        Lng32 &numOfLocalInstances) const;
+  ExFragInstanceHandle getMyFragInstanceHandle() const { return myHandle_; }
 
   // Virtual methods to retrieve SeaMonster settings
   // 
diff --git a/core/sql/executor/ex_frag_rt.cpp b/core/sql/executor/ex_frag_rt.cpp
index be19fc0..2dfcd7e 100644
--- a/core/sql/executor/ex_frag_rt.cpp
+++ b/core/sql/executor/ex_frag_rt.cpp
@@ -133,7 +133,8 @@
 			     ExFragDir *fragDir,
 			     char  *generatedObject) :
      fragmentEntries_(glob->getDefaultHeap(),fragDir->getNumEntries()),
-     outstandingServiceRequests_(glob->getDefaultHeap())
+     outstandingServiceRequests_(glob->getDefaultHeap()),
+     displayInGui_(FALSE)
 {
   glob_                     = glob;
   fragDir_                  = fragDir;
diff --git a/core/sql/executor/ex_globals.cpp b/core/sql/executor/ex_globals.cpp
index 673690f..c5d53b5 100644
--- a/core/sql/executor/ex_globals.cpp
+++ b/core/sql/executor/ex_globals.cpp
@@ -170,6 +170,11 @@
   return NULL;
 }
 
+ExEspStmtGlobals * ex_globals::castToExEspStmtGlobals()
+{
+  return NULL;
+}
+
 /*
 void * ex_globals::seqGen()
 {
diff --git a/core/sql/executor/ex_globals.h b/core/sql/executor/ex_globals.h
index f6b3a94..a1bdf1a 100644
--- a/core/sql/executor/ex_globals.h
+++ b/core/sql/executor/ex_globals.h
@@ -49,6 +49,7 @@
 class ExExeStmtGlobals;
 class ExMasterStmtGlobals;
 class ExEidStmtGlobals;
+class ExEspStmtGlobals;
 class SqlSessionData;
 class ExStatisticsArea;
 class ex_tcb;
@@ -100,6 +101,7 @@
 
   virtual ExExeStmtGlobals * castToExExeStmtGlobals();
   virtual ExEidStmtGlobals * castToExEidStmtGlobals();
+  virtual ExEspStmtGlobals * castToExEspStmtGlobals();
 
   inline void setStatsArea(ExStatisticsArea * statsArea)
     { statsArea_ = statsArea; }
diff --git a/core/sql/executor/ex_root.cpp b/core/sql/executor/ex_root.cpp
index aa1b870..ef4dffd 100644
--- a/core/sql/executor/ex_root.cpp
+++ b/core/sql/executor/ex_root.cpp
@@ -111,7 +111,8 @@
     ExRtFragTable(master_glob, fragDir_, (char *) this);
 
   // if this tdb is displayed in the GUI then enable GUI display for ESPs
-  rtFragTable->displayGuiForESPs(displayExecution());
+  if (displayExecution() > 0)
+    rtFragTable->displayGuiForESPs(TRUE);
 
   // remember the fragment table in the globals
   master_glob->setRtFragTable(rtFragTable);
@@ -421,12 +422,10 @@
 
 #ifdef NA_DEBUG_GUI
   //-------------------------------------------------------------
-  // GSH: If user has requested use of MS windows based GUI 
-  // display then load the tdm_sqlexedbg dll and SetRootTcb.
-  // Note: displayExecution() return 2 if MS windows based GUI
-  // was requested.
+  // if the user has requested use of the executor GUI 
+  // display then load the dll and set it up
   //-----------------------------------------------------------
-  if (root_tdb.displayExecution() == 2)
+  if (root_tdb.displayExecution() == 1)
     getGlobals()->getScheduler()->startGui();
 #endif
 
@@ -518,9 +517,9 @@
   // there is only one queue pair to the child, no parent queue, and
   // the work procedure does actually no work except interrupting
   // the work procedure immediately when a row can be returned
-  sched->registerUnblockSubtask(sWork,this,qchild.down);
+  sched->registerUnblockSubtask(sWork,this,qchild.down,"WK");
   sched->registerInsertSubtask(sWork,this,qchild.up);
-  asyncCancelSubtask_ = sched->registerNonQueueSubtask(sWork,this,"WK");
+  asyncCancelSubtask_ = sched->registerNonQueueSubtask(sWork,this);
    
   // the frag table has its own event and work procedure, but its
   // work procedure is called through a method of the root TCB
@@ -1451,6 +1450,8 @@
 		    stats->setStatsEnabled(getGlobals()->statsEnabled());
 
 #ifdef NA_DEBUG_GUI
+                  if (root_tdb().displayExecution() > 0)
+                    getGlobals()->getScheduler()->stopGui();
                   ex_tcb::objectCount = 0;
 #endif
                   // Make the rowset handle available
diff --git a/core/sql/executor/ex_root.h b/core/sql/executor/ex_root.h
index 61e04fd..cf1ccc6 100644
--- a/core/sql/executor/ex_root.h
+++ b/core/sql/executor/ex_root.h
@@ -44,7 +44,6 @@
 
 #include "ex_exe_stmt_globals.h"
 #include "exp_expr.h"
-#include "ComSqlexedbg.h"
 #include "SqlTableOpenInfo.h"
 #include "Ipc.h"
 #include "rts_msg.h"
diff --git a/core/sql/executor/ex_send_bottom.cpp b/core/sql/executor/ex_send_bottom.cpp
index 1f115f7..702641e 100644
--- a/core/sql/executor/ex_send_bottom.cpp
+++ b/core/sql/executor/ex_send_bottom.cpp
@@ -399,7 +399,8 @@
   // top node.
   getGlobals()->getScheduler()->registerUnblockSubtask(sWork,
 						       this,
-						       qSplit_.down);
+						       qSplit_.down,
+                                                       "WK");
   getGlobals()->getScheduler()->registerInsertSubtask(sWork,
 						      this,
 						      qSplit_.up);
diff --git a/core/sql/executor/ex_send_top.cpp b/core/sql/executor/ex_send_top.cpp
index c4a1ec9..d6a3241 100644
--- a/core/sql/executor/ex_send_top.cpp
+++ b/core/sql/executor/ex_send_top.cpp
@@ -321,8 +321,8 @@
 
   // register events for parent queues
   ex_assert(qParent_.down && qParent_.up,"Parent queues must exist");
-  sched->registerInsertSubtask(ex_tcb::sWork, this, qParent_.down);
-  sched->registerCancelSubtask(sCancel, this, qParent_.down);
+  sched->registerInsertSubtask(ex_tcb::sWork, this, qParent_.down, "WK");
+  sched->registerCancelSubtask(sCancel, this, qParent_.down,"CN");
   sched->registerUnblockSubtask(ex_tcb::sWork,this, qParent_.up);
 
   // register a non-queue event for the IPC with the send top node
diff --git a/core/sql/executor/ex_split_top.cpp b/core/sql/executor/ex_split_top.cpp
index 248b336..7c5030b 100644
--- a/core/sql/executor/ex_split_top.cpp
+++ b/core/sql/executor/ex_split_top.cpp
@@ -359,7 +359,7 @@
 
   // BertBert VVV
   // The GET_NEXT command causes the WorkDown function to be called.
-  sched->registerNextSubtask(sWorkDown,   this, qParent_.down, "GN");
+  sched->registerNextSubtask(sWorkDown,   this, qParent_.down, "DN");
   // BertBert ^^^
 
   // sometimes it is necessary to schedule the workDown/Up tasks explicitly
diff --git a/core/sql/executor/ex_union.cpp b/core/sql/executor/ex_union.cpp
index 74a3f4d..1cfe82d 100644
--- a/core/sql/executor/ex_union.cpp
+++ b/core/sql/executor/ex_union.cpp
@@ -135,22 +135,10 @@
   ex_cri_desc * to_parent_cri;
   to_parent_cri = childQueues_[0].up->getCriDesc();
   
-  // Allocate the queue to communicate with parent
-  qparent.down = new(space) ex_queue(ex_queue::DOWN_QUEUE,
-				     union_tdb.queueSizeDown_,
-				     union_tdb.criDescDown_,
-				     space);
+  
+  allocateParentQueues(qparent,TRUE);
 
-  // Allocate the private state in each entry of the down queue
-  ex_union_private_state p(this);
-  qparent.down->allocatePstate(&p, this);
   processedInputs_ = qparent.down->getHeadIndex();
-
-  qparent.up = new(space) ex_queue(ex_queue::UP_QUEUE,
-				   union_tdb.queueSizeUp_,
-				   union_tdb.criDescUp_,
-				   space);
-
   // fixup left expression
   if (moveExpr(0))
     (void) moveExpr(0)->fixup(0, getExpressionMode(), this,
@@ -207,7 +195,6 @@
   sched->registerInsertSubtask(sWorkDown, this, qparent.down,"DN");
   sched->registerUnblockSubtask(sWorkDown, this, childQueues_[0].down);
   sched->registerUnblockSubtask(sWorkDown, this, childQueues_[1].down);
-
   // cancellations are handled by the complaints department
   sched->registerCancelSubtask(sCancel, this, qparent.down,"CN");
 
@@ -215,6 +202,8 @@
   sched->registerUnblockSubtask(sWorkUp, this, qparent.up,"UP");
   sched->registerInsertSubtask(sWorkUp, this, childQueues_[0].up);
   sched->registerInsertSubtask(sWorkUp, this, childQueues_[1].up);
+  // the parent queues will be resizable, so register a resize subtask.
+  registerResizeSubtasks();
 }
 
 ///////////////////////////////////////////////////////////
@@ -1120,7 +1109,8 @@
   sched->registerUnblockSubtask(sWorkUp, this, qparent.up,"UP");
   sched->registerInsertSubtask(sWorkUp, this, childQueues_[0].up);
   sched->registerInsertSubtask(sWorkUp, this, childQueues_[1].up);
-
+  // the parent queues will be resizable, so register a resize subtask.
+  registerResizeSubtasks();
 } // ex_o_union_tcb::registerSubtasks
 
 //////////////////////////////////////////////////////////////
@@ -1233,7 +1223,8 @@
     sched->registerInsertSubtask(sWorkUp, this, childQueues_[i].up);
 
   workUpEvent_ = sched->registerNonQueueSubtask(sWorkUp, this);
-
+  // the parent queues will be resizable, so register a resize subtask.
+  registerResizeSubtasks();
 } // ex_union_tcb::registerSubtasks()
 
 ExWorkProcRetcode ex_c_union_tcb::condWorkDown()
@@ -1581,7 +1572,7 @@
 
 // Constructor and destructor for union_private_state
 //
-ex_union_private_state::ex_union_private_state(const ex_union_tcb *) 
+ex_union_private_state::ex_union_private_state() 
 {
   init();
 }
@@ -1601,6 +1592,18 @@
 
 ex_tcb_private_state * ex_union_private_state::allocate_new(const ex_tcb *tcb)
 {
-  return new(((ex_tcb *)tcb)->getSpace()) ex_union_private_state((ex_union_tcb *) tcb);
+  return new(((ex_tcb *)tcb)->getSpace()) ex_union_private_state();
 }
 
+////////////////////////////////////////////////////////////////////////
+// Redefine virtual method allocatePstates, to be used by dynamic queue
+// resizing, as well as the initial queue construction.
+////////////////////////////////////////////////////////////////////////
+ex_tcb_private_state * ex_union_tcb::allocatePstates(
+     Lng32 &numElems,      // inout, desired/actual elements
+     Lng32 &pstateLength)  // out, length of one element
+{
+  PstateAllocator<ex_union_private_state> pa;
+
+  return pa.allocatePstates(this, numElems, pstateLength);
+}
diff --git a/core/sql/executor/ex_union.h b/core/sql/executor/ex_union.h
index 279ff07..557d560 100644
--- a/core/sql/executor/ex_union.h
+++ b/core/sql/executor/ex_union.h
@@ -195,6 +195,9 @@
   virtual Int32 numChildren() const { return union_tdb().numChildren(); }
 //  virtual const ex_tcb* getChild(int pos) const;
   virtual Int32 hasNoOutputs() const {return FALSE;};
+  virtual ex_tcb_private_state * allocatePstates(
+       Lng32 &numElems,      // inout, desired/actual elements
+       Lng32 &pstateLength); // out, length of one element
 protected:
 
   const ex_tcb       *tcbLeft_;      // left tcb
@@ -386,8 +389,8 @@
   void           init();        // initialize state
 
 public:
-
-  ex_union_private_state(const ex_union_tcb * tcb); //constructor
+  
+  ex_union_private_state(); //constructor
   ex_tcb_private_state * allocate_new(const ex_tcb * tcb);
   ~ex_union_private_state();  // destructor
 
diff --git a/core/sql/exp/ExpLOBaccess.cpp b/core/sql/exp/ExpLOBaccess.cpp
index ab592f4..ce48d5d 100644
--- a/core/sql/exp/ExpLOBaccess.cpp
+++ b/core/sql/exp/ExpLOBaccess.cpp
@@ -3950,7 +3950,7 @@
 
 //Enable envvar TRACE_LOB_ACTIONS to enable tracing. 
 //The output file will be in 
-//$TRAF_HOME/logs directory on each node
+//$TRAF_LOG directory on each node
 
 void lobDebugInfo(const char *logMessage,Int32 errorcode,
                          Int32 line, NABoolean lobTrace)
diff --git a/core/sql/exp/ExpSeqGen.cpp b/core/sql/exp/ExpSeqGen.cpp
index 849760b..203f071 100644
--- a/core/sql/exp/ExpSeqGen.cpp
+++ b/core/sql/exp/ExpSeqGen.cpp
@@ -50,6 +50,7 @@
 {
   fetchNewRange_ = TRUE;
   cliInterfaceArr_ = NULL;
+  retryNum_ = 100; //default retry times
 }
 
 short SeqGenEntry::fetchNewRange(SequenceGeneratorAttributes &inSGA)
@@ -61,6 +62,8 @@
   sga = inSGA;
   if (sga.getSGCache() == 0)
     sga.setSGCache(1); 
+
+  sga.setSGRetryNum(getRetryNum());
   cliRC = SQL_EXEC_SeqGenCliInterface(&cliInterfaceArr_, &sga);
   if (cliRC < 0)
     return (short)cliRC;
@@ -143,6 +146,8 @@
       sgQueue()->insert((char*)&hashVal, sizeof(hashVal), sge);
     }
 
+  sge->setRetryNum(getRetryNum());
+
   return sge;
 }
 
diff --git a/core/sql/exp/ExpSeqGen.h b/core/sql/exp/ExpSeqGen.h
index 3db3ab0..6e3f7a5 100644
--- a/core/sql/exp/ExpSeqGen.h
+++ b/core/sql/exp/ExpSeqGen.h
@@ -55,6 +55,9 @@
 
   Int64 getSGObjectUID() { return sgUID_; }
 
+  void setRetryNum(UInt32 n) { retryNum_ = n; }
+  UInt32 getRetryNum() { return retryNum_ ; }
+
  private:
   short fetchNewRange(SequenceGeneratorAttributes &inSGA);
 
@@ -68,6 +71,8 @@
   Int64 cachedCurrValue_;
 
   void * cliInterfaceArr_;
+
+  UInt32 retryNum_;
 };
 
 class SequenceValueGenerator : public NABasicObject
@@ -80,11 +85,15 @@
 
   HashQueue * sgQueue() { return sgQueue_;}
   CollHeap * getHeap() { return heap_; }
+  void setRetryNum(UInt32 n) { retryNum_ = n; }
+  UInt32 getRetryNum() { return retryNum_; }
 
  private:
   CollHeap * heap_;
 
   HashQueue * sgQueue_;
+
+  UInt32 retryNum_;
 };
 
 
diff --git a/core/sql/exp/exp_function.cpp b/core/sql/exp/exp_function.cpp
index 1b47f8f..b04995d 100644
--- a/core/sql/exp/exp_function.cpp
+++ b/core/sql/exp/exp_function.cpp
@@ -736,6 +736,7 @@
 						 Space * space)
   : ex_function_clause(oper_type, 1, attr, space),
     sga_(sga),
+    retryNum_(),
     flags_(0)
 {
 };
@@ -7622,6 +7623,7 @@
   char * result =  op_data[0];
 
   SequenceValueGenerator * seqValGen = getExeGlobals()->seqGen();
+  seqValGen->setRetryNum(getRetryNum());
   Int64 seqVal = 0;
   if (isCurr())
     rc = seqValGen->getCurrSeqVal(sga_, seqVal);
diff --git a/core/sql/exp/exp_function.h b/core/sql/exp/exp_function.h
index b4031ad..c67cf84 100644
--- a/core/sql/exp/exp_function.h
+++ b/core/sql/exp/exp_function.h
@@ -4055,6 +4055,10 @@
 
   NABoolean isCurr() { return ((flags_ & IS_CURR) != 0); }
 
+  void setRetryNum(UInt32 n) { retryNum_ = n; }
+
+  UInt32 getRetryNum() { return retryNum_; }
+
  private:
 enum
   {
@@ -4064,7 +4068,8 @@
   SequenceGeneratorAttributes sga_;
 
   UInt32 flags_;
-  char filler1_[4];
+
+  UInt32 retryNum_;
   // ---------------------------------------------------------------------
 };
 
diff --git a/core/sql/export/NAAbort.cpp b/core/sql/export/NAAbort.cpp
index 262175c..3807d91 100644
--- a/core/sql/export/NAAbort.cpp
+++ b/core/sql/export/NAAbort.cpp
@@ -237,7 +237,7 @@
   SQLMXLoggingArea::logSQLMXAssertionFailureEvent(f, l, m, c, tidPtr); // Any executor thread can log a failure
 
   // Log the message to stderr. On Linux stderr is mapped to a file
-  // under $TRAF_HOME/logs and our output will be prefixed with a
+  // under $TRAF_LOG and our output will be prefixed with a
   // timestamp and process ID.
   cerr << "Executor assertion failure in file " << f
        << " on line " << l << '\n';
diff --git a/core/sql/generator/GenItemFunc.cpp b/core/sql/generator/GenItemFunc.cpp
index 4faff64..ac6d21c 100644
--- a/core/sql/generator/GenItemFunc.cpp
+++ b/core/sql/generator/GenItemFunc.cpp
@@ -2889,6 +2889,8 @@
      *naTable_->getSGAttributes(),
      space);
 
+  sv->setRetryNum(CmpCommon::getDefaultLong(TRAF_SEQUENCE_RETRY_TIMES));
+
   if (cacheSize > 0)
     ((SequenceGeneratorAttributes*)naTable_->getSGAttributes())->setSGCache(origCacheSize);
 
diff --git a/core/sql/generator/GenRelUpdate.cpp b/core/sql/generator/GenRelUpdate.cpp
index b8ae57f..b571125 100644
--- a/core/sql/generator/GenRelUpdate.cpp
+++ b/core/sql/generator/GenRelUpdate.cpp
@@ -2926,6 +2926,8 @@
 	  // operator. On seeing that, executor will flush the buffers.
 	  generator->setVSBBInsert(TRUE);
 	}
+      if (xformedEffUpsert())
+        generator->setEffTreeUpsert(TRUE);
 
       //setting parametes for hbase bulk load integration
       hbasescan_tdb->setIsTrafodionLoadPrep(this->getIsTrafLoadPrep());
diff --git a/core/sql/generator/Generator.cpp b/core/sql/generator/Generator.cpp
index 5e43266..7d45497 100644
--- a/core/sql/generator/Generator.cpp
+++ b/core/sql/generator/Generator.cpp
@@ -312,7 +312,22 @@
       dynQueueSizeValuesAreValid_ = TRUE;
     }
 
-  if (getRightSideOfOnlj() && makeOnljRightQueuesBig_)
+  if  (ActiveSchemaDB()->getDefaults().getToken(DYN_QUEUE_RESIZE_OVERRIDE) == DF_ON)
+    {
+      tdb->setQueueResizeParams(tdb->getMaxQueueSizeDown(), tdb->getMaxQueueSizeUp(),
+                                queueResizeLimit_,queueResizeFactor_);
+    }
+  //Typically the sequence operaotr may have to deal with a large numer of rows when 
+  //it's part of the IM tree that performs elimination of dups. 
+  if ((tdb->getNodeType() == ComTdb::ex_SEQUENCE_FUNCTION) && isEffTreeUpsert())
+    {
+     tdb->setQueueResizeParams(tdb->getMaxQueueSizeDown(), tdb->getMaxQueueSizeUp(),
+                                queueResizeLimit_,queueResizeFactor_); 
+    }
+   // Make the size of the upQ of ONLJ the same as that of the upQ
+   // of the right child. 
+   if ((tdb->getNodeType() == ComTdb::ex_ONLJ || getRightSideOfOnlj()) 
+        && makeOnljRightQueuesBig_)
     {
       tdb->setQueueResizeParams(onljRightSideDownQueue_,
 			        onljRightSideUpQueue_,
@@ -343,7 +358,7 @@
                               queueResizeLimit_,
                               queueResizeFactor_);
   }
-
+ 
   tdb->setTdbId(getAndIncTdbId());
 
   tdb->setPlanVersion(ComVersion_GetCurrentPlanVersion());
@@ -1708,8 +1723,8 @@
 {
   // When authorization is enabled, each object must have at least one grantee
   // - the system grant to the object owner
-  NAList<PrivMgrDesc> *privGrantees = privInfo[0].privmgr_desc_list;
-  DCMPASSERT (privGrantees.size() > 0);
+  PrivMgrDescList *privGrantees = privInfo[0].privmgr_desc_list;
+  DCMPASSERT (privGrantees->entries() > 0);
  
   TrafDesc * priv_desc = TrafAllocateDDLdesc(DESC_PRIV_TYPE, space);
   TrafDesc * first_grantee_desc = NULL;
@@ -1719,17 +1734,18 @@
   // attach to the privileges descriptor (priv_desc)
   for (int i = 0; i < privGrantees->entries(); i++)
     {
-      PrivMgrDesc &granteeDesc = (*privGrantees)[i];
+      PrivMgrDesc *granteeDesc = (*privGrantees)[i];
       TrafDesc * curr_grantee_desc = TrafAllocateDDLdesc(DESC_PRIV_GRANTEE_TYPE, space);
       if (! first_grantee_desc)
         first_grantee_desc = curr_grantee_desc;
 
-      curr_grantee_desc->privGranteeDesc()->grantee = granteeDesc.getGrantee();
+      curr_grantee_desc->privGranteeDesc()->grantee = granteeDesc->getGrantee();
 
       // generate a TrafPrivBitmap for the object level privs and
       // attach it to the privilege grantee descriptor (curr_grantee_desc)
       TrafDesc * bitmap_desc = TrafAllocateDDLdesc(DESC_PRIV_BITMAP_TYPE, space);
-      PrivMgrCoreDesc objDesc = granteeDesc.getTablePrivs();
+      PrivMgrCoreDesc objDesc = granteeDesc->getTablePrivs();
+
       bitmap_desc->privBitmapDesc()->columnOrdinal = -1;
       bitmap_desc->privBitmapDesc()->privBitmap = objDesc.getPrivBitmap().to_ulong();
       bitmap_desc->privBitmapDesc()->privWGOBitmap = objDesc.getWgoBitmap().to_ulong();
@@ -1737,14 +1753,14 @@
 
       // generate a list of TrafPrivBitmapDesc, one for each column and
       // attach it to the TrafPrivGranteeDesc
-      size_t numCols = granteeDesc.getColumnPrivs().entries();
+      size_t numCols = granteeDesc->getColumnPrivs().entries();
       if (numCols > 0)
         {
           TrafDesc * first_col_desc = NULL;
           TrafDesc * prev_col_desc = NULL;
           for (int j = 0; j < numCols; j++)
             {
-              const PrivMgrCoreDesc colBitmap = granteeDesc.getColumnPrivs()[j];
+              const PrivMgrCoreDesc colBitmap = granteeDesc->getColumnPrivs()[j];
               TrafDesc * curr_col_desc = TrafAllocateDDLdesc(DESC_PRIV_BITMAP_TYPE, space);
               if (! first_col_desc)
                 first_col_desc = curr_col_desc;
diff --git a/core/sql/generator/Generator.h b/core/sql/generator/Generator.h
index 2c0ac9e..862199a 100644
--- a/core/sql/generator/Generator.h
+++ b/core/sql/generator/Generator.h
@@ -247,6 +247,8 @@
     // If Hive tables are accessed at runtime
     , HIVE_ACCESS              = 0x00000400
     , CONTAINS_FAST_EXTRACT    = 0x00000800
+    , EFF_TREE_UPSERT          = 0x00001000
+
   };
  
   // Each operator node receives some tupps in its input atp and
@@ -1297,6 +1299,19 @@
       flags2_ &= ~RI_INLINING_FOR_TRAF_IUD ;
   }
 
+
+  
+NABoolean isEffTreeUpsert() {
+   
+     return (flags2_ & EFF_TREE_UPSERT ) != 0;
+  }
+
+  void setEffTreeUpsert(NABoolean v)
+  {
+    v ? flags2_ |= EFF_TREE_UPSERT:
+      flags2_ &= ~EFF_TREE_UPSERT;
+  }
+
   inline Int64 getPlanId();
   inline Lng32 getExplainNodeId() const;
   inline Lng32 getNextExplainNodeId();
diff --git a/core/sql/nskgmake/executor/Makefile b/core/sql/nskgmake/executor/Makefile
index 691c1d2..6b128db 100755
--- a/core/sql/nskgmake/executor/Makefile
+++ b/core/sql/nskgmake/executor/Makefile
@@ -21,6 +21,10 @@
 # @@@ END COPYRIGHT @@@
 #######################################################################
 
+ifeq ($(FLAVOR),debug)
+   CXXFLAGS += -DNA_DEBUG_GUI
+endif
+
 CPPSRC := Allocator.cpp \
 	BufferList.cpp \
 	BufferReference.cpp \
diff --git a/core/sql/optimizer/BindRelExpr.cpp b/core/sql/optimizer/BindRelExpr.cpp
index 716a9c6..43afef6 100644
--- a/core/sql/optimizer/BindRelExpr.cpp
+++ b/core/sql/optimizer/BindRelExpr.cpp
@@ -7005,6 +7005,7 @@
     optStoi = (bindWA->getStoiList())[i];
     stoi = optStoi->getStoi();
     NATable* tab = optStoi->getTable();
+    ComSecurityKeySet secKeySet = tab->getSecKeySet();
 
     // System metadata tables do not, by default, have privileges stored in the
     // NATable structure.  Go ahead and retrieve them now. 
@@ -7012,6 +7013,7 @@
     PrivMgrUserPrivs privInfo;
     if (!pPrivInfo)
     {
+      secKeySet.clear();
       CmpSeabaseDDL cmpSBD(STMTHEAP);
       if (cmpSBD.switchCompiler(CmpContextInfo::CMPCONTEXT_TYPE_META))
       {
@@ -7019,7 +7021,7 @@
           *CmpCommon::diags() << DgSqlCode( -4400 );
         return FALSE;
       }
-      retcode = privInterface.getPrivileges( tab, thisUserID, privInfo);
+      retcode = privInterface.getPrivileges( tab, thisUserID, privInfo, &secKeySet);
       cmpSBD.switchBackCompiler();
 
       if (retcode != STATUS_GOOD)
@@ -7034,7 +7036,7 @@
 
     // Check each primary DML privilege to see if the query requires it. If 
     // so, verify that the user has the privilege
-    bool insertQIKeys = (QI_enabled && tab->getSecKeySet().entries() > 0);
+    bool insertQIKeys = (QI_enabled && secKeySet.entries() > 0);
     for (int_32 i = FIRST_DML_PRIV; i <= LAST_PRIMARY_DML_PRIV; i++)
     {
       if (stoi->getPrivAccess((PrivType)i))
@@ -7043,7 +7045,7 @@
           RemoveNATableEntryFromCache = TRUE;
         else
           if (insertQIKeys)    
-            findKeyAndInsertInOutputList(tab->getSecKeySet(),userHashValue,(PrivType)(i));
+            findKeyAndInsertInOutputList(secKeySet,userHashValue,(PrivType)(i), bindWA);
       }
     }
 
@@ -7085,7 +7087,7 @@
         {
           // do this only if QI is enabled and object has security keys defined
           if ( insertQIKeys )
-            findKeyAndInsertInOutputList(rtn->getSecKeySet(), userHashValue, EXECUTE_PRIV);
+            findKeyAndInsertInOutputList(rtn->getSecKeySet(), userHashValue, EXECUTE_PRIV, bindWA);
         }
 
         // plan requires privilege but user has none, report an error
@@ -7121,6 +7123,7 @@
     NATable* tab = bindWA->getSchemaDB()->getNATableDB()->
                                    get(coProcAggr->getCorrName(), bindWA, NULL);
 
+    ComSecurityKeySet secKeySet = tab->getSecKeySet();
     Int32 numSecKeys = 0;
 
     // Privilege info for the user/table combination is stored in the NATable
@@ -7132,6 +7135,7 @@
     // NATable structure.  Go ahead and retrieve them now. 
     if (!pPrivInfo)
     {
+      secKeySet.clear();
       CmpSeabaseDDL cmpSBD(STMTHEAP);
       if (cmpSBD.switchCompiler(CmpContextInfo::CMPCONTEXT_TYPE_META))
       {
@@ -7139,7 +7143,7 @@
           *CmpCommon::diags() << DgSqlCode( -4400 );
         return FALSE;
       }
-      retcode = privInterface.getPrivileges( tab, thisUserID, privInfo);
+      retcode = privInterface.getPrivileges( tab, thisUserID, privInfo, &secKeySet);
       cmpSBD.switchBackCompiler();
 
       if (retcode != STATUS_GOOD)
@@ -7155,13 +7159,13 @@
     // Verify that the user has select priv
     // Select priv is needed for EXPLAIN requests, so no special check is done
     NABoolean insertQIKeys = FALSE; 
-    if (QI_enabled && (tab->getSecKeySet().entries()) > 0)
+    if (QI_enabled && (secKeySet.entries()) > 0)
       insertQIKeys = TRUE;
     if (pPrivInfo->hasPriv(SELECT_PRIV))
     {
       // do this only if QI is enabled and object has security keys defined
       if ( insertQIKeys )
-        findKeyAndInsertInOutputList(tab->getSecKeySet(), userHashValue, SELECT_PRIV );
+        findKeyAndInsertInOutputList(secKeySet, userHashValue, SELECT_PRIV, bindWA );
     }
 
     // plan requires privilege but user has none, report an error
@@ -7183,12 +7187,14 @@
     SequenceValue *seqVal = (bindWA->getSeqValList())[i];
     NATable* tab = const_cast<NATable*>(seqVal->getNATable());
     CMPASSERT(tab);
+    ComSecurityKeySet secKeySet = tab->getSecKeySet();
 
     // get privilege information from the NATable structure
     PrivMgrUserPrivs *pPrivInfo = tab->getPrivInfo();
     PrivMgrUserPrivs privInfo;
     if (!pPrivInfo)
     {
+      secKeySet.clear();
       CmpSeabaseDDL cmpSBD(STMTHEAP);
       if (cmpSBD.switchCompiler(CmpContextInfo::CMPCONTEXT_TYPE_META))
       {
@@ -7196,7 +7202,7 @@
           *CmpCommon::diags() << DgSqlCode( -4400 );
         return FALSE;
       }
-      retcode = privInterface.getPrivileges(tab, thisUserID, privInfo);
+      retcode = privInterface.getPrivileges(tab, thisUserID, privInfo, &secKeySet);
       cmpSBD.switchBackCompiler();
       if (retcode != STATUS_GOOD)
       {
@@ -7210,13 +7216,13 @@
 
     // Verify that the user has usage priv
     NABoolean insertQIKeys = FALSE; 
-    if (QI_enabled && (tab->getSecKeySet().entries()) > 0)
+    if (QI_enabled && (secKeySet.entries()) > 0)
       insertQIKeys = TRUE;
     if (pPrivInfo->hasPriv(USAGE_PRIV))
     {
       // do this only if QI is enabled and object has security keys defined
       if ( insertQIKeys )
-        findKeyAndInsertInOutputList(tab->getSecKeySet(), userHashValue, USAGE_PRIV );
+        findKeyAndInsertInOutputList(secKeySet, userHashValue, USAGE_PRIV, bindWA );
     }
 
     // plan requires privilege but user has none, report an error
@@ -7248,44 +7254,68 @@
 //   COM_QI_USER_GRANT_SPECIAL_ROLE: privileges granted to PUBLIC
 //
 // Keys are added as follows:
-//   if a privilege has been granted via a role, add a RoleUserKey
-//      if this role is revoked from the user, then invalidation is forced
-//   if a privilege has been granted to public, add a UserObjectPublicKey
-//      if a privilege is revoked from public, then invalidation is forced
-//   if a privilege has been granted directly to an object, add UserObjectKey
-//      if the privilege is revoked from the user, then invalidation is forced
-//   If a privilege has not been granted to an object, but is has been granted
-//      to a role, add a RoleObjectKey
+//   if a privilege has been granted to public, 
+//     add UserObjectPublicKey
+//       invalidation is enforced when priv is revoked from public
+//   if a privilege has been granted on a column of an object to a user:
+//     add UserColumnKey
+//       invalidation is enforced when and column priv is revoked from the user
+//   if a privilege has been granted on a column of an object to a role:
+//      add to ColumnRoleKeys
+//        invalidation is enforced when any priv is revoked from one of these roles
+//        or when one of these roles is revoked from the user.   
+//   if a privilege has been granted directly on an object to a user: 
+//     add UserObjectKey 
+//       invalidation is enforced when priv is revoked from the user
+//   if a privilege has been granted directly on an object to a role:
+//     add an entry to ObjectRoleKeys 
+//       invalidation is enforced when priv is revoked from one of these roles,
+//       or when one of these roles is revoked from user
 //
-//   So if the same privilege has been granted directly to the user and via
-//   a role granted to the user, we only add a UserObjectKey
 // ****************************************************************************
 void RelRoot::findKeyAndInsertInOutputList( ComSecurityKeySet KeysForTab
                                           , const uint32_t userHashValue
                                           , const PrivType which
+                                          , BindWA* bindWA
                                           )
 {
    // If no keys associated with object, just return
    if (KeysForTab.entries() == 0)
      return;
 
+   ComSecurityKey * UserColumnKey = NULL;
+   ComSecurityKey * RoleColumnKey = NULL;
    ComSecurityKey * UserObjectKey = NULL;
    ComSecurityKey * RoleObjectKey = NULL;
    ComSecurityKey * UserObjectPublicKey = NULL;
-   ComSecurityKey * RoleUserKey = NULL;
    
    // These may be implemented at a later time
    ComSecurityKey * UserSchemaKey = NULL; //privs granted at schema level to user
-   ComSecurityKey * RoleSchemaKey = NULL; //privs granted at schema level to role
 
    // Get action type for UserObjectKey based on the privilege (which)
    // so if (which) is SELECT, then the objectActionType is COM_QI_OBJECT_SELECT
    ComSecurityKey  dummyKey;
+   ComQIActionType columnActionType = 
+                   dummyKey.convertBitmapToQIActionType ( which, ComSecurityKey::OBJECT_IS_COLUMN );
    ComQIActionType objectActionType =
                    dummyKey.convertBitmapToQIActionType ( which, ComSecurityKey::OBJECT_IS_OBJECT );
 
    ComSecurityKey * thisKey = NULL;
 
+   // With column level privileges, the user may get privileges from various
+   // roles.  Today, we add all roles that may hold the requested privilege.
+   // If we ever fully support invalidation keys at the column level, then only 
+   // roles that are required to run the query should be added. 
+   // For example, 
+   //  user gets select on table1: col1, col2 from role1
+   //  user gets select on table1: col3, col4 from role2
+   //  If the query performs a select for col1, then only changes to role1 are relevant
+   //  Today, we include both role1 and role2 
+   //  Therefore, if role2 is revoked from the user, invalidation is unnecessarily enforced
+   ComSecurityKeySet ColumnRoleKeys(bindWA->wHeap());
+   ComSecurityKeySet ObjectRoleKeys(bindWA->wHeap());
+   ComSecurityKeySet SchemaRoleKeys(bindWA->wHeap());
+
    // NOTE: hashValueOfPublic will be the same for all keys, so we generate it only once.
    uint32_t hashValueOfPublic = ComSecurityKey::SPECIAL_OBJECT_HASH;
 
@@ -7294,8 +7324,24 @@
    {
       thisKey = &(KeysForTab[ii]);
   
+      // See if the key is column related
+      if ( thisKey->getSecurityKeyType() == columnActionType )
+      {
+         if ( thisKey->getSubjectHashValue() == userHashValue )
+         {
+            // Found a security key for the objectActionType
+            if ( ! UserColumnKey )
+               UserColumnKey = thisKey;
+         }
+         // Found a security key for a role associated with the user
+         else if (qiSubjectMatchesRole(thisKey->getSubjectHashValue()))
+         {
+            ColumnRoleKeys.insert(*thisKey);
+         }
+      }
+
       // See if the key is object related
-      if ( thisKey->getSecurityKeyType() == objectActionType )
+      else if ( thisKey->getSecurityKeyType() == objectActionType )
       {
          if ( thisKey->getSubjectHashValue() == userHashValue )
          {
@@ -7304,23 +7350,12 @@
                UserObjectKey = thisKey;
          }
          // Found a security key for a role associated with the user
-         else
+         else if (qiSubjectMatchesRole(thisKey->getSubjectHashValue()))
          {
-            if ( ! RoleObjectKey )
-               RoleObjectKey = thisKey;
+            ObjectRoleKeys.insert(*thisKey);
          }
       }
      
-      // See if the security key is role related
-      else if (thisKey->getSecurityKeyType() == COM_QI_USER_GRANT_ROLE) 
-      {
-         if ( thisKey->getSubjectHashValue() == userHashValue )
-         {
-            if (! RoleUserKey ) 
-               RoleUserKey = thisKey;
-         }
-      }
-
       else if (thisKey->getSecurityKeyType() == COM_QI_USER_GRANT_SPECIAL_ROLE)
       {
          if (thisKey->getObjectHashValue() == hashValueOfPublic )
@@ -7333,16 +7368,39 @@
       else {;} // Not right action type, just continue traversing.
    }
 
-   // Determine best key, UserObjectKeys are better than RoleObjectKeys
-   ComSecurityKey * BestKey = (UserObjectKey) ? UserObjectKey : RoleObjectKey;
+   // Determine best key (fewest invalidations required)
 
-   if ( BestKey != NULL)
-      securityKeySet_.insert(*BestKey);
+   // For now, always add column invalidation keys.  Once full integration of
+   // column privileges is implemented, then this code changes
+   if (UserColumnKey)
+     securityKeySet_.insert(*UserColumnKey);
+   else if (ColumnRoleKeys.entries() > 0)
+   {
+      for (int j = 0; j < ColumnRoleKeys.entries(); j++)
+      {
+        securityKeySet_.insert(ColumnRoleKeys[j]);
 
-   // Add RoleUserKey if priv comes from role - handles revoke role from user
-   if (BestKey == RoleObjectKey)
-      if ( RoleUserKey )
-         securityKeySet_.insert(*RoleUserKey );
+        // add a key in case the role is revoked from the user
+        ComSecurityKey roleKey(userHashValue, ColumnRoleKeys[j].getSubjectHashValue());
+        securityKeySet_.insert(roleKey);
+      }
+   }
+
+   //   UserObjectKeys are better than ObjectRoleKeys
+   if (UserObjectKey)
+      securityKeySet_.insert(*UserObjectKey);
+
+   else if (ObjectRoleKeys.entries() > 0)
+   {
+      for (int j = 0; j < ObjectRoleKeys.entries(); j++)
+      {
+        securityKeySet_.insert(ObjectRoleKeys[j]);
+
+        // add a key in case the role is revoked from the user
+        ComSecurityKey roleKey(userHashValue, ObjectRoleKeys[j].getSubjectHashValue());
+        securityKeySet_.insert(roleKey);
+      }
+   }
 
    // Add public if it exists - handles revoke public from user
    if ( UserObjectPublicKey != NULL )
diff --git a/core/sql/optimizer/ImplRule.cpp b/core/sql/optimizer/ImplRule.cpp
index bbd4659..91de586 100644
--- a/core/sql/optimizer/ImplRule.cpp
+++ b/core/sql/optimizer/ImplRule.cpp
@@ -2762,7 +2762,7 @@
 
 /*
   // ********************************************************************
-  // This part is disabled untill we have a better way of protecting
+  // This part is disabled until we have a better way of protecting
   // the normalizer output TSJs, and TSJs for write, and TSJs for
   // index joins. In other words, we should only do this heuristic
   // for "optional" TSJ's, i.e. those that were added by the
diff --git a/core/sql/optimizer/Inlining.cpp b/core/sql/optimizer/Inlining.cpp
index e93e33b..89b0d50 100644
--- a/core/sql/optimizer/Inlining.cpp
+++ b/core/sql/optimizer/Inlining.cpp
@@ -2165,19 +2165,21 @@
     // are flowing to this update node.
     // This is also the case when updates are being driven 
     // by rowsets.
-    // The fix is to unconditionally block the ordered union
+    // Changing this code that  unconditionally blocked the ordered union
     // to handle all cases of IM updates.
-    // Note that this may cause performance issues. Improving
-    // the performance is an RFE at the moment. 
-    //if (this->getInliningInfo().isInActionOfRowTrigger() ||
-    //   bindWA->getHostArraysArea())
-    //{
-       ((Union *)indexOp)->setBlockedUnion();
-    //}
-    //else
-    //{
-    //   ((Union *)indexOp)->setOrderedUnion();
-    //}
+    //We can use the ordered union in the case where we have the sequence operator 
+    // in the tree on the left side to remove duplicates before it flows to the 
+    // IM tree. This is to improve performance.
+    // 
+    if (this->getInliningInfo().isInActionOfRowTrigger() ||
+        (bindWA->getHostArraysArea() && !isEffUpsert))
+    {
+      ((Union *)indexOp)->setBlockedUnion();
+    }
+    else
+    {
+      ((Union *)indexOp)->setOrderedUnion();
+    }
 
     // Add a root just to be consistent, so all returns from this method
     // are topped with a RelRoot.
diff --git a/core/sql/optimizer/NARoutine.cpp b/core/sql/optimizer/NARoutine.cpp
index bfd831b..591de2a 100644
--- a/core/sql/optimizer/NARoutine.cpp
+++ b/core/sql/optimizer/NARoutine.cpp
@@ -96,7 +96,7 @@
     , hasOutParams_           (FALSE)
     , redefTime_              (0)
     , lastUsedTime_           (0)
-    , routineSecKeySet_       (heap)
+    , secKeySet_              (heap)
     , passThruDataNumEntries_ (0)
     , passThruData_           (NULL)
     , passThruDataSize_       (NULL)
@@ -122,6 +122,7 @@
     , objectOwner_            (0)
     , schemaOwner_            (0)
     , privInfo_               (NULL)
+    , privDescs_               (NULL)
     , heap_                   (heap)
 {
 }
@@ -164,7 +165,7 @@
     , hasOutParams_           (FALSE)
     , redefTime_              (0)
     , lastUsedTime_           (0)
-    , routineSecKeySet_       (heap)
+    , secKeySet_              (heap)
     , passThruDataNumEntries_ (0)
     , passThruData_           (NULL)
     , passThruDataSize_       (NULL)
@@ -185,6 +186,7 @@
     , objectOwner_            (0)
     , schemaOwner_            (0)
     , privInfo_               (NULL)
+    , privDescs_               (NULL)
     , heap_(heap)
 {
   CollIndex colCount = 0;
@@ -300,7 +302,7 @@
     , hasOutParams_           (old.hasOutParams_)
     , redefTime_              (old.redefTime_)
     , lastUsedTime_           (old.lastUsedTime_)
-    , routineSecKeySet_       (h)
+    , secKeySet_              (h)
     , isUniversal_            (old.isUniversal_)
     , executionMode_          (old.getExecutionMode())
     , objectUID_              (old.objectUID_)
@@ -322,6 +324,7 @@
     , objectOwner_            (0)
     , schemaOwner_            (0) 
     , privInfo_               (NULL)
+    , privDescs_               (NULL)
     , heap_                   (h)
 {
   extRoutineName_ = new (h) ExtendedQualName(*old.extRoutineName_, h);
@@ -350,7 +353,7 @@
     }
   }
 
-  routineSecKeySet_ = old.routineSecKeySet_;
+  secKeySet_ = old.secKeySet_;
 
   heapSize_ = (h ? h->getTotalSize() : 0);
 }
@@ -386,7 +389,7 @@
     , hasOutParams_           (FALSE)
     , redefTime_              (0)  //TODO
     , lastUsedTime_           (0)
-    , routineSecKeySet_       (heap)
+    , secKeySet_              (heap)
     , passThruDataNumEntries_ (0)
     , passThruData_           (NULL)
     , passThruDataSize_       (0)
@@ -406,6 +409,7 @@
     , objectOwner_            (routine_desc->routineDesc()->owner)
     , schemaOwner_            (routine_desc->routineDesc()->schemaOwner)
     , privInfo_               (NULL)
+    , privDescs_               (NULL)
     , heap_(heap)
 {
   char parallelism[5];
@@ -628,7 +632,7 @@
     }
     
      
-  getPrivileges(routine_desc->routineDesc()->priv_desc);
+  getPrivileges(routine_desc->routineDesc()->priv_desc, bindWA);
 
   heapSize_ = (heap ? heap->getTotalSize() : 0);
 }
@@ -671,7 +675,7 @@
 // If authorization is enabled, set privs based on the passed in priv_desc
 // and set up query invalidation (security) keys for the routine.
 // ----------------------------------------------------------------------------
-void NARoutine::getPrivileges(TrafDesc *priv_desc)
+void NARoutine::getPrivileges(TrafDesc *priv_desc, BindWA *bindWA)
 {
   if ( !CmpCommon::context()->isAuthorizationEnabled() || ComUser::isRootUserID())
   {
@@ -703,52 +707,58 @@
                                 COM_STORED_PROCEDURE_OBJECT :
                                 COM_USER_DEFINED_ROUTINE_OBJECT);
 
-    std::vector <ComSecurityKey *>* secKeyVec = new(heap_) std::vector<ComSecurityKey *>;
-    if (privInterface.getPrivileges(objectUID_, objectType,
-                                    ComUser::getCurrentUser(), 
-                                   *privInfo_, secKeyVec) != STATUS_GOOD)
-    {
-      NADELETE(privInfo_, PrivMgrUserPrivs, heap_);
-      privInfo_ = NULL;
-    }
-
+    // get all privileges granted to routine object
+    privDescs_ = new (heap_) PrivMgrDescList(heap_); //initialize empty list
+    PrivStatus privStatus = privInterface.getPrivileges(objectUID_, objectType, *privDescs_);
     cmpSBD.switchBackCompiler();
 
-    if (privInfo_)
-    {
-      for (std::vector<ComSecurityKey*>::iterator iter = secKeyVec->begin();
-           iter != secKeyVec->end();
-           iter++)
-      {
-        // Insertion of the dereferenced pointer results in NASet making
-        // a copy of the object, and then we delete the original.
-        routineSecKeySet_.insert(**iter);
-          delete *iter;
-      }
-    }
+    if (privStatus == STATUS_ERROR)
+      return;
   }
   else
   {
-    // get roles granted to current user 
-    // SQL_EXEC_GetRoleList returns the list of roles from the CliContext
-    std::vector<int32_t> myRoles;
-    Int32 numRoles = 0;
-    Int32 *roleIDs = NULL;
-    if (SQL_EXEC_GetRoleList(numRoles, roleIDs) < 0)
+    // convert priv_desc (TrafPrivDesc) in privDescs_ member
+    privDescs_ = new (heap_) PrivMgrDescList(heap_); //initialize empty list
+    TrafDesc *priv_grantees_desc = priv_desc->privDesc()->privGrantees;
+    while (priv_grantees_desc)
     {
-      *CmpCommon::diags() << DgSqlCode(-1034);
-      return;
+      PrivMgrDesc *privs = new (heap_) PrivMgrDesc(priv_grantees_desc->privGranteeDesc()->grantee);
+      TrafDesc *objectPrivs = priv_grantees_desc->privGranteeDesc()->objectBitmap;
+
+      PrivMgrCoreDesc objectDesc(objectPrivs->privBitmapDesc()->privBitmap,
+                                 objectPrivs->privBitmapDesc()->privWGOBitmap);
+
+      TrafDesc *priv_grantee_desc = priv_grantees_desc->privGranteeDesc();
+      TrafDesc *columnPrivs = priv_grantee_desc->privGranteeDesc()->columnBitmaps;
+      NAList<PrivMgrCoreDesc> columnDescs(NULL);
+      while (columnPrivs)
+      {
+        PrivMgrCoreDesc columnDesc(columnPrivs->privBitmapDesc()->privBitmap,
+                                   columnPrivs->privBitmapDesc()->privWGOBitmap,
+                                   columnPrivs->privBitmapDesc()->columnOrdinal);
+        columnDescs.insert(columnDesc);
+        columnPrivs = columnPrivs->next;
+      }
+
+      privs->setTablePrivs(objectDesc);
+      privs->setColumnPrivs(columnDescs);
+      privs->setHasPublicPriv(ComUser::isPublicUserID(privs->getGrantee()));
+
+      privDescs_->insert(privs);
+      priv_grantees_desc = priv_grantees_desc->next;
     }
-
-    // At this time we should have at least one entry in roleIDs (PUBLIC_USER)
-    CMPASSERT (roleIDs && numRoles > 0);
-
-    for (Int32 i = 0; i < numRoles; i++)
-      myRoles.push_back(roleIDs[i]);
-
-    privInfo_ = new (heap_) PrivMgrUserPrivs;
-    privInfo_->initUserPrivs(myRoles, priv_desc, ComUser::getCurrentUser(),objectUID_, routineSecKeySet_);
   }
+
+  // get roles granted to current user 
+  NAList <Int32> roleIDs(heap_);
+  NAList <Int32> grantees(heap_);
+  if (ComUser::getCurrentUserRoles(roleIDs, grantees) != 0)
+    return;
+
+  // set up privileges for current user
+  privInfo_ = new (heap_) PrivMgrUserPrivs;
+  privInfo_->initUserPrivs(roleIDs, privDescs_, ComUser::getCurrentUser(),
+                           objectUID_, &secKeySet_);
 }
 
 ULng32 NARoutineDBKey::hash() const
diff --git a/core/sql/optimizer/NARoutine.h b/core/sql/optimizer/NARoutine.h
index 9b536d4..304b11f 100644
--- a/core/sql/optimizer/NARoutine.h
+++ b/core/sql/optimizer/NARoutine.h
@@ -145,7 +145,7 @@
   inline const ComString        &getSignature()            const { return signature_; }
   inline const ComObjectName    &getLibrarySqlName()       const { return librarySqlName_; }
   inline const QualifiedName    &getSqlName()              const { return name_; }  
-  inline       ComSecurityKeySet getSecKeySet()                  { return routineSecKeySet_ ; }
+  inline       ComSecurityKeySet getSecKeySet()                  { return secKeySet_ ; }
   inline const Int64             getRoutineID()            const { return objectUID_; }
   inline const Int32              getStateAreaSize()        const { return stateAreaSize_; }
   inline const NAString         &getDllName()              const { return dllName_; }
@@ -174,6 +174,7 @@
   inline Int32                        getActionPosition() const { return actionPosition_; }
 
   inline PrivMgrUserPrivs *              getPrivInfo()    const { return privInfo_; }
+  inline PrivMgrDescList  *              getPrivDescs()   const { return privDescs_; }
   inline Int32                           getObjectOwner() const { return objectOwner_; }
   inline Int32                           getSchemaOwner() const { return schemaOwner_; }
   inline Int64  getLibRedefTime() const {return libRedefTime_;}
@@ -214,7 +215,9 @@
   inline NABoolean hasResultSets()        const { return (maxResults_ > 0); }
 
 
-  void getPrivileges(TrafDesc * priv_desc);
+  void setPrivInfo(PrivMgrUserPrivs *privInfo) { privInfo_ = privInfo; }
+  void setPrivDescs(PrivMgrDescList *privDescs) { privDescs_ = privDescs; }
+  void getPrivileges(TrafDesc * priv_desc, BindWA * bindWA);
 
   // -------------------------------------------------------------------
   // Standard operators
@@ -272,7 +275,6 @@
   NABoolean            isExtraCall_;
   NABoolean            hasOutParams_;
 
-  ComSecurityKeySet    routineSecKeySet_ ;
 
   Int64                objectUID_;
   NABoolean            isUniversal_;
@@ -297,7 +299,10 @@
   COM_VERSION          schemaVersionOfRoutine_;
   Int32                objectOwner_;
   Int32                schemaOwner_;
+
+  PrivMgrDescList     *privDescs_;
   PrivMgrUserPrivs    *privInfo_;
+  ComSecurityKeySet    secKeySet_ ;
 
 };
 
diff --git a/core/sql/optimizer/NATable.cpp b/core/sql/optimizer/NATable.cpp
index 2d13bc2..0f282f6 100644
--- a/core/sql/optimizer/NATable.cpp
+++ b/core/sql/optimizer/NATable.cpp
@@ -4981,6 +4981,7 @@
      hiveTableId_(-1),
      tableDesc_(inTableDesc),
      privInfo_(NULL),
+     privDescs_(NULL),
      secKeySet_(heap),
      newColumns_(heap),
      snapshotName_(NULL),
@@ -5713,6 +5714,7 @@
        tableDesc_(NULL),
        secKeySet_(heap),
        privInfo_(NULL),
+       privDescs_(NULL),
        newColumns_(heap),
        snapshotName_(NULL),
        allColFams_(heap)
@@ -6792,10 +6794,12 @@
     return;
   }
 
+  Int32 currentUser (ComUser::getCurrentUser());
+
   // Generally, if the current user is the object owner, then the automatically
   // have all privs.  However, if this is a shared schema then views can be
   // owned by the current user but not have all privs
-  if (ComUser::getCurrentUser() == owner_ && objectType_ != COM_VIEW_OBJECT)
+  if (currentUser == owner_ && objectType_ != COM_VIEW_OBJECT)
   {
     privInfo_ = new(heap_) PrivMgrUserPrivs;
     privInfo_->setOwnerDefaultPrivs();
@@ -6805,46 +6809,94 @@
   ComSecurityKeySet secKeyVec(heap_);
   if (priv_desc == NULL)
   {
-    if (isHiveTable() || isHbaseCellTable() ||
-        isHbaseRowTable() || isHbaseMapTable())
+    if (!isSeabaseTable())
       readPrivileges();
     else
+    {
       privInfo_ = NULL;
-    return;
+      return;
+    }
   }
   else
   {
     // get roles granted to current user 
-    // SQL_EXEC_GetRoleList returns the list of roles from the CliContext
-    std::vector<int32_t> myRoles;
-    Int32 numRoles = 0;
-    Int32 *roleIDs = NULL;
-    if (SQL_EXEC_GetRoleList(numRoles, roleIDs) < 0)
-    {
-      *CmpCommon::diags() << DgSqlCode(-1034);
+    NAList <Int32> roleIDs(heap_);
+    if (ComUser::getCurrentUserRoles(roleIDs) != 0)
       return;
-    }
+
+    Int32 numRoles = roleIDs.entries();
 
     // At this time we should have at least one entry in roleIDs (PUBLIC_USER)
-    CMPASSERT (roleIDs && numRoles > 0);
+    CMPASSERT (numRoles > 0);
 
-    for (Int32 i = 0; i < numRoles; i++)
-      myRoles.push_back(roleIDs[i]);
+    // (PrivMgrUserPrivs)  privInfo_ are privs for the current user
+    // (PrivMgrDescList)   privDescs_ are all privs for the object
+    // (TrafPrivDesc)      priv_desc are all object privs in TrafDesc form
+    //                     created by CmpSeabaseDDL::getSeabasePrivInfo
+    //                     before the NATable entry is constructed
+    // (ComSecurityKeySet) secKeySet_ are the qi keys for the current user
 
-    // Build privInfo_ based on the priv_desc
-    privInfo_ = new(heap_) PrivMgrUserPrivs;
-    privInfo_->initUserPrivs(myRoles, priv_desc, 
-                             ComUser::getCurrentUser(), 
-                             objectUID_.get_value(), secKeySet_);
-  }
-
-
-  if (privInfo_ == NULL)
+    // Convert priv_desc into a list of PrivMgrDesc (privDescs_)
+    privDescs_ = new (heap_) PrivMgrDescList(heap_); //initialize empty list
+    TrafDesc *priv_grantees_desc = priv_desc->privDesc()->privGrantees;
+    while (priv_grantees_desc)
     {
-      *CmpCommon::diags() << DgSqlCode(-1034);
-      return;
+      PrivMgrDesc *privs = new (heap_) PrivMgrDesc(priv_grantees_desc->privGranteeDesc()->grantee);
+      TrafDesc *objectPrivs = priv_grantees_desc->privGranteeDesc()->objectBitmap;
+      PrivMgrCoreDesc objectDesc(objectPrivs->privBitmapDesc()->privBitmap,
+                                 objectPrivs->privBitmapDesc()->privWGOBitmap);
+
+      TrafDesc *priv_grantee_desc = priv_grantees_desc->privGranteeDesc();
+      TrafDesc *columnPrivs = priv_grantee_desc->privGranteeDesc()->columnBitmaps;
+      NAList<PrivMgrCoreDesc> columnDescs(heap_);
+      while (columnPrivs)
+      {
+        PrivMgrCoreDesc columnDesc(columnPrivs->privBitmapDesc()->privBitmap,
+                                   columnPrivs->privBitmapDesc()->privWGOBitmap,
+                                   columnPrivs->privBitmapDesc()->columnOrdinal);
+        columnDescs.insert(columnDesc);
+        columnPrivs = columnPrivs->next;
+      }
+
+      privs->setTablePrivs(objectDesc);
+      privs->setColumnPrivs(columnDescs);
+
+      privs->setHasPublicPriv(ComUser::isPublicUserID(privs->getGrantee()));
+
+      privDescs_->insert(privs);
+      priv_grantees_desc = priv_grantees_desc->next;
     }
 
+    // Generate privInfo_ and secKeySet_ for current user from privDescs_
+    privInfo_ = new(heap_) PrivMgrUserPrivs;
+    privInfo_->initUserPrivs(roleIDs,
+                             privDescs_,
+                             currentUser,
+                             objectUID_.get_value(),
+                             &secKeySet_);
+
+    if (privInfo_ == NULL)
+    {
+      if (!CmpCommon::diags()->containsError(-1034))
+        *CmpCommon::diags() << DgSqlCode(-1034);
+      return;
+    }
+  }
+
+  // log privileges enabled for table
+  Int32 len = 500;
+  char msg[len];
+  std::string privDetails = privInfo_->print();
+  snprintf(msg, len, "NATable::getPrivileges (list of all privileges on object), user: %s obj %s, %s",
+          ComUser::getCurrentUsername(),
+          qualifiedName_.getExtendedQualifiedNameAsString().data(),
+          privDetails.c_str());
+  QRLogger::log(CAT_SQL_EXE, LL_DEBUG, "%s", msg);
+  if (getenv("DBUSER_DEBUG"))
+  {
+    printf("[DBUSER:%d] %s\n", (int) getpid(), msg);
+    fflush(stdout);
+  }
 }
 
 // Call privilege manager to get privileges and security keys
@@ -6879,8 +6931,10 @@
   std::vector <ComSecurityKey *> secKeyVec;
 
   if (testError || (STATUS_GOOD !=
-                    privInterface.getPrivileges((NATable *)this,
-                                                ComUser::getCurrentUser(), *privInfo_, &secKeyVec)))
+    privInterface.getPrivileges((NATable *)this,
+                                 ComUser::getCurrentUser(),
+                                 *privInfo_, &secKeySet_)))
+
     {
       if (testError)
 #ifndef NDEBUG
diff --git a/core/sql/optimizer/NATable.h b/core/sql/optimizer/NATable.h
index 746142f..f28230c 100644
--- a/core/sql/optimizer/NATable.h
+++ b/core/sql/optimizer/NATable.h
@@ -679,8 +679,6 @@
   NABoolean isToBeRemovedFromCacheBNC() const   /* BNC = Before Next Compilation attempt */
   {  return( (flags_ & REMOVE_FROM_CACHE_BNC) != 0 ); }
 
-  ComSecurityKeySet getSecKeySet() { return secKeySet_ ; }
-
   void setDroppableTable( NABoolean value )
   {  value ? flags_ |= DROPPABLE : flags_ &= ~DROPPABLE; }
 
@@ -917,7 +915,12 @@
   NAMemory* getHeap() const { return heap_; }
   NATableHeapType getHeapType() { return heapType_; }
 
-  PrivMgrUserPrivs* getPrivInfo() const { return privInfo_; }
+  // Privilege related operations
+  PrivMgrDescList  *getPrivDescs() { return privDescs_; }
+  PrivMgrUserPrivs *getPrivInfo() const { return privInfo_; }
+  void setPrivInfo(PrivMgrUserPrivs *privInfo){ privInfo_ = privInfo; }
+  ComSecurityKeySet getSecKeySet() { return secKeySet_ ; }
+  void setSecKeySet(ComSecurityKeySet secKeySet) { secKeySet_ = secKeySet; }
 
   // Get the part of the row size that is computable with info we have available
   // without accessing HBase. The result is passed to estimateHBaseRowCount(),
@@ -1208,8 +1211,6 @@
 
   char *snapshotName_;
 
-  ComSecurityKeySet secKeySet_ ;
-
   TrafDesc *partnsDesc_;
 
   TrafDesc *tableDesc_;
@@ -1242,8 +1243,14 @@
   Int32 hiveDefaultStringLen_;  // in bytes
   Int32 hiveTableId_;
   
-  // Object containing info on all privileges the current user has for this table.
-  PrivMgrUserPrivs* privInfo_;
+  // Privilege information for the object
+  //   privDescs_ is the list of all grants on the object
+  //   privInfo_ are the privs for the current user
+  //   secKeySet_ are the security keys for the current user
+  PrivMgrDescList  *privDescs_;
+  PrivMgrUserPrivs *privInfo_;
+  ComSecurityKeySet secKeySet_ ;
+
   // While creating the index keys, the NAColumn from colArray_
   // is not used in all cases. Sometimes, a new NAColumn is 
   // constructured from the NAColumn. The variable below
diff --git a/core/sql/optimizer/RelExpr.cpp b/core/sql/optimizer/RelExpr.cpp
index da3a7c6..7308bba 100644
--- a/core/sql/optimizer/RelExpr.cpp
+++ b/core/sql/optimizer/RelExpr.cpp
@@ -10764,6 +10764,7 @@
     trueRoot_(FALSE),
     subRoot_(FALSE),
     displayTree_(FALSE),
+    exeDisplay_(FALSE),
     outputVarCnt_(-1),
     inputVarTree_(NULL),
     outputVarTree_(NULL),
@@ -10835,6 +10836,7 @@
     trueRoot_(FALSE),
     subRoot_(FALSE),
     displayTree_(FALSE),
+    exeDisplay_(FALSE),
     outputVarCnt_(-1),
     inputVarTree_(NULL),
     outputVarTree_(NULL),
@@ -10902,6 +10904,7 @@
     trueRoot_(other.trueRoot_),
     subRoot_(other.subRoot_),
     displayTree_(other.displayTree_),
+    exeDisplay_(other.exeDisplay_),
     outputVarCnt_(other.outputVarCnt_),
     inputVarTree_(other.inputVarTree_),
     outputVarTree_(other.outputVarTree_),
diff --git a/core/sql/optimizer/RelMisc.h b/core/sql/optimizer/RelMisc.h
index 9275cac..a54ad38 100644
--- a/core/sql/optimizer/RelMisc.h
+++ b/core/sql/optimizer/RelMisc.h
@@ -337,9 +337,11 @@
   // get a printable string that identifies the operator
   virtual const NAString getText() const;
 
- // set display on/off.
+  // set display on/off.
   void            setDisplayTree(NABoolean val) {displayTree_ = val;}
   NABoolean       getDisplayTree() const 	{return displayTree_;}
+  void            setExeDisplay(NABoolean val)  {exeDisplay_ = val;}
+  NABoolean       getExeDisplay() const 	{return exeDisplay_;}
 
   ExplainTuple *addSpecificExplainInfo(ExplainTupleMaster *explainTuple,
 					      ComTdb * tdb,
@@ -364,7 +366,8 @@
   NABoolean checkPrivileges(BindWA* bindWA);
   void findKeyAndInsertInOutputList( ComSecurityKeySet KeysForTab
                                    , const uint32_t userHashValue
-                                   , const PrivType which );
+                                   , const PrivType which
+                                   , BindWA* bindWA );
 
   //++ MVs
   NABoolean hasMvBindContext() const;
@@ -624,9 +627,9 @@
   // at bind time from the child update/delete node.
   ItemExpr * currOfCursorName_;
 
-  // contains the
   NABoolean  displayTree_; // if set, this tree needs to be displayed.
                            // Set by parser on seeing a DISPLAY command.
+  NABoolean  exeDisplay_;  // if set, display query execution in the GUI
 
   // this flag is set to TRUE if this is an update, delete or insert
   // query. This information is needed at runtime to rollback/abort
diff --git a/core/sql/optimizer/RelSequence.cpp b/core/sql/optimizer/RelSequence.cpp
index f0ce941..b611b94 100644
--- a/core/sql/optimizer/RelSequence.cpp
+++ b/core/sql/optimizer/RelSequence.cpp
@@ -605,6 +605,41 @@
 
 } // RelSequence::rewriteNode()
 
+RelExpr * RelSequence::normalizeNode(NormWA & normWARef)
+{
+  RelExpr *result = RelExpr::normalizeNode(normWARef);
+
+  // See RelRoot::normalizeNode(), which has a code segment for a case
+  // 10-010321-1842 (details of the case are now lost to history).
+  // Since the RelSequence has an order by expression similar to that
+  // of the RelRoot, we have to apply an equivalent fix here, so that
+  // an OVER(ORDER BY x) will work, even if the expression x refers
+  // to something like a parameter or to current_timestamp.
+  // For this case we need to
+  // enforce that Sort operator can sort on this expression by keeping
+  // parameter ?p in RelRoot child's group requiredInput.
+  // NOTE. This solution will force the Sort operator to be done
+  // directly below the RelSequence node.
+  if (requiredOrder_.entries() > 0)
+  {
+    ValueIdSet orderBySet(requiredOrder_), 
+               coveredOrderBySet,
+               inputsNeededForOrderBy;
+
+    GroupAttributes * childGAPtr = child(0).getPtr()->getGroupAttr();
+
+    childGAPtr->coverTest(orderBySet,
+                          getGroupAttr()->getCharacteristicInputs(),
+                          coveredOrderBySet,
+                          inputsNeededForOrderBy);
+
+    childGAPtr->addCharacteristicInputs(inputsNeededForOrderBy);
+  }
+
+  return result;
+}
+
+
 // RelSequence::pullUpPreds() --------------------------------------------
 // is redefined to disallow the pullup of most predicates from the
 // operator's child.  RelSequence can not pull up any predicates from
diff --git a/core/sql/optimizer/RelSequence.h b/core/sql/optimizer/RelSequence.h
index 189fdbe..7733932 100644
--- a/core/sql/optimizer/RelSequence.h
+++ b/core/sql/optimizer/RelSequence.h
@@ -122,8 +122,7 @@
   // predicate pushdown and computing a "minimal" set of
   // characteristic input and characteristic output values.
   //
-  // The default implementation is adequate for RelSequence
-  // virtual RelExpr * normalizeNode(NormWA & normWARef);
+  virtual RelExpr * normalizeNode(NormWA & normWARef);
 
   // Method to push down predicates from a RelSequence node into the
   // children
diff --git a/core/sql/optimizer/Triggers.h b/core/sql/optimizer/Triggers.h
index b787c50..e5a96b8 100644
--- a/core/sql/optimizer/Triggers.h
+++ b/core/sql/optimizer/Triggers.h
@@ -227,7 +227,7 @@
   // allocated or copied to/from the ContextHeap, since some ctor and 
   // copying code specifies CmpCommon::statementHeap() explicitly, regardless 
   // of the parameter given to the overloaded new operator.
-  // Therefore, untill this is fixed, TriggerDB and its content cannot be
+  // Therefore, until this is fixed, TriggerDB and its content cannot be
   // allocated from the CmpCommon::contextHeap(), and is not persistent 
   // across statements. 
   //
diff --git a/core/sql/optimizer/opt.cpp b/core/sql/optimizer/opt.cpp
index ffe2359..ceee395 100644
--- a/core/sql/optimizer/opt.cpp
+++ b/core/sql/optimizer/opt.cpp
@@ -319,12 +319,12 @@
 #ifdef NA_DEBUG_GUI
   CMPASSERT(gpClusterInfo != NULL);
   if (CmpMain::msGui_ && CURRENTSTMT->displayGraph() )
-    CmpMain::pExpFuncs_->fpSqldbgSetPointers(CURRSTMT_OPTGLOBALS->memo
-                                             ,CURRSTMT_OPTGLOBALS->task_list
-                                             ,QueryAnalysis::Instance()
-                                             ,cmpCurrentContext
-                                             ,gpClusterInfo
-                                             );
+    CmpMain::pExpFuncs_->fpSqldbgSetCmpPointers(CURRSTMT_OPTGLOBALS->memo
+                                                ,CURRSTMT_OPTGLOBALS->task_list
+                                                ,QueryAnalysis::Instance()
+                                                ,cmpCurrentContext
+                                                ,gpClusterInfo
+                                                );
 #endif
 
   // ---------------------------------------------------------------------
@@ -634,11 +634,12 @@
           if (CmpMain::msGui_ && CURRENTSTMT->displayGraph())
             {
               CMPASSERT(gpClusterInfo != NULL);
-              CmpMain::pExpFuncs_->fpSqldbgSetPointers(CURRSTMT_OPTGLOBALS->memo, CURRSTMT_OPTGLOBALS->task_list,
-                                                       QueryAnalysis::Instance(),
-                                                       cmpCurrentContext,
-                                                       gpClusterInfo
-                                                       );
+              CmpMain::pExpFuncs_->fpSqldbgSetCmpPointers(
+                   CURRSTMT_OPTGLOBALS->memo,
+                   CURRSTMT_OPTGLOBALS->task_list,
+                   QueryAnalysis::Instance(),
+                   cmpCurrentContext,
+                   gpClusterInfo);
 
               CmpMain::pExpFuncs_->fpDisplayQueryTree(optPass, NULL,
                                                       (void*) context->getSolution());
@@ -7222,12 +7223,12 @@
 #ifdef NA_DEBUG_GUI
   CMPASSERT(gpClusterInfo != NULL);
   if (CmpMain::msGui_ && CURRENTSTMT->displayGraph() )
-    CmpMain::pExpFuncs_->fpSqldbgSetPointers( CURRSTMT_OPTGLOBALS->memo
-					      ,CURRSTMT_OPTGLOBALS->task_list
-					      ,QueryAnalysis::Instance()
-					      ,cmpCurrentContext
-					      ,gpClusterInfo
-					      );
+    CmpMain::pExpFuncs_->fpSqldbgSetCmpPointers(
+         CURRSTMT_OPTGLOBALS->memo,
+         CURRSTMT_OPTGLOBALS->task_list,
+         QueryAnalysis::Instance(),
+         cmpCurrentContext,
+         gpClusterInfo);
 #endif
 }
 
@@ -7272,12 +7273,12 @@
   if (CmpMain::msGui_ && CURRENTSTMT->displayGraph())
     {
       CMPASSERT(gpClusterInfo != NULL);
-      CmpMain::pExpFuncs_->fpSqldbgSetPointers( CURRSTMT_OPTGLOBALS->memo,
-						CURRSTMT_OPTGLOBALS->task_list,
-						QueryAnalysis::Instance(),
-						cmpCurrentContext,
-						gpClusterInfo
-						);
+      CmpMain::pExpFuncs_->fpSqldbgSetCmpPointers(
+           CURRSTMT_OPTGLOBALS->memo,
+           CURRSTMT_OPTGLOBALS->task_list,
+           QueryAnalysis::Instance(),
+           cmpCurrentContext,
+           gpClusterInfo);
 
       CmpMain::pExpFuncs_->fpDisplayQueryTree( optPass, NULL,
 					       (void*) context->getSolution());
diff --git a/core/sql/qmscommon/QRLogger.cpp b/core/sql/qmscommon/QRLogger.cpp
index 850c7d0..bb32f4f 100644
--- a/core/sql/qmscommon/QRLogger.cpp
+++ b/core/sql/qmscommon/QRLogger.cpp
@@ -41,6 +41,7 @@
 #include "seabed/fserr.h"
 
 BOOL gv_QRLoggerInitialized_ = FALSE;
+QRLogger *gv_QRLoggerInstance_ = NULL;
 
 using namespace log4cxx;
 using namespace log4cxx::helpers;
@@ -99,8 +100,9 @@
 // **************************************************************************
 QRLogger& QRLogger::instance()
 {
-  static QRLogger onlyInstance_;
-  return onlyInstance_;
+  if (gv_QRLoggerInstance_ == NULL)
+     gv_QRLoggerInstance_ = new QRLogger();
+  return *gv_QRLoggerInstance_;
 }
 
 
diff --git a/core/sql/qmscommon/QRLogger.h b/core/sql/qmscommon/QRLogger.h
index 6e8244c..cd3f399 100644
--- a/core/sql/qmscommon/QRLogger.h
+++ b/core/sql/qmscommon/QRLogger.h
@@ -28,6 +28,8 @@
 #include "NAString.h"
 #include "CommonLogger.h"
 
+class QRLogger;
+extern QRLogger *gv_QRLoggerInstance_;
 // -----  these categories are currently not used
 // qmscomon
 extern std::string CAT_SQL_COMP_QR_COMMON;
diff --git a/core/sql/refresh/RefreshTest.h b/core/sql/refresh/RefreshTest.h
index df14d89..c8f3ded 100644
--- a/core/sql/refresh/RefreshTest.h
+++ b/core/sql/refresh/RefreshTest.h
@@ -117,7 +117,7 @@
 	CRUOptions options_;
 
 	//-- Output file , the journal can be initialized only after we 
-	// recieve the globals message that contains the output filename
+	// receive the globals message that contains the output filename
 	CRUJournal *pJournal_;
 	CUOFsTransManager transManager_;
 	
diff --git a/core/sql/regress/executor/EXPECTED015.SB b/core/sql/regress/executor/EXPECTED015.SB
index a7df8af..1c1dc16 100755
--- a/core/sql/regress/executor/EXPECTED015.SB
+++ b/core/sql/regress/executor/EXPECTED015.SB
@@ -2098,10 +2098,10 @@
 15   .    16   root                            x                     4.00E+000
 7    14   15   nested_join                                           4.00E+000
 10   13   14   merge_union                                           4.00E+000
-11   12   13   blocked_union                                         2.00E+000
+11   12   13   ordered_union                                         2.00E+000
 .    .    12   trafodion_insert                T015T16I2             1.00E+000
 .    .    11   trafodion_vsbb_delet            T015T16I2             1.00E+000
-8    9    10   blocked_union                                         2.00E+000
+8    9    10   ordered_union                                         2.00E+000
 .    .    9    trafodion_insert                T015T16I1             1.00E+000
 .    .    8    trafodion_vsbb_delet            T015T16I1             1.00E+000
 5    6    7    nested_join                                           1.00E+000
@@ -2269,14 +2269,14 @@
 >>-- should fail, constraint violation
 >>merge into t015tc1 on a='FIVE' when matched then update set c= 'BALD';
 
-*** ERROR[8101] The operation is prevented by check constraint TRAFODION.SCH.T015TC1_454758687_3491 on table TRAFODION.SCH.T015TC1.
+*** ERROR[8101] The operation is prevented by check constraint TRAFODION.SCH.T015TC1_971855625_5413 on table TRAFODION.SCH.T015TC1.
 
 --- 0 row(s) updated.
 >>
 >>-- should fail, constraint violation
 >>merge into t015tc1 on a = 'TENT' when matched then update set b = 'ACID';
 
-*** ERROR[8101] The operation is prevented by check constraint TRAFODION.SCH.T015TC1_318658687_3491 on table TRAFODION.SCH.T015TC1.
+*** ERROR[8101] The operation is prevented by check constraint TRAFODION.SCH.T015TC1_216755625_5413 on table TRAFODION.SCH.T015TC1.
 
 --- 0 row(s) updated.
 >>
@@ -2300,7 +2300,7 @@
 >>merge into t015tc1 on a = 'NOSH' when matched then update set b = 'GOOD'
 +>  when not matched then insert values ('GOOD','GOOD','BOMB');
 
-*** ERROR[8101] The operation is prevented by check constraint TRAFODION.SCH.T015TC1_454758687_3491 on table TRAFODION.SCH.T015TC1.
+*** ERROR[8101] The operation is prevented by check constraint TRAFODION.SCH.T015TC1_971855625_5413 on table TRAFODION.SCH.T015TC1.
 
 --- 0 row(s) updated.
 >>
@@ -2325,21 +2325,21 @@
 >>-- should fail because of constraint on C
 >>insert into t015tc1 values ('ACID','TEST','ACID');
 
-*** ERROR[8101] The operation is prevented by check constraint TRAFODION.SCH.T015TC1_454758687_3491 on table TRAFODION.SCH.T015TC1.
+*** ERROR[8101] The operation is prevented by check constraint TRAFODION.SCH.T015TC1_971855625_5413 on table TRAFODION.SCH.T015TC1.
 
 --- 0 row(s) inserted.
 >>
 >>-- should fail because of constraint on B
 >>insert into t015tc1 values ('ACID','ACID','TEST');
 
-*** ERROR[8101] The operation is prevented by check constraint TRAFODION.SCH.T015TC1_318658687_3491 on table TRAFODION.SCH.T015TC1.
+*** ERROR[8101] The operation is prevented by check constraint TRAFODION.SCH.T015TC1_216755625_5413 on table TRAFODION.SCH.T015TC1.
 
 --- 0 row(s) inserted.
 >>
 >>-- should fail because of constraint on B
 >>update t015tc1 set a = 'COOL', b = 'ACID' where a = 'TENT';
 
-*** ERROR[8101] The operation is prevented by check constraint TRAFODION.SCH.T015TC1_318658687_3491 on table TRAFODION.SCH.T015TC1.
+*** ERROR[8101] The operation is prevented by check constraint TRAFODION.SCH.T015TC1_216755625_5413 on table TRAFODION.SCH.T015TC1.
 
 --- 0 row(s) updated.
 >>
@@ -2358,14 +2358,14 @@
 >>-- should fail because of constraint on A
 >>insert into t015tc2 values ('NUMB','NUMB','NUMB');
 
-*** ERROR[8101] The operation is prevented by check constraint TRAFODION.SCH.T015TC2_289858687_3491 on table TRAFODION.SCH.T015TC2.
+*** ERROR[8101] The operation is prevented by check constraint TRAFODION.SCH.T015TC2_724165625_5413 on table TRAFODION.SCH.T015TC2.
 
 --- 0 row(s) inserted.
 >>
 >>-- should fail because of constraint on A
 >>update t015tc2 set a = 'NUMB', b = 'OKAY' where a = 'TENT';
 
-*** ERROR[8101] The operation is prevented by check constraint TRAFODION.SCH.T015TC2_289858687_3491 on table TRAFODION.SCH.T015TC2.
+*** ERROR[8101] The operation is prevented by check constraint TRAFODION.SCH.T015TC2_724165625_5413 on table TRAFODION.SCH.T015TC2.
 
 --- 0 row(s) updated.
 >>
diff --git a/core/sql/regress/executor/EXPECTED106 b/core/sql/regress/executor/EXPECTED106
index efe1966..9c82498 100644
--- a/core/sql/regress/executor/EXPECTED106
+++ b/core/sql/regress/executor/EXPECTED106
@@ -79,7 +79,7 @@
 (EXPR)            (EXPR)                    
 ----------------  --------------------------
 
-FUNKY_OPT_UNIQUE  2015-07-10 17:06:19.088376
+FUNKY_OPT_UNIQUE  2018-09-11 06:33:58.000451
 
 --- 1 row(s) selected.
 >>
@@ -94,7 +94,7 @@
 (EXPR)            (EXPR)                    
 ----------------  --------------------------
 
-FUNKY_OPT_UNIQUE  2015-07-10 17:06:19.593994
+FUNKY_OPT_UNIQUE  2018-09-11 06:34:02.000806
 
 --- 1 row(s) selected.
 >>
@@ -109,7 +109,7 @@
 (EXPR)            (EXPR)                    
 ----------------  --------------------------
 
-FUNKY_OPT_UNIQUE  2015-07-10 17:06:25.701964
+FUNKY_OPT_UNIQUE  2018-09-11 06:34:06.000900
 
 --- 1 row(s) selected.
 >>
@@ -124,7 +124,7 @@
 (EXPR)            (EXPR)                    
 ----------------  --------------------------
 
-FUNKY_OPT_UNIQUE  2015-07-10 17:06:27.328307
+FUNKY_OPT_UNIQUE  2018-09-11 06:34:07.000032
 
 --- 1 row(s) selected.
 >>
@@ -197,7 +197,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-subject launch canceler - FUNKY_OPT_UNIQUE  2015-07-10 17:06:27.705202
+subject launch canceler - FUNKY_OPT_UNIQUE  2018-09-11 06:34:07.000305
 
 --- 1 row(s) selected.
 >>
@@ -215,7 +215,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-subject synch cancel - FUNKY_OPT_UNIQUE     2015-07-10 17:06:28.699544
+subject synch cancel - FUNKY_OPT_UNIQUE     2018-09-11 06:34:08.000400
 
 --- 1 row(s) selected.
 >>
@@ -242,7 +242,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-done with synch_cancel - FUNKY_OPT_UNIQUE   2015-07-10 17:06:38.788316
+done with synch_cancel - FUNKY_OPT_UNIQUE   2018-09-11 06:34:15.000481
 
 --- 1 row(s) selected.
 >>log;
@@ -254,7 +254,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-subject execute s1 - FUNKY_OPT_UNIQUE       2015-07-10 17:06:38.813948
+subject execute s1 - FUNKY_OPT_UNIQUE       2018-09-11 06:34:15.000508
 
 --- 1 row(s) selected.
 >>
@@ -277,7 +277,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-subject - FUNKY_OPT_UNIQUE                  2015-07-10 17:06:51.861646
+subject - FUNKY_OPT_UNIQUE                  2018-09-11 06:34:28.000500
 
 --- 1 row(s) selected.
 >>
@@ -304,7 +304,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-done with synch_cancel - FUNKY_OPT_UNIQUE   2015-07-10 17:06:51.912524
+done with synch_cancel - FUNKY_OPT_UNIQUE   2018-09-11 06:34:28.000539
 
 --- 1 row(s) selected.
 >>log;
@@ -329,7 +329,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler going to sleep - FUNKY_OPT_UNIQUE  2015-07-10 17:06:38.714664
+canceler going to sleep - FUNKY_OPT_UNIQUE  2018-09-11 06:34:15.000384
 
 --- 1 row(s) selected.
 >>
@@ -341,7 +341,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler woke up - FUNKY_OPT_UNIQUE         2015-07-10 17:06:51.735687
+canceler woke up - FUNKY_OPT_UNIQUE         2018-09-11 06:34:28.000405
 
 --- 1 row(s) selected.
 >>
@@ -358,7 +358,7 @@
 --- 1 row(s) inserted.
 >>
 >>obey cancel_cmd;
->>control query cancel qid MXID11000021348212303307894875569000000000206U3333300_183_S1;
+>>control query cancel qid MXID11000020942212403407567430015000000000206U3333300_415_S1;
 
 --- SQL operation complete.
 >>
@@ -373,7 +373,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler - FUNKY_OPT_UNIQUE                 2015-07-10 17:06:51.817032
+canceler - FUNKY_OPT_UNIQUE                 2018-09-11 06:34:28.000496
 
 --- 1 row(s) selected.
 >>log;
@@ -441,7 +441,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-done with synch_cancel - FUNKY_OPT_UNIQUE   2015-07-10 17:07:03.399656
+done with synch_cancel - FUNKY_OPT_UNIQUE   2018-09-11 06:34:37.000537
 
 --- 1 row(s) selected.
 >>log;
@@ -467,7 +467,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-subject - FUNKY_OPT_UNIQUE                  2015-07-10 17:07:16.484716
+subject - FUNKY_OPT_UNIQUE                  2018-09-11 06:34:53.000589
 
 --- 1 row(s) selected.
 >>
@@ -494,7 +494,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-done with synch_cancel - FUNKY_OPT_UNIQUE   2015-07-10 17:07:16.521981
+done with synch_cancel - FUNKY_OPT_UNIQUE   2018-09-11 06:34:53.000623
 
 --- 1 row(s) selected.
 >>log;
@@ -519,7 +519,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler going to sleep - FUNKY_OPT_UNIQUE  2015-07-10 17:07:03.311535
+canceler going to sleep - FUNKY_OPT_UNIQUE  2018-09-11 06:34:37.000479
 
 --- 1 row(s) selected.
 >>
@@ -531,7 +531,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler woke up - FUNKY_OPT_UNIQUE         2015-07-10 17:07:16.361158
+canceler woke up - FUNKY_OPT_UNIQUE         2018-09-11 06:34:50.000499
 
 --- 1 row(s) selected.
 >>
@@ -548,7 +548,7 @@
 --- 1 row(s) inserted.
 >>
 >>obey cancel_cmd;
->>control query cancel qid MXID11000021348212303307894875569000000000206U3333300_222_S1;
+>>control query cancel qid MXID11000020942212403407567430015000000000206U3333300_473_S1;
 
 --- SQL operation complete.
 >>
@@ -563,7 +563,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler - FUNKY_OPT_UNIQUE                 2015-07-10 17:07:16.472310
+canceler - FUNKY_OPT_UNIQUE                 2018-09-11 06:34:53.000582
 
 --- 1 row(s) selected.
 >>log;
@@ -594,7 +594,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-subject launch canceler - FUNKY_OPT_UNIQUE  2015-07-10 17:07:18.686506
+subject launch canceler - FUNKY_OPT_UNIQUE  2018-09-11 06:34:55.000817
 
 --- 1 row(s) selected.
 >>
@@ -612,7 +612,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-subject synch cancel - FUNKY_OPT_UNIQUE     2015-07-10 17:07:18.705866
+subject synch cancel - FUNKY_OPT_UNIQUE     2018-09-11 06:34:55.000839
 
 --- 1 row(s) selected.
 >>
@@ -639,7 +639,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-done with synch_cancel - FUNKY_OPT_UNIQUE   2015-07-10 17:07:28.373358
+done with synch_cancel - FUNKY_OPT_UNIQUE   2018-09-11 06:35:02.000687
 
 --- 1 row(s) selected.
 >>log;
@@ -651,7 +651,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-subject execute s1 - FUNKY_OPT_UNIQUE       2015-07-10 17:07:28.394035
+subject execute s1 - FUNKY_OPT_UNIQUE       2018-09-11 06:35:02.000710
 
 --- 1 row(s) selected.
 >>
@@ -672,7 +672,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-subject - FUNKY_OPT_UNIQUE                  2015-07-10 17:07:48.064685
+subject - FUNKY_OPT_UNIQUE                  2018-09-11 06:35:26.000940
 
 --- 1 row(s) selected.
 >>
@@ -699,7 +699,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-done with synch_cancel - FUNKY_OPT_UNIQUE   2015-07-10 17:07:48.096812
+done with synch_cancel - FUNKY_OPT_UNIQUE   2018-09-11 06:35:26.000980
 
 --- 1 row(s) selected.
 >>log;
@@ -724,7 +724,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler going to sleep - FUNKY_OPT_UNIQUE  2015-07-10 17:07:28.302277
+canceler going to sleep - FUNKY_OPT_UNIQUE  2018-09-11 06:35:02.000666
 
 --- 1 row(s) selected.
 >>
@@ -736,7 +736,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler woke up - FUNKY_OPT_UNIQUE         2015-07-10 17:07:41.320811
+canceler woke up - FUNKY_OPT_UNIQUE         2018-09-11 06:35:15.000685
 
 --- 1 row(s) selected.
 >>
@@ -753,7 +753,7 @@
 --- 1 row(s) inserted.
 >>
 >>obey cancel_cmd;
->>control query cancel qid MXID11000021348212303307894875569000000000206U3333300_237_S1;
+>>control query cancel qid MXID11000020942212403407567430015000000000206U3333300_488_S1;
 
 --- SQL operation complete.
 >>
@@ -768,7 +768,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler - FUNKY_OPT_UNIQUE                 2015-07-10 17:07:41.407319
+canceler - FUNKY_OPT_UNIQUE                 2018-09-11 06:35:15.000794
 
 --- 1 row(s) selected.
 >>log;
@@ -791,7 +791,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-subject launch canceler - FUNKY_OPT_UNIQUE  2015-07-10 17:07:50.195393
+subject launch canceler - FUNKY_OPT_UNIQUE  2018-09-11 06:35:29.000124
 
 --- 1 row(s) selected.
 >>
@@ -809,7 +809,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-subject synch cancel - FUNKY_OPT_UNIQUE     2015-07-10 17:07:50.215880
+subject synch cancel - FUNKY_OPT_UNIQUE     2018-09-11 06:35:29.000143
 
 --- 1 row(s) selected.
 >>
@@ -836,7 +836,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-done with synch_cancel - FUNKY_OPT_UNIQUE   2015-07-10 17:07:59.487739
+done with synch_cancel - FUNKY_OPT_UNIQUE   2018-09-11 06:35:35.000996
 
 --- 1 row(s) selected.
 >>log;
@@ -848,7 +848,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-subject execute s1 - FUNKY_OPT_UNIQUE       2015-07-10 17:07:59.508758
+subject execute s1 - FUNKY_OPT_UNIQUE       2018-09-11 06:35:36.000017
 
 --- 1 row(s) selected.
 >>
@@ -869,7 +869,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-subject - FUNKY_OPT_UNIQUE                  2015-07-10 17:08:25.759995
+subject - FUNKY_OPT_UNIQUE                  2018-09-11 06:35:58.000197
 
 --- 1 row(s) selected.
 >>
@@ -896,7 +896,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-done with synch_cancel - FUNKY_OPT_UNIQUE   2015-07-10 17:08:25.795455
+done with synch_cancel - FUNKY_OPT_UNIQUE   2018-09-11 06:35:58.000238
 
 --- 1 row(s) selected.
 >>log;
@@ -921,7 +921,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler going to sleep - FUNKY_OPT_UNIQUE  2015-07-10 17:07:59.486860
+canceler going to sleep - FUNKY_OPT_UNIQUE  2018-09-11 06:35:35.000921
 
 --- 1 row(s) selected.
 >>
@@ -933,7 +933,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler woke up - FUNKY_OPT_UNIQUE         2015-07-10 17:08:12.509301
+canceler woke up - FUNKY_OPT_UNIQUE         2018-09-11 06:35:48.000940
 
 --- 1 row(s) selected.
 >>
@@ -950,7 +950,7 @@
 --- 1 row(s) inserted.
 >>
 >>obey cancel_cmd;
->>control query cancel qid MXID11000021348212303307894875569000000000206U3333300_253_S1;
+>>control query cancel qid MXID11000020942212403407567430015000000000206U3333300_504_S1;
 
 --- SQL operation complete.
 >>
@@ -965,7 +965,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler - FUNKY_OPT_UNIQUE                 2015-07-10 17:08:12.606156
+canceler - FUNKY_OPT_UNIQUE                 2018-09-11 06:35:49.000030
 
 --- 1 row(s) selected.
 >>log;
@@ -987,7 +987,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-subject launch canceler - FUNKY_OPT_UNIQUE  2015-07-10 17:08:29.298685
+subject launch canceler - FUNKY_OPT_UNIQUE  2018-09-11 06:36:01.000614
 
 --- 1 row(s) selected.
 >>
@@ -1005,7 +1005,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-subject synch cancel - FUNKY_OPT_UNIQUE     2015-07-10 17:08:29.318388
+subject synch cancel - FUNKY_OPT_UNIQUE     2018-09-11 06:36:01.000635
 
 --- 1 row(s) selected.
 >>
@@ -1032,7 +1032,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-done with synch_cancel - FUNKY_OPT_UNIQUE   2015-07-10 17:08:38.782601
+done with synch_cancel - FUNKY_OPT_UNIQUE   2018-09-11 06:36:08.000598
 
 --- 1 row(s) selected.
 >>log;
@@ -1044,7 +1044,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-subject execute s1 - FUNKY_OPT_UNIQUE       2015-07-10 17:08:38.800701
+subject execute s1 - FUNKY_OPT_UNIQUE       2018-09-11 06:36:08.000621
 
 --- 1 row(s) selected.
 >>
@@ -1065,7 +1065,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-subject - FUNKY_OPT_UNIQUE                  2015-07-10 17:08:56.574479
+subject - FUNKY_OPT_UNIQUE                  2018-09-11 06:36:26.000066
 
 --- 1 row(s) selected.
 >>
@@ -1092,7 +1092,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-done with synch_cancel - FUNKY_OPT_UNIQUE   2015-07-10 17:08:56.608716
+done with synch_cancel - FUNKY_OPT_UNIQUE   2018-09-11 06:36:26.000099
 
 --- 1 row(s) selected.
 >>log;
@@ -1117,7 +1117,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler going to sleep - FUNKY_OPT_UNIQUE  2015-07-10 17:08:38.771967
+canceler going to sleep - FUNKY_OPT_UNIQUE  2018-09-11 06:36:08.000507
 
 --- 1 row(s) selected.
 >>
@@ -1129,7 +1129,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler woke up - FUNKY_OPT_UNIQUE         2015-07-10 17:08:51.799087
+canceler woke up - FUNKY_OPT_UNIQUE         2018-09-11 06:36:21.000532
 
 --- 1 row(s) selected.
 >>
@@ -1146,7 +1146,7 @@
 --- 1 row(s) inserted.
 >>
 >>obey cancel_cmd;
->>control query cancel qid MXID11000021348212303307894875569000000000206U3333300_268_S1;
+>>control query cancel qid MXID11000020942212403407567430015000000000206U3333300_519_S1;
 
 --- SQL operation complete.
 >>
@@ -1161,7 +1161,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler - FUNKY_OPT_UNIQUE                 2015-07-10 17:08:54.940529
+canceler - FUNKY_OPT_UNIQUE                 2018-09-11 06:36:24.000621
 
 --- 1 row(s) selected.
 >>log;
@@ -1201,7 +1201,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-subject launch canceler - FUNKY_OPT_UNIQUE  2015-07-10 17:08:59.019859
+subject launch canceler - FUNKY_OPT_UNIQUE  2018-09-11 06:36:28.000327
 
 --- 1 row(s) selected.
 >>
@@ -1219,7 +1219,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-subject synch cancel - FUNKY_OPT_UNIQUE     2015-07-10 17:08:59.038540
+subject synch cancel - FUNKY_OPT_UNIQUE     2018-09-11 06:36:28.000355
 
 --- 1 row(s) selected.
 >>
@@ -1246,7 +1246,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-done with synch_cancel - FUNKY_OPT_UNIQUE   2015-07-10 17:09:08.728176
+done with synch_cancel - FUNKY_OPT_UNIQUE   2018-09-11 06:36:36.000161
 
 --- 1 row(s) selected.
 >>log;
@@ -1258,7 +1258,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-subject execute s1 - FUNKY_OPT_UNIQUE       2015-07-10 17:09:08.748097
+subject execute s1 - FUNKY_OPT_UNIQUE       2018-09-11 06:36:36.000183
 
 --- 1 row(s) selected.
 >>
@@ -1279,7 +1279,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-subject - FUNKY_OPT_UNIQUE                  2015-07-10 17:09:25.863895
+subject - FUNKY_OPT_UNIQUE                  2018-09-11 06:36:53.000319
 
 --- 1 row(s) selected.
 >>
@@ -1306,7 +1306,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-done with synch_cancel - FUNKY_OPT_UNIQUE   2015-07-10 17:09:25.898587
+done with synch_cancel - FUNKY_OPT_UNIQUE   2018-09-11 06:36:53.000352
 
 --- 1 row(s) selected.
 >>log;
@@ -1331,7 +1331,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler going to sleep - FUNKY_OPT_UNIQUE  2015-07-10 17:09:08.679253
+canceler going to sleep - FUNKY_OPT_UNIQUE  2018-09-11 06:36:36.000131
 
 --- 1 row(s) selected.
 >>
@@ -1343,7 +1343,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler woke up - FUNKY_OPT_UNIQUE         2015-07-10 17:09:21.705227
+canceler woke up - FUNKY_OPT_UNIQUE         2018-09-11 06:36:49.000152
 
 --- 1 row(s) selected.
 >>
@@ -1360,7 +1360,7 @@
 --- 1 row(s) inserted.
 >>
 >>obey cancel_cmd;
->>control query cancel qid MXID11000021348212303307894875569000000000206U3333300_306_S1;
+>>control query cancel qid MXID11000020942212403407567430015000000000206U3333300_578_S1;
 
 --- SQL operation complete.
 >>
@@ -1375,7 +1375,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler - FUNKY_OPT_UNIQUE                 2015-07-10 17:09:24.803186
+canceler - FUNKY_OPT_UNIQUE                 2018-09-11 06:36:52.000247
 
 --- 1 row(s) selected.
 >>log;
@@ -1383,6 +1383,15 @@
 >>
 >>
 >>obey TEST106(upsert_test1);
+>>cqd DYN_QUEUE_RESIZE_OVERRIDE 'ON';
+
+--- SQL operation complete.
+>>cqd GEN_TRSP_SIZE_DOWN '16';
+
+--- SQL operation complete.
+>>cqd GEN_TRSP_SIZE_UP '16';
+
+--- SQL operation complete.
 >>
 >>prepare s1 from 
 +>upsert using load into t106c 
@@ -1416,7 +1425,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-subject launch canceler - FUNKY_OPT_UNIQUE  2015-07-10 17:09:28.259737
+subject launch canceler - FUNKY_OPT_UNIQUE  2018-09-11 06:36:55.000602
 
 --- 1 row(s) selected.
 >>
@@ -1434,7 +1443,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-subject synch cancel - FUNKY_OPT_UNIQUE     2015-07-10 17:09:28.282876
+subject synch cancel - FUNKY_OPT_UNIQUE     2018-09-11 06:36:55.000634
 
 --- 1 row(s) selected.
 >>
@@ -1461,7 +1470,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-done with synch_cancel - FUNKY_OPT_UNIQUE   2015-07-10 17:09:37.705479
+done with synch_cancel - FUNKY_OPT_UNIQUE   2018-09-11 06:37:02.000489
 
 --- 1 row(s) selected.
 >>log;
@@ -1473,7 +1482,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-subject execute s1 - FUNKY_OPT_UNIQUE       2015-07-10 17:09:37.727412
+subject execute s1 - FUNKY_OPT_UNIQUE       2018-09-11 06:37:02.000512
 
 --- 1 row(s) selected.
 >>
@@ -1494,7 +1503,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-subject - FUNKY_OPT_UNIQUE                  2015-07-10 17:09:53.821321
+subject - FUNKY_OPT_UNIQUE                  2018-09-11 06:37:15.000544
 
 --- 1 row(s) selected.
 >>
@@ -1521,7 +1530,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-done with synch_cancel - FUNKY_OPT_UNIQUE   2015-07-10 17:09:53.952650
+done with synch_cancel - FUNKY_OPT_UNIQUE   2018-09-11 06:37:15.000581
 
 --- 1 row(s) selected.
 >>log;
@@ -1546,7 +1555,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler going to sleep - FUNKY_OPT_UNIQUE  2015-07-10 17:09:37.708310
+canceler going to sleep - FUNKY_OPT_UNIQUE  2018-09-11 06:37:02.000440
 
 --- 1 row(s) selected.
 >>
@@ -1558,7 +1567,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler woke up - FUNKY_OPT_UNIQUE         2015-07-10 17:09:50.732984
+canceler woke up - FUNKY_OPT_UNIQUE         2018-09-11 06:37:15.000459
 
 --- 1 row(s) selected.
 >>
@@ -1575,7 +1584,7 @@
 --- 1 row(s) inserted.
 >>
 >>obey cancel_cmd;
->>control query cancel qid MXID11000021348212303307894875569000000000206U3333300_321_S1;
+>>control query cancel qid MXID11000020942212403407567430015000000000206U3333300_596_S1;
 
 --- SQL operation complete.
 >>
@@ -1590,12 +1599,20 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler - FUNKY_OPT_UNIQUE                 2015-07-10 17:09:53.825816
+canceler - FUNKY_OPT_UNIQUE                 2018-09-11 06:37:15.000546
 
 --- 1 row(s) selected.
 >>log;
 >>
->>
+>>cqd DYN_QUEUE_RESIZE_OVERRIDE reset;
+
+--- SQL operation complete.
+>>cqd GEN_TRSP_SIZE_DOWN reset;
+
+--- SQL operation complete.
+>>cqd GEN_TRSP_SIZE_UP reset;
+
+--- SQL operation complete.
 >>
 >>obey TEST106(cpu_bound_esps);
 >>
@@ -1643,10 +1660,10 @@
 >>select 'done with synch_cancel - FUNKY_OPT_UNIQUE', 
 +>       CURRENT_TIMESTAMP (6) from (values (1)) as t1;
 
-(EXPR)                                      (EXPR)                    
-------------------------------------------  --------------------------
+(EXPR)                                     (EXPR)                    
+-----------------------------------------  --------------------------
 
-done with synch_cancel - FUNKY_OPT_UNIQUE   2015-07-10 17:10:06.471498
+done with synch_cancel - FUNKY_OPT_UNIQUE  2018-09-11 06:37:24.000952
 
 --- 1 row(s) selected.
 >>log;
@@ -1668,10 +1685,10 @@
 >>
 >>select 'subject - FUNKY_OPT_UNIQUE', CURRENT_TIMESTAMP (6) from (values (1)) as t1;
 
-(EXPR)                                      (EXPR)                    
-------------------------------------------  --------------------------
+(EXPR)                                     (EXPR)                    
+-----------------------------------------  --------------------------
 
-subject - FUNKY_OPT_UNIQUE                  2015-07-10 17:10:30.700079
+subject - FUNKY_OPT_UNIQUE                 2018-09-11 06:37:52.000240
 
 --- 1 row(s) selected.
 >>
@@ -1695,10 +1712,10 @@
 >>select 'done with synch_cancel - FUNKY_OPT_UNIQUE', 
 +>       CURRENT_TIMESTAMP (6) from (values (1)) as t1;
 
-(EXPR)                                      (EXPR)                    
-------------------------------------------  --------------------------
+(EXPR)                                     (EXPR)                    
+-----------------------------------------  --------------------------
 
-done with synch_cancel - FUNKY_OPT_UNIQUE   2015-07-10 17:10:30.735707
+done with synch_cancel - FUNKY_OPT_UNIQUE  2018-09-11 06:37:52.000293
 
 --- 1 row(s) selected.
 >>log;
@@ -1723,7 +1740,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler going to sleep - FUNKY_OPT_UNIQUE  2015-07-10 17:10:06.408419
+canceler going to sleep - FUNKY_OPT_UNIQUE  2018-09-11 06:37:24.000927
 
 --- 1 row(s) selected.
 >>
@@ -1735,7 +1752,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler woke up - FUNKY_OPT_UNIQUE         2015-07-10 17:10:19.430779
+canceler woke up - FUNKY_OPT_UNIQUE         2018-09-11 06:37:37.000947
 
 --- 1 row(s) selected.
 >>
@@ -1752,7 +1769,7 @@
 --- 1 row(s) inserted.
 >>
 >>obey cancel_cmd;
->>control query cancel qid MXID11000021348212303307894875569000000000206U3333300_337_S1;
+>>control query cancel qid MXID11000020942212403407567430015000000000206U3333300_615_S1;
 
 --- SQL operation complete.
 >>
@@ -1767,7 +1784,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler - FUNKY_OPT_UNIQUE                 2015-07-10 17:10:19.515222
+canceler - FUNKY_OPT_UNIQUE                 2018-09-11 06:37:41.000047
 
 --- 1 row(s) selected.
 >>log;
@@ -1830,7 +1847,7 @@
 (EXPR)                                     (EXPR)                    
 -----------------------------------------  --------------------------
 
-done with synch_cancel - FUNKY_OPT_UNIQUE  2015-07-10 17:10:42.359509
+done with synch_cancel - FUNKY_OPT_UNIQUE  2018-09-11 06:38:01.000517
 
 --- 1 row(s) selected.
 >>log;
@@ -1855,7 +1872,7 @@
 (EXPR)                                     (EXPR)                    
 -----------------------------------------  --------------------------
 
-subject - FUNKY_OPT_UNIQUE                 2015-07-10 17:11:06.522144
+subject - FUNKY_OPT_UNIQUE                 2018-09-11 06:38:28.000772
 
 --- 1 row(s) selected.
 >>
@@ -1882,7 +1899,7 @@
 (EXPR)                                     (EXPR)                    
 -----------------------------------------  --------------------------
 
-done with synch_cancel - FUNKY_OPT_UNIQUE  2015-07-10 17:11:06.564411
+done with synch_cancel - FUNKY_OPT_UNIQUE  2018-09-11 06:38:28.000814
 
 --- 1 row(s) selected.
 >>log;
@@ -1907,7 +1924,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler going to sleep - FUNKY_OPT_UNIQUE  2015-07-10 17:10:42.305768
+canceler going to sleep - FUNKY_OPT_UNIQUE  2018-09-11 06:38:01.000478
 
 --- 1 row(s) selected.
 >>
@@ -1919,7 +1936,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler woke up - FUNKY_OPT_UNIQUE         2015-07-10 17:10:55.328810
+canceler woke up - FUNKY_OPT_UNIQUE         2018-09-11 06:38:14.000502
 
 --- 1 row(s) selected.
 >>
@@ -1936,7 +1953,7 @@
 --- 1 row(s) inserted.
 >>
 >>obey cancel_cmd;
->>control query cancel qid MXID11000021348212303307894875569000000000206U3333300_352_S1;
+>>control query cancel qid MXID11000020942212403407567430015000000000206U3333300_630_S1;
 
 --- SQL operation complete.
 >>
@@ -1951,7 +1968,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler - FUNKY_OPT_UNIQUE                 2015-07-10 17:10:55.406493
+canceler - FUNKY_OPT_UNIQUE                 2018-09-11 06:38:17.000590
 
 --- 1 row(s) selected.
 >>log;
@@ -2110,7 +2127,7 @@
 (EXPR)            (EXPR)                    
 ----------------  --------------------------
 
-FUNKY_OPT_UNIQUE  2015-07-10 17:11:17.016966
+FUNKY_OPT_UNIQUE  2018-09-11 06:38:39.000193
 
 --- 1 row(s) selected.
 >>
@@ -2126,7 +2143,7 @@
 (EXPR)            (EXPR)                    
 ----------------  --------------------------
 
-FUNKY_OPT_UNIQUE  2015-07-10 17:11:47.131046
+FUNKY_OPT_UNIQUE  2018-09-11 06:39:09.000721
 
 --- 1 row(s) selected.
 >>
@@ -2142,7 +2159,7 @@
 (EXPR)            (EXPR)                    
 ----------------  --------------------------
 
-FUNKY_OPT_UNIQUE  2015-07-10 17:11:48.077070
+FUNKY_OPT_UNIQUE  2018-09-11 06:39:40.000544
 
 --- 1 row(s) selected.
 >>
@@ -2158,7 +2175,7 @@
 (EXPR)            (EXPR)                    
 ----------------  --------------------------
 
-FUNKY_OPT_UNIQUE  2015-07-10 17:12:18.192873
+FUNKY_OPT_UNIQUE  2018-09-11 06:39:43.000151
 
 --- 1 row(s) selected.
 >>
@@ -2174,7 +2191,7 @@
 (EXPR)            (EXPR)                    
 ----------------  --------------------------
 
-FUNKY_OPT_UNIQUE  2015-07-10 17:12:19.105450
+FUNKY_OPT_UNIQUE  2018-09-11 06:40:17.000355
 
 --- 1 row(s) selected.
 >>
@@ -2190,7 +2207,7 @@
 (EXPR)            (EXPR)                    
 ----------------  --------------------------
 
-FUNKY_OPT_UNIQUE  2015-07-10 17:12:49.225497
+FUNKY_OPT_UNIQUE  2018-09-11 06:40:48.000240
 
 --- 1 row(s) selected.
 >>
@@ -2204,9 +2221,9 @@
 >>log;
 >>
 >>obey cancel_cmd;
->>control query cancel qid MXID11000021348212303307894875569000000000206U3333300_611_S1;
+>>control query cancel qid MXID11000020942212403407567430015000000000206U3333300_934_S1;
 
-*** ERROR[8031] Server declined cancel request for query ID MXID11000021348212303307894875569000000000206U3333300_611_S1. The query is not in OPEN or FETCH or EXECUTE state.
+*** ERROR[8031] Server declined cancel request for query ID MXID11000020942212403407567430015000000000206U3333300_934_S1. The query is not in OPEN or FETCH or EXECUTE state.
 
 --- SQL operation failed with errors.
 >>
@@ -2348,7 +2365,7 @@
 (EXPR)                                     (EXPR)                    
 -----------------------------------------  --------------------------
 
-done with synch_cancel - FUNKY_OPT_UNIQUE  2015-07-10 17:13:47.314100
+done with synch_cancel - FUNKY_OPT_UNIQUE  2018-09-11 06:41:17.000817
 
 --- 1 row(s) selected.
 >>log;
@@ -2373,7 +2390,7 @@
 (EXPR)                                     (EXPR)                    
 -----------------------------------------  --------------------------
 
-subject - FUNKY_OPT_UNIQUE                 2015-07-10 17:14:00.677443
+subject - FUNKY_OPT_UNIQUE                 2018-09-11 06:41:30.000938
 
 --- 1 row(s) selected.
 >>
@@ -2400,7 +2417,7 @@
 (EXPR)                                     (EXPR)                    
 -----------------------------------------  --------------------------
 
-done with synch_cancel - FUNKY_OPT_UNIQUE  2015-07-10 17:14:00.717696
+done with synch_cancel - FUNKY_OPT_UNIQUE  2018-09-11 06:41:30.000975
 
 --- 1 row(s) selected.
 >>log;
@@ -2425,7 +2442,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler going to sleep - FUNKY_OPT_UNIQUE  2015-07-10 17:13:47.295281
+canceler going to sleep - FUNKY_OPT_UNIQUE  2018-09-11 06:41:17.000801
 
 --- 1 row(s) selected.
 >>
@@ -2437,7 +2454,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler woke up - FUNKY_OPT_UNIQUE         2015-07-10 17:14:00.323547
+canceler woke up - FUNKY_OPT_UNIQUE         2018-09-11 06:41:30.000824
 
 --- 1 row(s) selected.
 >>
@@ -2454,7 +2471,7 @@
 --- 1 row(s) inserted.
 >>
 >>obey cancel_cmd;
->>control query cancel qid MXID11000021348212303307894875569000000000206U3333300_616_S1;
+>>control query cancel qid MXID11000020942212403407567430015000000000206U3333300_939_S1;
 
 --- SQL operation complete.
 >>
@@ -2469,7 +2486,7 @@
 (EXPR)                                      (EXPR)                    
 ------------------------------------------  --------------------------
 
-canceler - FUNKY_OPT_UNIQUE                 2015-07-10 17:14:00.465200
+canceler - FUNKY_OPT_UNIQUE                 2018-09-11 06:41:30.000907
 
 --- 1 row(s) selected.
 >>log;
@@ -2484,116 +2501,116 @@
 MSG                                                           (EXPR)            TS
 ------------------------------------------------------------  ----------------  --------------------------
 
-positive_test1, launch canceler, start                        FUNKY_OPT_UNIQUE  2015-07-10 17:06:28.605534
-positive_test1, launch canceler, finish                       FUNKY_OPT_UNIQUE  2015-07-10 17:06:28.702813
-foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2015-07-10 17:06:28.712618
-do_cancel has begun                                           FUNKY_OPT_UNIQUE  2015-07-10 17:06:38.626473
-foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2015-07-10 17:06:38.804751
-positive_test1, execute, start                                FUNKY_OPT_UNIQUE  2015-07-10 17:06:38.816899
-do_cancel will cancel                                         FUNKY_OPT_UNIQUE  2015-07-10 17:06:51.795368
-do_cancel has canceled                                        FUNKY_OPT_UNIQUE  2015-07-10 17:06:51.811123
-positive_test1, execute, finished                             FUNKY_OPT_UNIQUE  2015-07-10 17:06:51.865571
-foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2015-07-10 17:06:51.881210
-foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2015-07-10 17:06:51.925973
-positive_test2, launch canceler, start                        FUNKY_OPT_UNIQUE  2015-07-10 17:06:54.121258
-positive_test2, launch canceler, finished                     FUNKY_OPT_UNIQUE  2015-07-10 17:06:54.135947
-foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2015-07-10 17:06:54.144872
-do_cancel has begun                                           FUNKY_OPT_UNIQUE  2015-07-10 17:07:03.218202
-foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2015-07-10 17:07:03.414289
-positive_test2, execute s1, start                             FUNKY_OPT_UNIQUE  2015-07-10 17:07:03.421669
-do_cancel will cancel                                         FUNKY_OPT_UNIQUE  2015-07-10 17:07:16.425344
-do_cancel has canceled                                        FUNKY_OPT_UNIQUE  2015-07-10 17:07:16.465426
-positive_test2, execute s1, finished                          FUNKY_OPT_UNIQUE  2015-07-10 17:07:16.489121
-foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2015-07-10 17:07:16.500205
-foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2015-07-10 17:07:16.558636
-update_test1, launch canceler, start                          FUNKY_OPT_UNIQUE  2015-07-10 17:07:18.691347
-update_test1, launch canceler, finish                         FUNKY_OPT_UNIQUE  2015-07-10 17:07:18.710009
-foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2015-07-10 17:07:18.718706
-do_cancel has begun                                           FUNKY_OPT_UNIQUE  2015-07-10 17:07:28.214420
-foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2015-07-10 17:07:28.388345
-update_test1, execute, start                                  FUNKY_OPT_UNIQUE  2015-07-10 17:07:28.397823
-do_cancel will cancel                                         FUNKY_OPT_UNIQUE  2015-07-10 17:07:41.385593
-do_cancel has canceled                                        FUNKY_OPT_UNIQUE  2015-07-10 17:07:41.400965
-update_test1, execute, finished                               FUNKY_OPT_UNIQUE  2015-07-10 17:07:48.069219
-foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2015-07-10 17:07:48.078175
-foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2015-07-10 17:07:48.109026
-delete_test1, launch canceler, start                          FUNKY_OPT_UNIQUE  2015-07-10 17:07:50.200100
-delete_test1, launch canceler, finish                         FUNKY_OPT_UNIQUE  2015-07-10 17:07:50.221685
-foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2015-07-10 17:07:50.230056
-do_cancel has begun                                           FUNKY_OPT_UNIQUE  2015-07-10 17:07:59.371817
-foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2015-07-10 17:07:59.504170
-delete_test1, execute, start                                  FUNKY_OPT_UNIQUE  2015-07-10 17:07:59.512807
-do_cancel will cancel                                         FUNKY_OPT_UNIQUE  2015-07-10 17:08:12.579070
-do_cancel has canceled                                        FUNKY_OPT_UNIQUE  2015-07-10 17:08:12.595650
-delete_test1, execute, finished                               FUNKY_OPT_UNIQUE  2015-07-10 17:08:25.765256
-foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2015-07-10 17:08:25.774591
-foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2015-07-10 17:08:25.809037
-insert_test1, launch canceler, start                          FUNKY_OPT_UNIQUE  2015-07-10 17:08:29.303373
-insert_test1, launch canceler, finish                         FUNKY_OPT_UNIQUE  2015-07-10 17:08:29.322696
-foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2015-07-10 17:08:29.330814
-do_cancel has begun                                           FUNKY_OPT_UNIQUE  2015-07-10 17:08:38.663779
-foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2015-07-10 17:08:38.796777
-insert_test1, execute, start                                  FUNKY_OPT_UNIQUE  2015-07-10 17:08:38.804614
-do_cancel will cancel                                         FUNKY_OPT_UNIQUE  2015-07-10 17:08:54.896102
-do_cancel has canceled                                        FUNKY_OPT_UNIQUE  2015-07-10 17:08:54.930493
-insert_test1, execute, finished                               FUNKY_OPT_UNIQUE  2015-07-10 17:08:56.579137
-foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2015-07-10 17:08:56.589386
-foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2015-07-10 17:08:56.622206
-insert_test2, launch canceler, start                          FUNKY_OPT_UNIQUE  2015-07-10 17:08:59.024743
-insert_test2, launch canceler, finish                         FUNKY_OPT_UNIQUE  2015-07-10 17:08:59.042423
-foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2015-07-10 17:08:59.050281
-do_cancel has begun                                           FUNKY_OPT_UNIQUE  2015-07-10 17:09:08.564653
-foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2015-07-10 17:09:08.742892
-insert_test2, execute, start                                  FUNKY_OPT_UNIQUE  2015-07-10 17:09:08.751928
-do_cancel will cancel                                         FUNKY_OPT_UNIQUE  2015-07-10 17:09:24.776254
-do_cancel has canceled                                        FUNKY_OPT_UNIQUE  2015-07-10 17:09:24.795329
-insert_test2, execute, finished                               FUNKY_OPT_UNIQUE  2015-07-10 17:09:25.871938
-foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2015-07-10 17:09:25.880384
-foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2015-07-10 17:09:25.911426
-upsert_test1, launch canceler, start                          FUNKY_OPT_UNIQUE  2015-07-10 17:09:28.265459
-upsert_test1, launch canceler, finish                         FUNKY_OPT_UNIQUE  2015-07-10 17:09:28.287050
-foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2015-07-10 17:09:28.294726
-do_cancel has begun                                           FUNKY_OPT_UNIQUE  2015-07-10 17:09:37.613861
-foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2015-07-10 17:09:37.723289
-upsert_test1, execute, start                                  FUNKY_OPT_UNIQUE  2015-07-10 17:09:37.731436
-do_cancel will cancel                                         FUNKY_OPT_UNIQUE  2015-07-10 17:09:53.801878
-do_cancel has canceled                                        FUNKY_OPT_UNIQUE  2015-07-10 17:09:53.819783
-upsert_test1, execute, finished                               FUNKY_OPT_UNIQUE  2015-07-10 17:09:53.825158
-foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2015-07-10 17:09:53.832495
-foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2015-07-10 17:09:53.970360
-cpu_bound_esps, launch canceler, start                        FUNKY_OPT_UNIQUE  2015-07-10 17:09:56.333247
-cpu_bound_esps, launch canceler, finished                     FUNKY_OPT_UNIQUE  2015-07-10 17:09:56.347915
-foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2015-07-10 17:09:56.355395
-do_cancel has begun                                           FUNKY_OPT_UNIQUE  2015-07-10 17:10:06.308852
-foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2015-07-10 17:10:06.491893
-cpu_bound_esps, execute s1, start                             FUNKY_OPT_UNIQUE  2015-07-10 17:10:06.499750
-do_cancel will cancel                                         FUNKY_OPT_UNIQUE  2015-07-10 17:10:19.492506
-do_cancel has canceled                                        FUNKY_OPT_UNIQUE  2015-07-10 17:10:19.508940
-cpu_bound_esps, execute s1, finished                          FUNKY_OPT_UNIQUE  2015-07-10 17:10:30.705276
-foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2015-07-10 17:10:30.716871
-foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2015-07-10 17:10:30.748949
-escalation1, launch canceler, start                           FUNKY_OPT_UNIQUE  2015-07-10 17:10:33.132692
-escalation1, launch canceler, finished                        FUNKY_OPT_UNIQUE  2015-07-10 17:10:33.149281
-foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2015-07-10 17:10:33.158984
-do_cancel has begun                                           FUNKY_OPT_UNIQUE  2015-07-10 17:10:42.217942
-foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2015-07-10 17:10:42.376461
-escalation1, execute s1, start                                FUNKY_OPT_UNIQUE  2015-07-10 17:10:42.381161
-do_cancel will cancel                                         FUNKY_OPT_UNIQUE  2015-07-10 17:10:55.385636
-do_cancel has canceled                                        FUNKY_OPT_UNIQUE  2015-07-10 17:10:55.400533
-escalation1, execute s1, finished                             FUNKY_OPT_UNIQUE  2015-07-10 17:11:06.526582
-foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2015-07-10 17:11:06.539511
-foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2015-07-10 17:11:06.580843
-ustats_test, launch canceler, start                           FUNKY_OPT_UNIQUE  2015-07-10 17:13:38.014277
-ustats_test, launch canceler, finished                        FUNKY_OPT_UNIQUE  2015-07-10 17:13:38.035897
-foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2015-07-10 17:13:38.045217
-do_cancel has begun                                           FUNKY_OPT_UNIQUE  2015-07-10 17:13:47.211662
-foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2015-07-10 17:13:47.339719
-ustats_test, execute s1, start                                FUNKY_OPT_UNIQUE  2015-07-10 17:13:47.345734
-do_cancel will cancel                                         FUNKY_OPT_UNIQUE  2015-07-10 17:14:00.422546
-do_cancel has canceled                                        FUNKY_OPT_UNIQUE  2015-07-10 17:14:00.458124
-ustats_test, execute s1, finished                             FUNKY_OPT_UNIQUE  2015-07-10 17:14:00.681401
-foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2015-07-10 17:14:00.693030
-foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2015-07-10 17:14:00.731016
+positive_test1, launch canceler, start                        FUNKY_OPT_UNIQUE  2018-09-11 06:34:08.000319
+positive_test1, launch canceler, finish                       FUNKY_OPT_UNIQUE  2018-09-11 06:34:08.000404
+foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2018-09-11 06:34:08.000422
+do_cancel has begun                                           FUNKY_OPT_UNIQUE  2018-09-11 06:34:15.000320
+foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2018-09-11 06:34:15.000500
+positive_test1, execute, start                                FUNKY_OPT_UNIQUE  2018-09-11 06:34:15.000512
+do_cancel will cancel                                         FUNKY_OPT_UNIQUE  2018-09-11 06:34:28.000478
+do_cancel has canceled                                        FUNKY_OPT_UNIQUE  2018-09-11 06:34:28.000490
+positive_test1, execute, finished                             FUNKY_OPT_UNIQUE  2018-09-11 06:34:28.000504
+foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2018-09-11 06:34:28.000517
+foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2018-09-11 06:34:28.000556
+positive_test2, launch canceler, start                        FUNKY_OPT_UNIQUE  2018-09-11 06:34:30.000773
+positive_test2, launch canceler, finished                     FUNKY_OPT_UNIQUE  2018-09-11 06:34:30.000790
+foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2018-09-11 06:34:30.000803
+do_cancel has begun                                           FUNKY_OPT_UNIQUE  2018-09-11 06:34:37.000416
+foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2018-09-11 06:34:37.000552
+positive_test2, execute s1, start                             FUNKY_OPT_UNIQUE  2018-09-11 06:34:37.000558
+do_cancel will cancel                                         FUNKY_OPT_UNIQUE  2018-09-11 06:34:53.000562
+do_cancel has canceled                                        FUNKY_OPT_UNIQUE  2018-09-11 06:34:53.000575
+positive_test2, execute s1, finished                          FUNKY_OPT_UNIQUE  2018-09-11 06:34:53.000593
+foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2018-09-11 06:34:53.000603
+foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2018-09-11 06:34:53.000639
+update_test1, launch canceler, start                          FUNKY_OPT_UNIQUE  2018-09-11 06:34:55.000820
+update_test1, launch canceler, finish                         FUNKY_OPT_UNIQUE  2018-09-11 06:34:55.000842
+foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2018-09-11 06:34:55.000854
+do_cancel has begun                                           FUNKY_OPT_UNIQUE  2018-09-11 06:35:02.000598
+foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2018-09-11 06:35:02.000704
+update_test1, execute, start                                  FUNKY_OPT_UNIQUE  2018-09-11 06:35:02.000714
+do_cancel will cancel                                         FUNKY_OPT_UNIQUE  2018-09-11 06:35:15.000766
+do_cancel has canceled                                        FUNKY_OPT_UNIQUE  2018-09-11 06:35:15.000785
+update_test1, execute, finished                               FUNKY_OPT_UNIQUE  2018-09-11 06:35:26.000947
+foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2018-09-11 06:35:26.000957
+foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2018-09-11 06:35:26.000997
+delete_test1, launch canceler, start                          FUNKY_OPT_UNIQUE  2018-09-11 06:35:29.000127
+delete_test1, launch canceler, finish                         FUNKY_OPT_UNIQUE  2018-09-11 06:35:29.000146
+foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2018-09-11 06:35:29.000155
+do_cancel has begun                                           FUNKY_OPT_UNIQUE  2018-09-11 06:35:35.000856
+foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2018-09-11 06:35:36.000012
+delete_test1, execute, start                                  FUNKY_OPT_UNIQUE  2018-09-11 06:35:36.000020
+do_cancel will cancel                                         FUNKY_OPT_UNIQUE  2018-09-11 06:35:49.000012
+do_cancel has canceled                                        FUNKY_OPT_UNIQUE  2018-09-11 06:35:49.000023
+delete_test1, execute, finished                               FUNKY_OPT_UNIQUE  2018-09-11 06:35:58.000200
+foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2018-09-11 06:35:58.000214
+foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2018-09-11 06:35:58.000267
+insert_test1, launch canceler, start                          FUNKY_OPT_UNIQUE  2018-09-11 06:36:01.000618
+insert_test1, launch canceler, finish                         FUNKY_OPT_UNIQUE  2018-09-11 06:36:01.000638
+foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2018-09-11 06:36:01.000648
+do_cancel has begun                                           FUNKY_OPT_UNIQUE  2018-09-11 06:36:08.000437
+foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2018-09-11 06:36:08.000616
+insert_test1, execute, start                                  FUNKY_OPT_UNIQUE  2018-09-11 06:36:08.000623
+do_cancel will cancel                                         FUNKY_OPT_UNIQUE  2018-09-11 06:36:24.000600
+do_cancel has canceled                                        FUNKY_OPT_UNIQUE  2018-09-11 06:36:24.000613
+insert_test1, execute, finished                               FUNKY_OPT_UNIQUE  2018-09-11 06:36:26.000068
+foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2018-09-11 06:36:26.000078
+foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2018-09-11 06:36:26.000116
+insert_test2, launch canceler, start                          FUNKY_OPT_UNIQUE  2018-09-11 06:36:28.000332
+insert_test2, launch canceler, finish                         FUNKY_OPT_UNIQUE  2018-09-11 06:36:28.000359
+foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2018-09-11 06:36:28.000371
+do_cancel has begun                                           FUNKY_OPT_UNIQUE  2018-09-11 06:36:36.000054
+foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2018-09-11 06:36:36.000178
+insert_test2, execute, start                                  FUNKY_OPT_UNIQUE  2018-09-11 06:36:36.000187
+do_cancel will cancel                                         FUNKY_OPT_UNIQUE  2018-09-11 06:36:52.000227
+do_cancel has canceled                                        FUNKY_OPT_UNIQUE  2018-09-11 06:36:52.000239
+insert_test2, execute, finished                               FUNKY_OPT_UNIQUE  2018-09-11 06:36:53.000322
+foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2018-09-11 06:36:53.000331
+foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2018-09-11 06:36:53.000367
+upsert_test1, launch canceler, start                          FUNKY_OPT_UNIQUE  2018-09-11 06:36:55.000615
+upsert_test1, launch canceler, finish                         FUNKY_OPT_UNIQUE  2018-09-11 06:36:55.000637
+foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2018-09-11 06:36:55.000646
+do_cancel has begun                                           FUNKY_OPT_UNIQUE  2018-09-11 06:37:02.000376
+foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2018-09-11 06:37:02.000505
+upsert_test1, execute, start                                  FUNKY_OPT_UNIQUE  2018-09-11 06:37:02.000514
+do_cancel will cancel                                         FUNKY_OPT_UNIQUE  2018-09-11 06:37:15.000529
+do_cancel has canceled                                        FUNKY_OPT_UNIQUE  2018-09-11 06:37:15.000540
+upsert_test1, execute, finished                               FUNKY_OPT_UNIQUE  2018-09-11 06:37:15.000547
+foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2018-09-11 06:37:15.000556
+foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2018-09-11 06:37:15.000598
+cpu_bound_esps, launch canceler, start                        FUNKY_OPT_UNIQUE  2018-09-11 06:37:17.000965
+cpu_bound_esps, launch canceler, finished                     FUNKY_OPT_UNIQUE  2018-09-11 06:37:17.000989
+foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2018-09-11 06:37:17.000998
+do_cancel has begun                                           FUNKY_OPT_UNIQUE  2018-09-11 06:37:24.000862
+foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2018-09-11 06:37:24.000972
+cpu_bound_esps, execute s1, start                             FUNKY_OPT_UNIQUE  2018-09-11 06:37:24.000977
+do_cancel will cancel                                         FUNKY_OPT_UNIQUE  2018-09-11 06:37:41.000023
+do_cancel has canceled                                        FUNKY_OPT_UNIQUE  2018-09-11 06:37:41.000039
+cpu_bound_esps, execute s1, finished                          FUNKY_OPT_UNIQUE  2018-09-11 06:37:52.000257
+foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2018-09-11 06:37:52.000268
+foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2018-09-11 06:37:52.000309
+escalation1, launch canceler, start                           FUNKY_OPT_UNIQUE  2018-09-11 06:37:54.000648
+escalation1, launch canceler, finished                        FUNKY_OPT_UNIQUE  2018-09-11 06:37:54.000667
+foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2018-09-11 06:37:54.000677
+do_cancel has begun                                           FUNKY_OPT_UNIQUE  2018-09-11 06:38:01.000406
+foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2018-09-11 06:38:01.000537
+escalation1, execute s1, start                                FUNKY_OPT_UNIQUE  2018-09-11 06:38:01.000541
+do_cancel will cancel                                         FUNKY_OPT_UNIQUE  2018-09-11 06:38:17.000572
+do_cancel has canceled                                        FUNKY_OPT_UNIQUE  2018-09-11 06:38:17.000584
+escalation1, execute s1, finished                             FUNKY_OPT_UNIQUE  2018-09-11 06:38:28.000785
+foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2018-09-11 06:38:28.000793
+foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2018-09-11 06:38:28.000835
+ustats_test, launch canceler, start                           FUNKY_OPT_UNIQUE  2018-09-11 06:41:10.000830
+ustats_test, launch canceler, finished                        FUNKY_OPT_UNIQUE  2018-09-11 06:41:10.000847
+foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2018-09-11 06:41:10.000857
+do_cancel has begun                                           FUNKY_OPT_UNIQUE  2018-09-11 06:41:17.000715
+foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2018-09-11 06:41:17.000844
+ustats_test, execute s1, start                                FUNKY_OPT_UNIQUE  2018-09-11 06:41:17.000849
+do_cancel will cancel                                         FUNKY_OPT_UNIQUE  2018-09-11 06:41:30.000889
+do_cancel has canceled                                        FUNKY_OPT_UNIQUE  2018-09-11 06:41:30.000901
+ustats_test, execute s1, finished                             FUNKY_OPT_UNIQUE  2018-09-11 06:41:30.000942
+foreground awaits synch_cancel                                FUNKY_OPT_UNIQUE  2018-09-11 06:41:30.000951
+foreground finished synch_cancel                              FUNKY_OPT_UNIQUE  2018-09-11 06:41:30.000991
 
 --- 110 row(s) selected.
 >>
diff --git a/core/sql/regress/executor/TEST106 b/core/sql/regress/executor/TEST106
index dca40fd..28c9c25 100755
--- a/core/sql/regress/executor/TEST106
+++ b/core/sql/regress/executor/TEST106
@@ -515,6 +515,9 @@
 obey TEST106(append_cancel_log);
 
 ?section upsert_test1
+cqd DYN_QUEUE_RESIZE_OVERRIDE 'ON';
+cqd GEN_TRSP_SIZE_DOWN '16';
+cqd GEN_TRSP_SIZE_UP '16';
 
 prepare s1 from 
 upsert using load into t106c 
@@ -574,7 +577,9 @@
 obey TEST106(synch_cancel);
 
 obey TEST106(append_cancel_log);
-
+cqd DYN_QUEUE_RESIZE_OVERRIDE reset;
+cqd GEN_TRSP_SIZE_DOWN reset;
+cqd GEN_TRSP_SIZE_UP reset;
 ?section cpu_bound_esps
 
 -- Test cancel when esps are CPU-bound.
diff --git a/core/sql/regress/hive/DIFF005.KNOWN b/core/sql/regress/hive/DIFF005.KNOWN
new file mode 100644
index 0000000..126b422
--- /dev/null
+++ b/core/sql/regress/hive/DIFF005.KNOWN
@@ -0,0 +1,5 @@
+1138,1141d1137
+< *** WARNING[8597] Statement was automatically retried 1 time(s). Delay before each retry was 0 seconds. See next entry for the error that caused this retry.
+< 
+< Warning 8436 or 8577 removed
+< 
diff --git a/core/sql/regress/newregr/mvqr/installMvqrSQ b/core/sql/regress/newregr/mvqr/installMvqrSQ
index 16e2ef5..643503a 100644
--- a/core/sql/regress/newregr/mvqr/installMvqrSQ
+++ b/core/sql/regress/newregr/mvqr/installMvqrSQ
@@ -143,7 +143,7 @@
   sqshell -a <<eof
   set  {process \\\$$qmmName} PERSIST_RETRIES=10,60
   set  {process \\\$$qmmName} PERSIST_ZONES=0
-  exec {name \\\$$qmmName, nid 3, nowait, out stdout_$qmmName} tdm_arkqmm
+  exec {name \\\$$qmmName, nid 3, nowait, out $TRAF_LOG/stdout_$qmmName} tdm_arkqmm
   exit
 eof
 EOF
@@ -152,7 +152,7 @@
   sqshell -a <<eof
   set  {process \\\$$qmmName} PERSIST_RETRIES=10,60
   set  {process \\\$$qmmName} PERSIST_ZONES=0
-  exec {name \\\$$qmmName, nid 0, nowait, out stdout_$qmmName} tdm_arkqmm
+  exec {name \\\$$qmmName, nid 0, nowait, out $TRAF_LOG/stdout_$qmmName} tdm_arkqmm
   exit
 eof
 EOF
diff --git a/core/sql/regress/privs1/EXPECTED120 b/core/sql/regress/privs1/EXPECTED120
index 13d19fe..08379f8 100644
--- a/core/sql/regress/privs1/EXPECTED120
+++ b/core/sql/regress/privs1/EXPECTED120
@@ -583,14 +583,12 @@
 >>--   AR - role involved, check query plans that rely on roles during revoke
 >>log;
 Query_Invalidation_Keys explain output for select_games, select_teams, insert_teams, update_teams, select_players, select_standings: 
-Query_Invalidation_Keys{,,OS}{,,UR}
+Query_Invalidation_Keys{,,CS}{,,UR}{,,CS}{,,UR}
 Query_Invalidation_Keys{,,OS}
 Query_Invalidation_Keys{,,OI}{,,UR}
-Query_Invalidation_Keys{,,OS}{,,
-OU}{,,UR}
+Query_Invalidation_Keys{,,OS}{,,CU}{,,UR}
 Query_Invalidation_Keys{,,OS}
-Query_Invalidation_Keys{,,OS}{,,
-OG}{,,UR}
+Query_Invalidation_Keys{,,OS}{,,OG}{,,UR}
 >>
 >>-- Verify that sql_user9 can select from games
 >>sh sqlci -i "TEST120(select_queries)" -u sql_user9;
@@ -799,9 +797,13 @@
 
 End of MXCI Session
 
->>-- still have privilege
+>>-- still have privilege but recompile because of revoke on t120_role2
 >>execute select_teams;
 
+*** WARNING[8597] Statement was automatically retried 1 time(s). Delay before each retry was 0 seconds. See next entry for the error that caused this retry.
+
+*** WARNING[8734] Statement must be recompiled to allow privileges to be re-evaluated.
+
 TEAM_NUMBER  TEAM_NAME           
 -----------  --------------------
 
@@ -1274,7 +1276,7 @@
 --- SQL command prepared.
 >>log;
 Query_Invalidation_Keys explain output for select_stats: 
-Query_Invalidation_Keys{,,OS}{,,UZ}
+Query_Invalidation_Keys{,,CS}{,,UR}{,,UZ}
 >>shecho"Query_Invalidation_Keysexplainoutputforselect_stats:">>LOG;
 >>
 >>execute select_stats;
diff --git a/core/sql/regress/privs1/EXPECTED123 b/core/sql/regress/privs1/EXPECTED123
index dd8211b..ffc42d4 100644
--- a/core/sql/regress/privs1/EXPECTED123
+++ b/core/sql/regress/privs1/EXPECTED123
@@ -324,6 +324,9 @@
  1 row(s) returned
 
 --- SQL operation complete.
+>>get users for role "PUBLIC";
+
+--- SQL operation complete.
 >>
 >>get privileges for user sql_user1;
 
@@ -565,6 +568,34 @@
  6 row(s) returned
 
 --- SQL operation complete.
+>>get tables for role t123_adminrole;
+
+Tables for Role T123_ADMINROLE
+==============================
+
+TRAFODION."T123SCH".GAMES
+TRAFODION."T123SCH".TEAMS
+
+=======================
+ 2 row(s) returned
+
+--- SQL operation complete.
+>>get tables for role t123_ownerrole;
+
+Tables for Role T123_OWNERROLE
+==============================
+
+TRAFODION."T123SCH".GAMES
+TRAFODION."T123SCH".PLAYERS
+TRAFODION."T123SCH".SB_HISTOGRAMS
+TRAFODION."T123SCH".SB_HISTOGRAM_INTERVALS
+TRAFODION."T123SCH".SB_PERSISTENT_SAMPLES
+TRAFODION."T123SCH".TEAMS
+
+=======================
+ 6 row(s) returned
+
+--- SQL operation complete.
 >>
 >>get indexes for user sql_user1;
 
@@ -613,6 +644,28 @@
  1 row(s) returned
 
 --- SQL operation complete.
+>>get indexes for role t123_adminrole;
+
+Indexes for Role T123_ADMINROLE
+===============================
+
+TRAFODION."T123SCH".GAMES_VISITOR
+
+=======================
+ 1 row(s) returned
+
+--- SQL operation complete.
+>>get indexes for role t123_ownerrole;
+
+Indexes for Role T123_OWNERROLE
+===============================
+
+TRAFODION."T123SCH".GAMES_VISITOR
+
+=======================
+ 1 row(s) returned
+
+--- SQL operation complete.
 >>
 >>get views for user sql_user1;
 
@@ -639,65 +692,20 @@
  3 row(s) returned
 
 --- SQL operation complete.
->>
->>get libraries for user sql_user1;
-
-Libraries for User SQL_USER1
-============================
-
-DB__LIBMGRNAME
-DB__LIBMGR_LIB_CPP
-
-=======================
- 2 row(s) returned
+>>get views for role t123_adminrole;
 
 --- SQL operation complete.
->>get libraries for user sql_user2;
+>>get views for role t123_ownerrole;
 
-Libraries for User SQL_USER2
-============================
+Views for Role T123_OWNERROLE
+=============================
 
-DB__LIBMGRNAME
-DB__LIBMGR_LIB_CPP
+TRAFODION."T123SCH".GAMES_BY_PLAYER
+TRAFODION."T123SCH".HOME_TEAMS_GAMES
+TRAFODION."T123SCH".PLAYERS_ON_TEAM
 
 =======================
- 2 row(s) returned
-
---- SQL operation complete.
->>get libraries for user sql_user3;
-
-Libraries for User SQL_USER3
-============================
-
-DB__LIBMGRNAME
-DB__LIBMGR_LIB_CPP
-
-=======================
- 2 row(s) returned
-
---- SQL operation complete.
->>get libraries for user sql_user4;
-
-Libraries for User SQL_USER4
-============================
-
-DB__LIBMGRNAME
-DB__LIBMGR_LIB_CPP
-
-=======================
- 2 row(s) returned
-
---- SQL operation complete.
->>get libraries for user sql_user5;
-
-Libraries for User SQL_USER5
-============================
-
-DB__LIBMGRNAME
-DB__LIBMGR_LIB_CPP
-
-=======================
- 2 row(s) returned
+ 3 row(s) returned
 
 --- SQL operation complete.
 >>
@@ -754,48 +762,24 @@
 --- SQL operation complete.
 >>get roles for user sql_user2;
 
-Roles for User SQL_USER2
-========================
+*** ERROR[1017] You are not authorized to perform this operation.
 
-PUBLIC
-
-=======================
- 1 row(s) returned
-
---- SQL operation complete.
+--- SQL operation failed with errors.
 >>get roles for user sql_user3;
 
-Roles for User SQL_USER3
-========================
+*** ERROR[1017] You are not authorized to perform this operation.
 
-PUBLIC
-
-=======================
- 1 row(s) returned
-
---- SQL operation complete.
+--- SQL operation failed with errors.
 >>get roles for user sql_user4;
 
-Roles for User SQL_USER4
-========================
+*** ERROR[1017] You are not authorized to perform this operation.
 
-PUBLIC
-
-=======================
- 1 row(s) returned
-
---- SQL operation complete.
+--- SQL operation failed with errors.
 >>get roles for user sql_user5;
 
-Roles for User SQL_USER5
-========================
+*** ERROR[1017] You are not authorized to perform this operation.
 
-PUBLIC
-
-=======================
- 1 row(s) returned
-
---- SQL operation complete.
+--- SQL operation failed with errors.
 >>
 >>get users for role t123_adminrole;
 
@@ -821,9 +805,16 @@
 --- SQL operation complete.
 >>get users for role t123_dummyrole;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get users for role t123_ownerrole;
 
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
+>>get users for role "PUBLIC";
+
 --- SQL operation complete.
 >>
 >>get privileges for user sql_user1;
@@ -851,16 +842,24 @@
 --- SQL operation complete.
 >>get privileges for user sql_user2;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for user sql_user3;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for user sql_user4;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for user sql_user5;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>
 >>get privileges for role t123_adminrole;
 
@@ -889,10 +888,14 @@
 --- SQL operation complete.
 >>get privileges for role t123_dummyrole;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for role t123_ownerrole;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for role "PUBLIC";
 
 Privileges for Role PUBLIC
@@ -944,6 +947,23 @@
 *** ERROR[1017] You are not authorized to perform this operation.
 
 --- SQL operation failed with errors.
+>>get tables for role t123_adminrole;
+
+Tables for Role T123_ADMINROLE
+==============================
+
+TRAFODION."T123SCH".GAMES
+TRAFODION."T123SCH".TEAMS
+
+=======================
+ 2 row(s) returned
+
+--- SQL operation complete.
+>>get tables for role t123_ownerrole;
+
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>
 >>get indexes for user sql_user1;
 
@@ -976,6 +996,22 @@
 *** ERROR[1017] You are not authorized to perform this operation.
 
 --- SQL operation failed with errors.
+>>get indexes for role t123_adminrole;
+
+Indexes for Role T123_ADMINROLE
+===============================
+
+TRAFODION."T123SCH".GAMES_VISITOR
+
+=======================
+ 1 row(s) returned
+
+--- SQL operation complete.
+>>get indexes for role t123_ownerrole;
+
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>
 >>get views for user sql_user1;
 
@@ -1000,35 +1036,10 @@
 *** ERROR[1017] You are not authorized to perform this operation.
 
 --- SQL operation failed with errors.
->>
->>get libraries for user sql_user1;
-
-Libraries for User SQL_USER1
-============================
-
-DB__LIBMGRNAME
-DB__LIBMGR_LIB_CPP
-
-=======================
- 2 row(s) returned
+>>get views for role t123_adminrole;
 
 --- SQL operation complete.
->>get libraries for user sql_user2;
-
-*** ERROR[1017] You are not authorized to perform this operation.
-
---- SQL operation failed with errors.
->>get libraries for user sql_user3;
-
-*** ERROR[1017] You are not authorized to perform this operation.
-
---- SQL operation failed with errors.
->>get libraries for user sql_user4;
-
-*** ERROR[1017] You are not authorized to perform this operation.
-
---- SQL operation failed with errors.
->>get libraries for user sql_user5;
+>>get views for role t123_ownerrole;
 
 *** ERROR[1017] You are not authorized to perform this operation.
 
@@ -1077,15 +1088,9 @@
 --- SQL operation complete.
 >>get roles for user sql_user1;
 
-Roles for User SQL_USER1
-========================
+*** ERROR[1017] You are not authorized to perform this operation.
 
-PUBLIC
-
-=======================
- 1 row(s) returned
-
---- SQL operation complete.
+--- SQL operation failed with errors.
 >>get roles for user sql_user2;
 
 Roles for User SQL_USER2
@@ -1100,41 +1105,25 @@
 --- SQL operation complete.
 >>get roles for user sql_user3;
 
-Roles for User SQL_USER3
-========================
+*** ERROR[1017] You are not authorized to perform this operation.
 
-PUBLIC
-
-=======================
- 1 row(s) returned
-
---- SQL operation complete.
+--- SQL operation failed with errors.
 >>get roles for user sql_user4;
 
-Roles for User SQL_USER4
-========================
+*** ERROR[1017] You are not authorized to perform this operation.
 
-PUBLIC
-
-=======================
- 1 row(s) returned
-
---- SQL operation complete.
+--- SQL operation failed with errors.
 >>get roles for user sql_user5;
 
-Roles for User SQL_USER5
-========================
+*** ERROR[1017] You are not authorized to perform this operation.
 
-PUBLIC
-
-=======================
- 1 row(s) returned
-
---- SQL operation complete.
+--- SQL operation failed with errors.
 >>
 >>get users for role t123_adminrole;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get users for role t123_plannerrole;
 
 Users granted Role T123_PLANNERROLE
@@ -1148,14 +1137,23 @@
 --- SQL operation complete.
 >>get users for role t123_dummyrole;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get users for role t123_ownerrole;
 
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
+>>get users for role "PUBLIC";
+
 --- SQL operation complete.
 >>
 >>get privileges for user sql_user1;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for user sql_user2;
 
 Privileges for User SQL_USER2
@@ -1178,17 +1176,25 @@
 --- SQL operation complete.
 >>get privileges for user sql_user3;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for user sql_user4;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for user sql_user5;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>
 >>get privileges for role t123_adminrole;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for role t123_plannerrole;
 
 Privileges for Role T123_PLANNERROLE
@@ -1204,10 +1210,14 @@
 --- SQL operation complete.
 >>get privileges for role t123_dummyrole;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for role t123_ownerrole;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for role "PUBLIC";
 
 Privileges for Role PUBLIC
@@ -1259,6 +1269,16 @@
 *** ERROR[1017] You are not authorized to perform this operation.
 
 --- SQL operation failed with errors.
+>>get tables for role t123_adminrole;
+
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
+>>get tables for role t123_ownerrole;
+
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>
 >>get indexes for user sql_user1;
 
@@ -1291,6 +1311,16 @@
 *** ERROR[1017] You are not authorized to perform this operation.
 
 --- SQL operation failed with errors.
+>>get indexes for role t123_adminrole;
+
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
+>>get indexes for role t123_ownerrole;
+
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>
 >>get views for user sql_user1;
 
@@ -1315,35 +1345,12 @@
 *** ERROR[1017] You are not authorized to perform this operation.
 
 --- SQL operation failed with errors.
->>
->>get libraries for user sql_user1;
+>>get views for role t123_adminrole;
 
 *** ERROR[1017] You are not authorized to perform this operation.
 
 --- SQL operation failed with errors.
->>get libraries for user sql_user2;
-
-Libraries for User SQL_USER2
-============================
-
-DB__LIBMGRNAME
-DB__LIBMGR_LIB_CPP
-
-=======================
- 2 row(s) returned
-
---- SQL operation complete.
->>get libraries for user sql_user3;
-
-*** ERROR[1017] You are not authorized to perform this operation.
-
---- SQL operation failed with errors.
->>get libraries for user sql_user4;
-
-*** ERROR[1017] You are not authorized to perform this operation.
-
---- SQL operation failed with errors.
->>get libraries for user sql_user5;
+>>get views for role t123_ownerrole;
 
 *** ERROR[1017] You are not authorized to perform this operation.
 
@@ -1391,26 +1398,14 @@
 --- SQL operation complete.
 >>get roles for user sql_user1;
 
-Roles for User SQL_USER1
-========================
+*** ERROR[1017] You are not authorized to perform this operation.
 
-PUBLIC
-
-=======================
- 1 row(s) returned
-
---- SQL operation complete.
+--- SQL operation failed with errors.
 >>get roles for user sql_user2;
 
-Roles for User SQL_USER2
-========================
+*** ERROR[1017] You are not authorized to perform this operation.
 
-PUBLIC
-
-=======================
- 1 row(s) returned
-
---- SQL operation complete.
+--- SQL operation failed with errors.
 >>get roles for user sql_user3;
 
 Roles for User SQL_USER3
@@ -1424,46 +1419,49 @@
 --- SQL operation complete.
 >>get roles for user sql_user4;
 
-Roles for User SQL_USER4
-========================
+*** ERROR[1017] You are not authorized to perform this operation.
 
-PUBLIC
-
-=======================
- 1 row(s) returned
-
---- SQL operation complete.
+--- SQL operation failed with errors.
 >>get roles for user sql_user5;
 
-Roles for User SQL_USER5
-========================
+*** ERROR[1017] You are not authorized to perform this operation.
 
-PUBLIC
-
-=======================
- 1 row(s) returned
-
---- SQL operation complete.
+--- SQL operation failed with errors.
 >>
 >>get users for role t123_adminrole;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get users for role t123_plannerrole;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get users for role t123_dummyrole;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get users for role t123_ownerrole;
 
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
+>>get users for role "PUBLIC";
+
 --- SQL operation complete.
 >>
 >>get privileges for user sql_user1;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for user sql_user2;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for user sql_user3;
 
 Privileges for User SQL_USER3
@@ -1483,23 +1481,35 @@
 --- SQL operation complete.
 >>get privileges for user sql_user4;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for user sql_user5;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>
 >>get privileges for role t123_adminrole;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for role t123_plannerrole;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for role t123_dummyrole;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for role t123_ownerrole;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for role "PUBLIC";
 
 Privileges for Role PUBLIC
@@ -1550,6 +1560,16 @@
 *** ERROR[1017] You are not authorized to perform this operation.
 
 --- SQL operation failed with errors.
+>>get tables for role t123_adminrole;
+
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
+>>get tables for role t123_ownerrole;
+
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>
 >>get indexes for user sql_user1;
 
@@ -1574,6 +1594,16 @@
 *** ERROR[1017] You are not authorized to perform this operation.
 
 --- SQL operation failed with errors.
+>>get indexes for role t123_adminrole;
+
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
+>>get indexes for role t123_ownerrole;
+
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>
 >>get views for user sql_user1;
 
@@ -1598,35 +1628,12 @@
 *** ERROR[1017] You are not authorized to perform this operation.
 
 --- SQL operation failed with errors.
->>
->>get libraries for user sql_user1;
+>>get views for role t123_adminrole;
 
 *** ERROR[1017] You are not authorized to perform this operation.
 
 --- SQL operation failed with errors.
->>get libraries for user sql_user2;
-
-*** ERROR[1017] You are not authorized to perform this operation.
-
---- SQL operation failed with errors.
->>get libraries for user sql_user3;
-
-Libraries for User SQL_USER3
-============================
-
-DB__LIBMGRNAME
-DB__LIBMGR_LIB_CPP
-
-=======================
- 2 row(s) returned
-
---- SQL operation complete.
->>get libraries for user sql_user4;
-
-*** ERROR[1017] You are not authorized to perform this operation.
-
---- SQL operation failed with errors.
->>get libraries for user sql_user5;
+>>get views for role t123_ownerrole;
 
 *** ERROR[1017] You are not authorized to perform this operation.
 
@@ -1674,37 +1681,19 @@
 --- SQL operation complete.
 >>get roles for user sql_user1;
 
-Roles for User SQL_USER1
-========================
+*** ERROR[1017] You are not authorized to perform this operation.
 
-PUBLIC
-
-=======================
- 1 row(s) returned
-
---- SQL operation complete.
+--- SQL operation failed with errors.
 >>get roles for user sql_user2;
 
-Roles for User SQL_USER2
-========================
+*** ERROR[1017] You are not authorized to perform this operation.
 
-PUBLIC
-
-=======================
- 1 row(s) returned
-
---- SQL operation complete.
+--- SQL operation failed with errors.
 >>get roles for user sql_user3;
 
-Roles for User SQL_USER3
-========================
+*** ERROR[1017] You are not authorized to perform this operation.
 
-PUBLIC
-
-=======================
- 1 row(s) returned
-
---- SQL operation complete.
+--- SQL operation failed with errors.
 >>get roles for user sql_user4;
 
 Roles for User SQL_USER4
@@ -1718,38 +1707,49 @@
 --- SQL operation complete.
 >>get roles for user sql_user5;
 
-Roles for User SQL_USER5
-========================
+*** ERROR[1017] You are not authorized to perform this operation.
 
-PUBLIC
-
-=======================
- 1 row(s) returned
-
---- SQL operation complete.
+--- SQL operation failed with errors.
 >>
 >>get users for role t123_adminrole;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get users for role t123_plannerrole;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get users for role t123_dummyrole;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get users for role t123_ownerrole;
 
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
+>>get users for role "PUBLIC";
+
 --- SQL operation complete.
 >>
 >>get privileges for user sql_user1;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for user sql_user2;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for user sql_user3;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for user sql_user4;
 
 Privileges for User SQL_USER4
@@ -1771,20 +1771,30 @@
 --- SQL operation complete.
 >>get privileges for user sql_user5;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>
 >>get privileges for role t123_adminrole;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for role t123_plannerrole;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for role t123_dummyrole;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for role t123_ownerrole;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for role "PUBLIC";
 
 Privileges for Role PUBLIC
@@ -1836,6 +1846,16 @@
 *** ERROR[1017] You are not authorized to perform this operation.
 
 --- SQL operation failed with errors.
+>>get tables for role t123_adminrole;
+
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
+>>get tables for role t123_ownerrole;
+
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>
 >>get indexes for user sql_user1;
 
@@ -1868,6 +1888,16 @@
 *** ERROR[1017] You are not authorized to perform this operation.
 
 --- SQL operation failed with errors.
+>>get indexes for role t123_adminrole;
+
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
+>>get indexes for role t123_ownerrole;
+
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>
 >>get views for user sql_user1;
 
@@ -1892,35 +1922,12 @@
 *** ERROR[1017] You are not authorized to perform this operation.
 
 --- SQL operation failed with errors.
->>
->>get libraries for user sql_user1;
+>>get views for role t123_adminrole;
 
 *** ERROR[1017] You are not authorized to perform this operation.
 
 --- SQL operation failed with errors.
->>get libraries for user sql_user2;
-
-*** ERROR[1017] You are not authorized to perform this operation.
-
---- SQL operation failed with errors.
->>get libraries for user sql_user3;
-
-*** ERROR[1017] You are not authorized to perform this operation.
-
---- SQL operation failed with errors.
->>get libraries for user sql_user4;
-
-Libraries for User SQL_USER4
-============================
-
-DB__LIBMGRNAME
-DB__LIBMGR_LIB_CPP
-
-=======================
- 2 row(s) returned
-
---- SQL operation complete.
->>get libraries for user sql_user5;
+>>get views for role t123_ownerrole;
 
 *** ERROR[1017] You are not authorized to perform this operation.
 
@@ -1969,48 +1976,24 @@
 --- SQL operation complete.
 >>get roles for user sql_user1;
 
-Roles for User SQL_USER1
-========================
+*** ERROR[1017] You are not authorized to perform this operation.
 
-PUBLIC
-
-=======================
- 1 row(s) returned
-
---- SQL operation complete.
+--- SQL operation failed with errors.
 >>get roles for user sql_user2;
 
-Roles for User SQL_USER2
-========================
+*** ERROR[1017] You are not authorized to perform this operation.
 
-PUBLIC
-
-=======================
- 1 row(s) returned
-
---- SQL operation complete.
+--- SQL operation failed with errors.
 >>get roles for user sql_user3;
 
-Roles for User SQL_USER3
-========================
+*** ERROR[1017] You are not authorized to perform this operation.
 
-PUBLIC
-
-=======================
- 1 row(s) returned
-
---- SQL operation complete.
+--- SQL operation failed with errors.
 >>get roles for user sql_user4;
 
-Roles for User SQL_USER4
-========================
+*** ERROR[1017] You are not authorized to perform this operation.
 
-PUBLIC
-
-=======================
- 1 row(s) returned
-
---- SQL operation complete.
+--- SQL operation failed with errors.
 >>get roles for user sql_user5;
 
 Roles for User SQL_USER5
@@ -2026,13 +2009,19 @@
 >>
 >>get users for role t123_adminrole;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get users for role t123_plannerrole;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get users for role t123_dummyrole;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get users for role t123_ownerrole;
 
 Users granted Role T123_OWNERROLE
@@ -2044,19 +2033,30 @@
  1 row(s) returned
 
 --- SQL operation complete.
+>>get users for role "PUBLIC";
+
+--- SQL operation complete.
 >>
 >>get privileges for user sql_user1;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for user sql_user2;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for user sql_user3;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for user sql_user4;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for user sql_user5;
 
 Privileges for User SQL_USER5
@@ -2087,13 +2087,19 @@
 >>
 >>get privileges for role t123_adminrole;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for role t123_plannerrole;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for role t123_dummyrole;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get privileges for role t123_ownerrole;
 
 Privileges for Role T123_OWNERROLE
@@ -2168,6 +2174,27 @@
  6 row(s) returned
 
 --- SQL operation complete.
+>>get tables for role t123_adminrole;
+
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
+>>get tables for role t123_ownerrole;
+
+Tables for Role T123_OWNERROLE
+==============================
+
+TRAFODION."T123SCH".GAMES
+TRAFODION."T123SCH".PLAYERS
+TRAFODION."T123SCH".SB_HISTOGRAMS
+TRAFODION."T123SCH".SB_HISTOGRAM_INTERVALS
+TRAFODION."T123SCH".SB_PERSISTENT_SAMPLES
+TRAFODION."T123SCH".TEAMS
+
+=======================
+ 6 row(s) returned
+
+--- SQL operation complete.
 >>
 >>get indexes for user sql_user1;
 
@@ -2200,6 +2227,22 @@
  1 row(s) returned
 
 --- SQL operation complete.
+>>get indexes for role t123_adminrole;
+
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
+>>get indexes for role t123_ownerrole;
+
+Indexes for Role T123_OWNERROLE
+===============================
+
+TRAFODION."T123SCH".GAMES_VISITOR
+
+=======================
+ 1 row(s) returned
+
+--- SQL operation complete.
 >>
 >>get views for user sql_user1;
 
@@ -2234,37 +2277,22 @@
  3 row(s) returned
 
 --- SQL operation complete.
->>
->>get libraries for user sql_user1;
+>>get views for role t123_adminrole;
 
 *** ERROR[1017] You are not authorized to perform this operation.
 
 --- SQL operation failed with errors.
->>get libraries for user sql_user2;
+>>get views for role t123_ownerrole;
 
-*** ERROR[1017] You are not authorized to perform this operation.
+Views for Role T123_OWNERROLE
+=============================
 
---- SQL operation failed with errors.
->>get libraries for user sql_user3;
-
-*** ERROR[1017] You are not authorized to perform this operation.
-
---- SQL operation failed with errors.
->>get libraries for user sql_user4;
-
-*** ERROR[1017] You are not authorized to perform this operation.
-
---- SQL operation failed with errors.
->>get libraries for user sql_user5;
-
-Libraries for User SQL_USER5
-============================
-
-DB__LIBMGRNAME
-DB__LIBMGR_LIB_CPP
+TRAFODION."T123SCH".GAMES_BY_PLAYER
+TRAFODION."T123SCH".HOME_TEAMS_GAMES
+TRAFODION."T123SCH".PLAYERS_ON_TEAM
 
 =======================
- 2 row(s) returned
+ 3 row(s) returned
 
 --- SQL operation complete.
 >>
@@ -2282,28 +2310,23 @@
 --- SQL operation failed with errors.
 >>get privileges for user unknown_user;
 
-*** ERROR[8732] UNKNOWN_USER is not a registered database user or role.
+*** ERROR[1340] UNKNOWN_USER is not a user.
 
 --- SQL operation failed with errors.
 >>get privileges for role unknown_role;
 
-*** ERROR[8732] UNKNOWN_ROLE is not a registered database user or role.
+*** ERROR[1339] UNKNOWN_ROLE is not a role.
 
 --- SQL operation failed with errors.
 >>get roles for user unknown_user;
 
-Roles for User UNKNOWN_USER
-===========================
+*** ERROR[1340] UNKNOWN_USER is not a user.
 
-PUBLIC
-
-=======================
- 1 row(s) returned
-
---- SQL operation complete.
+--- SQL operation failed with errors.
 >>get users for role unknown_role;
 
 --- SQL operation complete.
+>>
 >>grant component privilege "SHOW" on sql_operations to "PUBLIC";
 
 --- SQL operation complete.
diff --git a/core/sql/regress/privs1/EXPECTED125 b/core/sql/regress/privs1/EXPECTED125
index 49b5283..d2c3501 100644
--- a/core/sql/regress/privs1/EXPECTED125
+++ b/core/sql/regress/privs1/EXPECTED125
@@ -1311,6 +1311,23 @@
  1 row(s) returned
 
 --- SQL operation complete.
+>>get roles;
+
+Roles
+=====
+
+DB__HBASEROLE
+DB__HIVEROLE
+DB__LIBMGRROLE
+DB__ROOTROLE
+PUBLIC
+T125_ADMINROLE
+T125_ROLE1
+
+=======================
+ 7 row(s) returned
+
+--- SQL operation complete.
 >>
 >>get indexes on table players;
 
@@ -1477,7 +1494,7 @@
 Procedures for User SQL_USER1
 =============================
 
-TESTHIVE
+TRAFODION."T125SCH2".TESTHIVE
 
 =======================
  1 row(s) returned
@@ -1491,7 +1508,7 @@
 Functions for Role T125_ROLE1
 =============================
 
-TRANSLATEBITMAP
+TRAFODION."T125SCH3".TRANSLATEBITMAP
 
 =======================
  1 row(s) returned
@@ -1502,7 +1519,7 @@
 Functions for Role T125_ADMINROLE
 =================================
 
-TRANSLATEBITMAP
+TRAFODION."T125SCH3".TRANSLATEBITMAP
 
 =======================
  1 row(s) returned
@@ -1683,6 +1700,21 @@
 
 --- SQL operation complete.
 >>
+>>get schemas for user sql_user1, match 'T125SCH%';
+
+--- SQL operation complete.
+>>get schemas for role t125_adminrole, match 'T125SCH%';
+
+Schemas for Role T125_ADMINROLE
+===============================
+
+T125SCH3
+
+=======================
+ 1 row(s) returned
+
+--- SQL operation complete.
+>>
 >>get functions for library t125_l1;
 
 Functions for Library T125SCH3.T125_L1
@@ -1711,7 +1743,7 @@
 Procedures for User SQL_USER1
 =============================
 
-TESTHIVE
+TRAFODION."T125SCH2".TESTHIVE
 
 =======================
  1 row(s) returned
@@ -1725,7 +1757,7 @@
 Functions for Role T125_ROLE1
 =============================
 
-TRANSLATEBITMAP
+TRAFODION."T125SCH3".TRANSLATEBITMAP
 
 =======================
  1 row(s) returned
@@ -1736,7 +1768,7 @@
 Functions for Role T125_ADMINROLE
 =================================
 
-TRANSLATEBITMAP
+TRAFODION."T125SCH3".TRANSLATEBITMAP
 
 =======================
  1 row(s) returned
@@ -1807,6 +1839,18 @@
 >>get procedures;
 
 --- SQL operation complete.
+>>get roles;
+
+Roles
+=====
+
+PUBLIC
+T125_ADMINROLE
+
+=======================
+ 2 row(s) returned
+
+--- SQL operation complete.
 >>
 >>get indexes on table players;
 
@@ -1870,9 +1914,15 @@
 --- SQL operation failed with errors.
 >>get functions for role t125_adminrole;
 
-*** ERROR[1017] You are not authorized to perform this operation.
+Functions for Role T125_ADMINROLE
+=================================
 
---- SQL operation failed with errors.
+TRAFODION."T125SCH3".TRANSLATEBITMAP
+
+=======================
+ 1 row(s) returned
+
+--- SQL operation complete.
 >>
 >>set schema t125sch3;
 
@@ -1906,7 +1956,9 @@
 --- SQL operation complete.
 >>get privileges on table games for t125_role1;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get views in catalog trafodion, match 'T125SCH%';
 
 Views in Catalog TRAFODION
@@ -1969,7 +2021,9 @@
 --- SQL operation complete.
 >>get privileges on sequence players_sequence for t125_role1;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get libraries, match 'T125%';
 
 Libraries in Schema TRAFODION.T125SCH3
@@ -2027,6 +2081,23 @@
 
 --- SQL operation complete.
 >>
+>>get schemas for user sql_user1, match 'T125SCH%';
+
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
+>>get schemas for role t125_adminrole, match 'T125SCH%';
+
+Schemas for Role T125_ADMINROLE
+===============================
+
+T125SCH3
+
+=======================
+ 1 row(s) returned
+
+--- SQL operation complete.
+>>
 >>get functions for library t125_l1;
 
 Functions for Library T125SCH3.T125_L1
@@ -2067,9 +2138,15 @@
 --- SQL operation failed with errors.
 >>get functions for role t125_adminrole;
 
-*** ERROR[1017] You are not authorized to perform this operation.
+Functions for Role T125_ADMINROLE
+=================================
 
---- SQL operation failed with errors.
+TRAFODION."T125SCH3".TRANSLATEBITMAP
+
+=======================
+ 1 row(s) returned
+
+--- SQL operation complete.
 >>
 >>exit;
 
@@ -2134,6 +2211,17 @@
 >>get procedures;
 
 --- SQL operation complete.
+>>get roles;
+
+Roles
+=====
+
+PUBLIC
+
+=======================
+ 1 row(s) returned
+
+--- SQL operation complete.
 >>
 >>get indexes on table players;
 
@@ -2209,7 +2297,7 @@
 Procedures for User SQL_USER1
 =============================
 
-TESTHIVE
+TRAFODION."T125SCH2".TESTHIVE
 
 =======================
  1 row(s) returned
@@ -2258,7 +2346,9 @@
 --- SQL operation complete.
 >>get privileges on table games for t125_role1;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get views in catalog trafodion, match 'T125SCH%';
 
 Views in Catalog TRAFODION
@@ -2283,7 +2373,9 @@
 --- SQL operation complete.
 >>get privileges on view games_by_player for user sql_user8;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get indexes in schema t125sch3;
 
 --- SQL operation complete.
@@ -2303,7 +2395,9 @@
 --- SQL operation complete.
 >>get privileges on sequence players_sequence for t125_role1;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get libraries, match 'T125%';
 
 --- SQL operation complete.
@@ -2312,7 +2406,9 @@
 --- SQL operation complete.
 >>get privileges on library t125_l1 for user sql_user8;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get functions in schema t125sch3;
 
 --- SQL operation complete.
@@ -2320,6 +2416,15 @@
 
 --- SQL operation complete.
 >>
+>>get schemas for user sql_user1, match 'T125SCH%';
+
+--- SQL operation complete.
+>>get schemas for role t125_adminrole, match 'T125SCH%';
+
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
+>>
 >>get functions for library t125_l1;
 
 --- SQL operation complete.
@@ -2332,7 +2437,7 @@
 Procedures for User SQL_USER1
 =============================
 
-TESTHIVE
+TRAFODION."T125SCH2".TESTHIVE
 
 =======================
  1 row(s) returned
@@ -2426,6 +2531,18 @@
 >>get procedures;
 
 --- SQL operation complete.
+>>get roles;
+
+Roles
+=====
+
+PUBLIC
+T125_ROLE1
+
+=======================
+ 2 row(s) returned
+
+--- SQL operation complete.
 >>
 >>get indexes on table players;
 
@@ -2528,9 +2645,15 @@
 --- SQL operation failed with errors.
 >>get functions for role t125_role1;
 
-*** ERROR[1017] You are not authorized to perform this operation.
+Functions for Role T125_ROLE1
+=============================
 
---- SQL operation failed with errors.
+TRAFODION."T125SCH3".TRANSLATEBITMAP
+
+=======================
+ 1 row(s) returned
+
+--- SQL operation complete.
 >>get functions for role t125_adminrole;
 
 *** ERROR[1017] You are not authorized to perform this operation.
@@ -2565,6 +2688,14 @@
 --- SQL operation complete.
 >>get privileges on table games for t125_role1;
 
+Privileges on Table T125SCH3.GAMES
+==================================
+
+SIDU-R-    SQL_USER2
+
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get views in catalog trafodion, match 'T125SCH%';
 
@@ -2592,7 +2723,9 @@
 --- SQL operation complete.
 >>get privileges on view games_by_player for user sql_user8;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get indexes in schema t125sch3;
 
 --- SQL operation complete.
@@ -2629,7 +2762,9 @@
 --- SQL operation complete.
 >>get privileges on library t125_l1 for user sql_user8;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get functions in schema t125sch3;
 
 Functions in Schema TRAFODION.T125SCH3
@@ -2645,6 +2780,17 @@
 
 --- SQL operation complete.
 >>
+>>get schemas for user sql_user1, match 'T125SCH%';
+
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
+>>get schemas for role t125_adminrole, match 'T125SCH%';
+
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
+>>
 >>get functions for library t125_l1;
 
 Functions for Library T125SCH3.T125_L1
@@ -2672,9 +2818,15 @@
 --- SQL operation failed with errors.
 >>get functions for role t125_role1;
 
-*** ERROR[1017] You are not authorized to perform this operation.
+Functions for Role T125_ROLE1
+=============================
 
---- SQL operation failed with errors.
+TRAFODION."T125SCH3".TRANSLATEBITMAP
+
+=======================
+ 1 row(s) returned
+
+--- SQL operation complete.
 >>get functions for role t125_adminrole;
 
 *** ERROR[1017] You are not authorized to perform this operation.
@@ -2738,6 +2890,18 @@
 >>get procedures;
 
 --- SQL operation complete.
+>>get roles;
+
+Roles
+=====
+
+PUBLIC
+T125_ROLE1
+
+=======================
+ 2 row(s) returned
+
+--- SQL operation complete.
 >>
 >>get indexes on table players;
 
@@ -2803,9 +2967,15 @@
 --- SQL operation complete.
 >>get functions for role t125_role1;
 
-*** ERROR[1017] You are not authorized to perform this operation.
+Functions for Role T125_ROLE1
+=============================
 
---- SQL operation failed with errors.
+TRAFODION."T125SCH3".TRANSLATEBITMAP
+
+=======================
+ 1 row(s) returned
+
+--- SQL operation complete.
 >>get functions for role t125_adminrole;
 
 *** ERROR[1017] You are not authorized to perform this operation.
@@ -2840,7 +3010,9 @@
 --- SQL operation complete.
 >>get privileges on view games_by_player for user sql_user8;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get indexes in schema t125sch3;
 
 --- SQL operation complete.
@@ -2877,7 +3049,9 @@
 --- SQL operation complete.
 >>get privileges on library t125_l1 for user sql_user8;
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>get functions in schema t125sch3;
 
 Functions in Schema TRAFODION.T125SCH3
@@ -2893,6 +3067,17 @@
 
 --- SQL operation complete.
 >>
+>>get schemas for user sql_user1, match 'T125SCH%';
+
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
+>>get schemas for role t125_adminrole, match 'T125SCH%';
+
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
+>>
 >>get functions for library t125_l1;
 
 Functions for Library T125SCH3.T125_L1
@@ -2918,9 +3103,15 @@
 --- SQL operation complete.
 >>get functions for role t125_role1;
 
-*** ERROR[1017] You are not authorized to perform this operation.
+Functions for Role T125_ROLE1
+=============================
 
---- SQL operation failed with errors.
+TRAFODION."T125SCH3".TRANSLATEBITMAP
+
+=======================
+ 1 row(s) returned
+
+--- SQL operation complete.
 >>get functions for role t125_adminrole;
 
 *** ERROR[1017] You are not authorized to perform this operation.
diff --git a/core/sql/regress/privs1/EXPECTED141 b/core/sql/regress/privs1/EXPECTED141
index 598dc8e..1e1fb06 100644
--- a/core/sql/regress/privs1/EXPECTED141
+++ b/core/sql/regress/privs1/EXPECTED141
@@ -142,6 +142,9 @@
 >>grant component privilege "CREATE" on sql_operations to t141_role2;
 
 --- SQL operation complete.
+>>revoke component privilege "SHOW" on sql_operations from "PUBLIC";
+
+--- SQL operation complete.
 >>
 >>-- ============================================================================
 >>--obey TEST141(test_private_user);
@@ -319,6 +322,39 @@
 >>execute get_col_privs;
 
 --- 0 row(s) selected.
+>>get schemas for role t141_role1;
+
+Schemas for Role T141_ROLE1
+===========================
+
+T141_USER1
+
+=======================
+ 1 row(s) returned
+
+--- SQL operation complete.
+>>get schemas for role t141_role2;
+
+Schemas for Role T141_ROLE2
+===========================
+
+T141_USER2
+
+=======================
+ 1 row(s) returned
+
+--- SQL operation complete.
+>>get schemas for role t141_role3;
+
+Schemas for Role T141_ROLE3
+===========================
+
+T141_USER3
+
+=======================
+ 1 row(s) returned
+
+--- SQL operation complete.
 >>
 >>-- t141_role2 has create privilege on all schemas.
 >>-- have sql_user2 who belongs to  t141_role2 create some tables in 
@@ -416,6 +452,45 @@
 
 --- SQL operation failed with errors.
 >>
+>>-- test get schemas for user and role
+>>-- schema owner sql_user2:  
+>>--   first test returns t144_user2 
+>>--   second test returns no rows
+>>-- schema owner t141_role:  both tests return t144_user2
+>>get schemas for user sql_user2;
+
+Schemas for User SQL_USER2
+==========================
+
+T141_USER2
+
+=======================
+ 1 row(s) returned
+
+--- SQL operation complete.
+>>get schemas for role t141_role2;
+
+Schemas for Role T141_ROLE2
+===========================
+
+T141_USER2
+
+=======================
+ 1 row(s) returned
+
+--- SQL operation complete.
+>>
+>>-- these should fail with no priv
+>>get schemas for user sql_user1;
+
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
+>>get schemas for role t141_role1;
+
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>
 >>-- ============================================================================
 >>exit;
@@ -664,6 +739,39 @@
 T141_USER1.U1T4                   2  DB__ROOT    SQL_USER3   S------        -------        
 
 --- 4 row(s) selected.
+>>get schemas for user sql_user1;
+
+Schemas for User SQL_USER1
+==========================
+
+T141_USER1
+
+=======================
+ 1 row(s) returned
+
+--- SQL operation complete.
+>>get schemas for user sql_user2;
+
+Schemas for User SQL_USER2
+==========================
+
+T141_USER2
+
+=======================
+ 1 row(s) returned
+
+--- SQL operation complete.
+>>get schemas for user sql_user3;
+
+Schemas for User SQL_USER3
+==========================
+
+T141_USER3
+
+=======================
+ 1 row(s) returned
+
+--- SQL operation complete.
 >>
 >>-- have sql_user2 create some tables in sql_user1's schema
 >>-- have sql_user2 create some views, views that reference user1's objects fail
@@ -757,6 +865,37 @@
 
 --- SQL operation failed with errors.
 >>
+>>-- test get schemas for user and role
+>>-- schema owner sql_user2:  
+>>--   first test returns t144_user2 
+>>--   second test returns no rows
+>>-- schema owner t141_role:  both tests return t144_user2
+>>get schemas for user sql_user2;
+
+Schemas for User SQL_USER2
+==========================
+
+T141_USER2
+
+=======================
+ 1 row(s) returned
+
+--- SQL operation complete.
+>>get schemas for role t141_role2;
+
+--- SQL operation complete.
+>>
+>>-- these should fail with no priv
+>>get schemas for user sql_user1;
+
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
+>>get schemas for role t141_role1;
+
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>
 >>-- ============================================================================
 >>exit;
@@ -1028,9 +1167,9 @@
 *** ERROR[4481] The user does not have SELECT privilege on table or view TRAFODION.T141_USER1.U1T3.
 
 --- SQL operation failed with errors.
->>get tables, match 'U3T%';
+>>get tables in schema t141_user1, match 'U3T%';
 
-Tables in Schema TRAFODION.T141_USER3
+Tables in Schema TRAFODION.T141_USER1
 =====================================
 
 U3T1
diff --git a/core/sql/regress/privs1/TEST120 b/core/sql/regress/privs1/TEST120
index 384dee0..f451dc8 100755
--- a/core/sql/regress/privs1/TEST120
+++ b/core/sql/regress/privs1/TEST120
@@ -235,7 +235,14 @@
 
 log;
 sh echo "Query_Invalidation_Keys explain output for select_games, select_teams, insert_teams, update_teams, select_players, select_standings: "   >> LOG120;
-sh sed '/Query_Invalidation_Keys/,/ObjectUIDs/!d;/ObjectUIDs/d' EXPLAIN120 | sed -e 's/[0-9 \t]*//g' >> LOG120;
+-- Explanation of next command:
+--  Extract rows between Query_Invalidation_Keys and ObjectUIDs from explain plan
+--    -> sed '/Query_Invalidation_Keys/,/ObjectUIDs/!d;/ObjectUIDs/d'
+--  Remove numeric invalidation key hashes
+--    -> sed -e 's/[0-9 \t]*//g'
+--  Join rows for each invalidation key set
+--    -> awk '/Query_Invalidation_Keys/{if (NR!=1)print ""}{printf $0}END{print "";}'
+sh sed '/Query_Invalidation_Keys/,/ObjectUIDs/!d;/ObjectUIDs/d' EXPLAIN120 | sed -e 's/[0-9 \t]*//g' | awk '/Query_Invalidation_Keys/{if (NR!=1)print ""}{printf $0}END{print "";}' >> LOG120;
 log;
 log LOG120;
 
@@ -251,7 +258,7 @@
 
 -- revoke insert, delete privilege from t120role2
 sh sqlci -i "TEST120(revoke_t120role2p)" -u sql_user3;
--- still have privilege
+-- still have privilege but recompile because of revoke on t120_role2
 execute select_teams;
 -- no longer has privilege (4481) and query attempted recompilation
 execute insert_teams;
@@ -297,7 +304,7 @@
 log EXPLAIN120 clear;
 explain select_stats;
 sh echo "Query_Invalidation_Keys explain output for select_stats: "   >> LOG120;
-sh sed '/Query_Invalidation_Keys/,/ObjectUIDs/!d;/ObjectUIDs/d' EXPLAIN120 | sed -e 's/[0-9 \t]*//g' >> LOG120;
+sh sed '/Query_Invalidation_Keys/,/ObjectUIDs/!d;/ObjectUIDs/d' EXPLAIN120 | sed -e 's/[0-9 \t]*//g' | awk '/Query_Invalidation_Keys/{if (NR!=1)print ""}{printf $0}END{print "";}' >> LOG120;
 log;
 log LOG120;
 
diff --git a/core/sql/regress/privs1/TEST123 b/core/sql/regress/privs1/TEST123
index 6214a55..d24ab6c 100644
--- a/core/sql/regress/privs1/TEST123
+++ b/core/sql/regress/privs1/TEST123
@@ -29,7 +29,15 @@
 --  get roles for user
 --  get privileges for role
 --  get privileges for user
---  get [tables | indexes | libraries | views] for user
+--  get [tables | indexes | views] for user
+--  get [tables | indexes | views] for role
+--
+--  see privs1/TEST141 for 
+--    get schemas for user
+--    get schemas for role
+--  see privs2/TEST144 for
+--    get [libraries, functions, table_mapping functions, procedures] for user 
+--    get [libraries, functions, table_mapping functions, procedures] for role 
 --
 -- Users and roles used
 --   t123_adminrole:   granted update and delete on games/teams
@@ -179,6 +187,7 @@
 get users for role t123_plannerrole;
 get users for role t123_dummyrole;
 get users for role t123_ownerrole;
+get users for role "PUBLIC";
 
 get privileges for user sql_user1;
 get privileges for user sql_user2;
@@ -197,24 +206,24 @@
 get tables for user sql_user3;
 get tables for user sql_user4;
 get tables for user sql_user5;
+get tables for role t123_adminrole;
+get tables for role t123_ownerrole;
 
 get indexes for user sql_user1;
 get indexes for user sql_user2;
 get indexes for user sql_user3;
 get indexes for user sql_user4;
 get indexes for user sql_user5;
+get indexes for role t123_adminrole;
+get indexes for role t123_ownerrole;
 
 get views for user sql_user1;
 get views for user sql_user2;
 get views for user sql_user3;
 get views for user sql_user4;
 get views for user sql_user5;
-
-get libraries for user sql_user1;
-get libraries for user sql_user2;
-get libraries for user sql_user3;
-get libraries for user sql_user4;
-get libraries for user sql_user5;
+get views for role t123_adminrole;
+get views for role t123_ownerrole;
 
 ?section other
 get privileges for user "PUBLIC";
@@ -222,3 +231,4 @@
 get privileges for role unknown_role;
 get roles for user unknown_user;
 get users for role unknown_role;
+
diff --git a/core/sql/regress/privs1/TEST125 b/core/sql/regress/privs1/TEST125
index 5a8e6e3..7c2344e 100644
--- a/core/sql/regress/privs1/TEST125
+++ b/core/sql/regress/privs1/TEST125
@@ -24,6 +24,7 @@
 --
 -- Tests that get statements return only what the user can see
 --  get schemas (in catalog)
+--  get schemas for role (get schemas for user is part of privs1/TEST144)
 --  get tables (in schemas)
 --  get views (in catalogs)
 --  get views (in schemas)
@@ -35,8 +36,8 @@
 --  get privileges on view
 --  get privileges on sequence
 --  get privileges on library
---  (tests for get privileges on functions, table_mapping functions, and
---   procedures is part of privs2/TEST144)
+--  (tests for get privileges on functions, table_mapping functions, 
+--   libraries and procedures is part of privs2/TEST144)
 --
 -- ============================================================================
 cqd SHOWDDL_DISPLAY_PRIVILEGE_GRANTS 'ON';
@@ -266,6 +267,7 @@
 get libraries, match 'T125%';
 get functions;
 get procedures;
+get roles;
 
 get indexes on table players;
 get views on table players;
@@ -306,6 +308,9 @@
 get functions in schema t125sch3;
 get procedures;
  
+get schemas for user sql_user1, match 'T125SCH%';
+get schemas for role t125_adminrole, match 'T125SCH%';
+
 get functions for library t125_l1;
 get procedures for library t125_l2;
 
diff --git a/core/sql/regress/privs1/TEST141 b/core/sql/regress/privs1/TEST141
index 8abf627..06da585 100755
--- a/core/sql/regress/privs1/TEST141
+++ b/core/sql/regress/privs1/TEST141
@@ -24,6 +24,7 @@
 -- ============================================================================
 -- Functionality: Extended support for views for all levels:
 --    column, object, component
+--    get schema for {user | role} authID
 --
 -- Added in response to JIRA 1100
 --
@@ -55,6 +56,7 @@
 revoke component privilege "CREATE" on sql_operations from sql_user2;
 revoke component privilege "CREATE" on sql_operations from t141_role2;
 revoke component privilege "DML_SELECT_METADATA" on sql_operations from "PUBLIC";
+grant component privilege "SHOW" on sql_operations to "PUBLIC";
 
 revoke role t141_role1 from sql_user1;
 revoke role t141_role2 from sql_user2;
@@ -188,6 +190,7 @@
 -- set up component privilege infrastructure
 grant component privilege "CREATE" on sql_operations to sql_user2;
 grant component privilege "CREATE" on sql_operations to t141_role2;
+revoke component privilege "SHOW" on sql_operations from "PUBLIC";
 
 -- ============================================================================
 ?section create_objects
@@ -292,6 +295,9 @@
 grant select(c1, c3) on u1t4 to sql_user3;
 execute get_obj_privs;
 execute get_col_privs;
+get schemas for user sql_user1;
+get schemas for user sql_user2;
+get schemas for user sql_user3;
 
 -- have sql_user2 create some tables in sql_user1's schema
 -- have sql_user2 create some views, views that reference user1's objects fail
@@ -336,6 +342,9 @@
 set schema t141_user1;
 execute get_obj_privs;
 execute get_col_privs;
+get schemas for role t141_role1;
+get schemas for role t141_role2;
+get schemas for role t141_role3;
 
 -- t141_role2 has create privilege on all schemas.
 -- have sql_user2 who belongs to  t141_role2 create some tables in 
@@ -428,6 +437,17 @@
 -- user2 has no privs on u3t1
 create view u2v1 as select * from t141_user1.u3t1; 
 
+-- test get schemas for user and role
+-- schema owner sql_user2:  
+--   first test returns t144_user2 
+--   second test returns no rows
+-- schema owner t141_role:  both tests return t144_user2
+get schemas for user sql_user2;
+get schemas for role t141_role2; 
+
+-- these should fail with no priv
+get schemas for user sql_user1;
+get schemas for role t141_role1;
 
 -- ============================================================================
 ?section user3_objects
@@ -455,7 +475,7 @@
 
 -- following fail
 create view u3v5 as select c1, c3 from t141_user1.u1t3;
-get tables, match 'U3T%';
+get tables in schema t141_user1, match 'U3T%';
 get views;
 
 -- ============================================================================
diff --git a/core/sql/regress/privs1/Utils.java b/core/sql/regress/privs1/Utils.java
index c48846a..adea28a 100644
--- a/core/sql/regress/privs1/Utils.java
+++ b/core/sql/regress/privs1/Utils.java
@@ -44,7 +44,7 @@
    static boolean log = false;
    static String logFileName = "udr_tools.log";
    static String logLocation = null;
-   static String sqRoot = null;
+   static String Logs = null;
    static String userName = null;
 
    Utils () 
@@ -53,8 +53,8 @@
        log = Boolean.getBoolean("debugOn");
      
      if (log) { 
-       sqRoot = System.getenv("TRAF_HOME");
-       logLocation = sqRoot + "/logs/";
+       Logs = System.getenv("TRAF_LOG");
+       logLocation = Logs + "/";
      }
    }
 
diff --git a/core/sql/regress/privs2/EXPECTED129 b/core/sql/regress/privs2/EXPECTED129
index c844a4a..d6ef9e6 100644
--- a/core/sql/regress/privs2/EXPECTED129
+++ b/core/sql/regress/privs2/EXPECTED129
@@ -222,6 +222,25 @@
 End of MXCI Session
 
 >>-- As user1, should fail
+>>get privileges for user sql_user1;
+
+Privileges for User SQL_USER1
+=============================
+
+------E    TRAFODION."_LIBMGR_".EVENT_LOG_READER
+------E    TRAFODION."_LIBMGR_".JDBC
+---U---    TRAFODION.US4.T1
+S------    TRAFODION.US4.T1 <Column> COL3
+S------    TRAFODION.US4.T129_A
+S------    TRAFODION.US4.T129_STARTER
+SI-----    TRAFODION.US4.T2
+S------    TRAFODION.US4.V1
+-I-U---    TRAFODION.US4.V1 <Column> VC1
+
+=======================
+ 9 row(s) returned
+
+--- SQL operation complete.
 >>select * from us4.t1 ;
 
 *** ERROR[4481] The user does not have SELECT privilege on table or view TRAFODION.US4.T1(columns: COL1, COL2).
@@ -284,36 +303,43 @@
 
 --- 1 row(s) inserted.
 >>
->>delete all from table(querycache()) ;
-
-*** ERROR[15001] A syntax error occurred at or before: 
-delete all from table(querycache()) ;
-                                 ^ (34 characters from start of SQL statement)
-
-*** ERROR[8822] The statement was not prepared.
-
->>delete all from table(natablecache());
+>>delete all from table(querycache('user', 'local')) ;
 
 --- 0 row(s) deleted.
->>select * from table(querycacheentries());
+>>select count(*) from table(querycacheentries('user', 'local'));
 
-*** ERROR[15001] A syntax error occurred at or before: 
-select * from table(querycacheentries());
-                                      ^ (39 characters from start of SQL statement)
+(EXPR)              
+--------------------
 
-*** ERROR[8822] The statement was not prepared.
+                   0
 
->>select * from table(natablecache()) ;
+--- 1 row(s) selected.
+>>delete all from table (natablecache());
 
-*** ERROR[15001] A syntax error occurred at or before: 
-select * from table(natablecache()) ;
-                                 ^ (34 characters from start of SQL statement)
-
-*** ERROR[8822] The statement was not prepared.
-
+--- 0 row(s) deleted.
+>>--select context, num_entries from table(natablecache('all','local')) ;
 >>
 >>log;
 >>-- As user1, should fail
+>>get privileges for user sql_user1;
+
+Privileges for User SQL_USER1
+=============================
+
+------E    TRAFODION."_LIBMGR_".EVENT_LOG_READER
+------E    TRAFODION."_LIBMGR_".JDBC
+---U---    TRAFODION.US4.T1
+S------    TRAFODION.US4.T1 <Column> COL3
+S------    TRAFODION.US4.T129_A
+S------    TRAFODION.US4.T129_STARTER
+SI-----    TRAFODION.US4.T2
+S------    TRAFODION.US4.V1
+-I-U---    TRAFODION.US4.V1 <Column> VC1
+
+=======================
+ 9 row(s) returned
+
+--- SQL operation complete.
 >>select * from us4.t1 ;
 
 *** ERROR[4481] The user does not have SELECT privilege on table or view TRAFODION.US4.T1(columns: COL1, COL2).
@@ -381,36 +407,41 @@
 
 --- 0 row(s) inserted.
 >>
->>delete all from table(querycache()) ;
-
-*** ERROR[15001] A syntax error occurred at or before: 
-delete all from table(querycache()) ;
-                                 ^ (34 characters from start of SQL statement)
-
-*** ERROR[8822] The statement was not prepared.
-
->>delete all from table(natablecache());
+>>delete all from table(querycache('user', 'local')) ;
 
 --- 0 row(s) deleted.
->>select * from table(querycacheentries());
+>>select count(*) from table(querycacheentries('user', 'local'));
 
-*** ERROR[15001] A syntax error occurred at or before: 
-select * from table(querycacheentries());
-                                      ^ (39 characters from start of SQL statement)
+(EXPR)              
+--------------------
 
-*** ERROR[8822] The statement was not prepared.
+                   0
 
->>select * from table(natablecache()) ;
+--- 1 row(s) selected.
+>>delete all from table (natablecache());
 
-*** ERROR[15001] A syntax error occurred at or before: 
-select * from table(natablecache()) ;
-                                 ^ (34 characters from start of SQL statement)
-
-*** ERROR[8822] The statement was not prepared.
-
+--- 0 row(s) deleted.
+>>--select context, num_entries from table(natablecache('all','local')) ;
 >>
 >>log;
 >>-- As user2, should fail
+>>get privileges for user sql_user2;
+
+Privileges for User SQL_USER2
+=============================
+
+------E    TRAFODION."_LIBMGR_".EVENT_LOG_READER
+------E    TRAFODION."_LIBMGR_".JDBC
+S------    TRAFODION.US4.T1
+---U---    TRAFODION.US4.T1 <Column> COL2
+---U---    TRAFODION.US4.T1 <Column> COL3
+SI-----    TRAFODION.US4.T2 <Column> A
+SI-----    TRAFODION.US4.T2 <Column> B
+
+=======================
+ 7 row(s) returned
+
+--- SQL operation complete.
 >>delete from us4.t1 ;
 
 *** ERROR[4481] The user does not have DELETE privilege on table or view TRAFODION.US4.T1.
@@ -460,6 +491,24 @@
 --- 1 row(s) inserted.
 >>log;
 >>-- as user3
+>>get privileges for user sql_user3;
+
+Privileges for User SQL_USER3
+=============================
+
+------E    TRAFODION."_LIBMGR_".EVENT_LOG_READER
+------E    TRAFODION."_LIBMGR_".JDBC
+S--U---    TRAFODION.US4.T1 <Column> COL1
+SI-----    TRAFODION.US4.T2 <Column> A
+S------    TRAFODION.US4.T3 <Column> B
+S------    TRAFODION.US4.T3 <Column> D
+S------    TRAFODION.US4.T4 <Column> F
+S------    TRAFODION.US4.T4 <Column> G
+
+=======================
+ 8 row(s) returned
+
+--- SQL operation complete.
 >>insert into us4.t2(a,b) values (2,2) ;
 
 *** ERROR[4481] The user does not have SELECT privilege on table or view TRAFODION.US4.T2(columns: B).
@@ -600,6 +649,24 @@
 >>-- Testing create view based on column-level SELECT
 >>-- as user3
 >>
+>>get privileges for user sql_user3;
+
+Privileges for User SQL_USER3
+=============================
+
+------E    TRAFODION."_LIBMGR_".EVENT_LOG_READER
+------E    TRAFODION."_LIBMGR_".JDBC
+S--U---    TRAFODION.US4.T1 <Column> COL1
+SI-----    TRAFODION.US4.T2 <Column> A
+S------    TRAFODION.US4.T3 <Column> B
+S------    TRAFODION.US4.T3 <Column> D
+S------    TRAFODION.US4.T4 <Column> F
+S------    TRAFODION.US4.T4 <Column> G
+
+=======================
+ 8 row(s) returned
+
+--- SQL operation complete.
 >>set schema cat.us4;
 
 --- SQL operation complete.
@@ -782,6 +849,28 @@
 >>set schema us4;
 
 --- SQL operation complete.
+>>get privileges for user sql_user4;
+
+Privileges for User SQL_USER4
+=============================
+
+------E    TRAFODION."_LIBMGR_".EVENT_LOG_READER
+------E    TRAFODION."_LIBMGR_".JDBC
+SIDU-R-    TRAFODION.US4.SB_HISTOGRAMS
+SIDU-R-    TRAFODION.US4.SB_HISTOGRAM_INTERVALS
+SIDU-R-    TRAFODION.US4.SB_PERSISTENT_SAMPLES
+SIDU-R-    TRAFODION.US4.T1
+SIDU-R-    TRAFODION.US4.T129_A
+SIDU-R-    TRAFODION.US4.T129_STARTER
+SIDU-R-    TRAFODION.US4.T2
+SIDU-R-    TRAFODION.US4.T3
+SIDU-R-    TRAFODION.US4.T4
+SIDU-R-    TRAFODION.US4.V1
+
+=======================
+ 12 row(s) returned
+
+--- SQL operation complete.
 >>
 >>grant select (b,d) on t3 to sql_user3 with grant option;
 
@@ -868,6 +957,25 @@
 End of MXCI Session
 
 >>-- as user1
+>>get privileges for user sql_user1;
+
+Privileges for User SQL_USER1
+=============================
+
+------E    TRAFODION."_LIBMGR_".EVENT_LOG_READER
+------E    TRAFODION."_LIBMGR_".JDBC
+---U---    TRAFODION.US4.T1
+S------    TRAFODION.US4.T1 <Column> COL3
+S------    TRAFODION.US4.T129_A
+S------    TRAFODION.US4.T129_STARTER
+SI-----    TRAFODION.US4.T2
+S------    TRAFODION.US4.V1
+-I-U---    TRAFODION.US4.V1 <Column> VC1
+
+=======================
+ 9 row(s) returned
+
+--- SQL operation complete.
 >>
 >>cqd query_cache '0' ;
 
@@ -910,15 +1018,16 @@
 
 --- SQL operation complete.
 >>
->>select case when current_cache_size > 0 then 1 else 0 end from table(natablecache());
+>>select case when current_cache_size > 0 then 1 else 0 end from table(natablecache('all', 'local'));
 
-*** ERROR[15001] A syntax error occurred at or before: 
-select case when current_cache_size > 0 then 1 else 0 end from table(natablecac
-he());
-   ^ (83 characters from start of SQL statement)
+(EXPR)
+------
 
-*** ERROR[8822] The statement was not prepared.
+     0
+     1
+     1
 
+--- 3 row(s) selected.
 >>
 >>--should error but place t129_a in natable cache
 >>prepare s1 from select * from us4.t129_a where c1 > 10;
@@ -928,15 +1037,16 @@
 *** ERROR[8822] The statement was not prepared.
 
 >>
->>select case when current_cache_size > 0 then 1 else 0 end from table(natablecache());
+>>select case when current_cache_size > 0 then 1 else 0 end from table(natablecache('all', 'local'));
 
-*** ERROR[15001] A syntax error occurred at or before: 
-select case when current_cache_size > 0 then 1 else 0 end from table(natablecac
-he());
-   ^ (83 characters from start of SQL statement)
+(EXPR)
+------
 
-*** ERROR[8822] The statement was not prepared.
+     1
+     1
+     1
 
+--- 3 row(s) selected.
 >>
 >>sh  sh runmxci.ksh -i "TEST129(grant1)" -u sql_user4;
 >>grant select on us4.t129_a to sql_user1 ;
diff --git a/core/sql/regress/privs2/EXPECTED144 b/core/sql/regress/privs2/EXPECTED144
index f3127e0..2c225b4 100644
--- a/core/sql/regress/privs2/EXPECTED144
+++ b/core/sql/regress/privs2/EXPECTED144
Binary files differ
diff --git a/core/sql/regress/privs2/EXPECTED146 b/core/sql/regress/privs2/EXPECTED146
index 0752634..f531f30 100644
--- a/core/sql/regress/privs2/EXPECTED146
+++ b/core/sql/regress/privs2/EXPECTED146
@@ -91,7 +91,7 @@
 CREATE HBASE TABLE T146T1 ( COLUMN FAMILY '#1')
 
 REGISTER /*INTERNAL*/ HBASE TABLE T146T1;
-/* ObjectUID = 7181713655023564985 */
+/* ObjectUID = 6699276640720809174 */
 
 -- GRANT SELECT, INSERT, DELETE, UPDATE, REFERENCES ON HBASE."_CELL_".T146T1 TO DB__HBASEROLE WITH GRANT OPTION;
 
@@ -114,7 +114,7 @@
 CREATE HBASE TABLE T146T1 ( COLUMN FAMILY '#1')
 
 REGISTER /*INTERNAL*/ HBASE TABLE T146T1;
-/* ObjectUID = 7181713655023565067 */
+/* ObjectUID = 6699276640720809244 */
 
 -- GRANT SELECT, INSERT, DELETE, UPDATE, REFERENCES ON HBASE."_ROW_".T146T1 TO DB__HBASEROLE WITH GRANT OPTION;
 
@@ -312,7 +312,7 @@
 CREATE HBASE TABLE T146T1 ( COLUMN FAMILY '#1')
 
 REGISTER /*INTERNAL*/ HBASE TABLE T146T1;
-/* ObjectUID = 7181713655023564985 */
+/* ObjectUID = 6699276640720809174 */
 
 -- GRANT SELECT, INSERT, DELETE, UPDATE, REFERENCES ON HBASE."_CELL_".T146T1 TO DB__HBASEROLE WITH GRANT OPTION;
   GRANT SELECT ON HBASE."_CELL_".T146T1 TO SQL_USER3 GRANTED BY DB__HBASEROLE;
@@ -340,7 +340,7 @@
 CREATE HBASE TABLE T146T1 ( COLUMN FAMILY '#1')
 
 REGISTER /*INTERNAL*/ HBASE TABLE T146T1;
-/* ObjectUID = 7181713655023565067 */
+/* ObjectUID = 6699276640720809244 */
 
 -- GRANT SELECT, INSERT, DELETE, UPDATE, REFERENCES ON HBASE."_ROW_".T146T1 TO DB__HBASEROLE WITH GRANT OPTION;
   GRANT SELECT ON HBASE."_ROW_".T146T1 TO SQL_USER3 GRANTED BY DB__HBASEROLE;
@@ -1687,7 +1687,9 @@
 --- SQL operation failed with errors.
 >>get privileges for role db__hbaserole, match '%146%';
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>
 >>drop hbase table t146t2;
 
@@ -1696,7 +1698,9 @@
 --- SQL operation failed with errors.
 >>get privileges for role db__hbaserole, match '%146%';
 
---- SQL operation complete.
+*** ERROR[1017] You are not authorized to perform this operation.
+
+--- SQL operation failed with errors.
 >>
 >>exit;
 
diff --git a/core/sql/regress/privs2/LOG144 b/core/sql/regress/privs2/LOG144
index 5738ebc..edc27c2 100644
--- a/core/sql/regress/privs2/LOG144
+++ b/core/sql/regress/privs2/LOG144
Binary files differ
diff --git a/core/sql/regress/privs2/TEST129 b/core/sql/regress/privs2/TEST129
index 1cea5c2..9cbe511 100755
--- a/core/sql/regress/privs2/TEST129
+++ b/core/sql/regress/privs2/TEST129
@@ -32,7 +32,6 @@
 sh sqlci -i "TEST129(step4)" -u sql_user3;
 sh sqlci -i "TEST129(step5)" -u sql_user4;
 sh sqlci -i "TEST129(step6)" -u sql_user4;
-sh sqlci -i "TEST129(step7)" -u sql_user4;
 sh sqlci -i "TEST129(invalidate)" -u sql_user1;
 
 obey TEST129(clean_up);
@@ -44,7 +43,6 @@
 
 ?section setup
 cqd SHOWDDL_DISPLAY_PRIVILEGE_GRANTS 'ON';
-cqd CAT_TEST_BOOL 'ON';
 log LOG129 clear;
 log LOG129;
 create schema us4;
@@ -123,9 +121,9 @@
 insert into t4 values (11,22,33,44), (55,66,77,88);
 
 ?section step1
-cqd CAT_TEST_BOOL 'ON';
 log LOG129;
 -- As user1, should fail
+get privileges for user sql_user1;
 select * from us4.t1 ;
 delete from us4.t1;
 insert into us4.t1 values (1,1,1);
@@ -140,17 +138,17 @@
 update us4.v1 set vc1 = vc1 ;
 insert into us4.v1(vc1) values (10) ;
 
-delete all from table(querycache()) ;
-delete all from table(natablecache());
-select * from table(querycacheentries());
-select * from table(natablecache()) ;
+delete all from table(querycache('user', 'local')) ;
+select count(*) from table(querycacheentries('user', 'local'));
+delete all from table (natablecache());
+--select context, num_entries from table(natablecache('all','local')) ;
 
 log;
 
 ?section step2
-cqd CAT_TEST_BOOL 'ON';
 log LOG129;
 -- As user2, should fail
+get privileges for user sql_user2;
 delete from us4.t1 ;
 insert into us4.t1 values (1,1,1);
 select * from us4.v1 ;
@@ -164,9 +162,9 @@
 log;
 
 ?section step3
-cqd CAT_TEST_BOOL 'ON';
 log LOG129;
 -- as user3
+get privileges for user sql_user3;
 insert into us4.t2(a,b) values (2,2) ;
 update us4.t1 set col2 = col1;
 
@@ -202,11 +200,11 @@
 log;
 
 ?section step4
-cqd CAT_TEST_BOOL 'ON';
 log LOG129;
 -- Testing create view based on column-level SELECT
 -- as user3
 
+get privileges for user sql_user3; 
 set schema cat.us4;
 
 -- View on single table (positive):
@@ -253,12 +251,12 @@
 log;
 
 ?section step5
-cqd CAT_TEST_BOOL 'ON';
 log LOG129;
 -- Testing revoke for column-level SELECT
 -- as user4
 
 set schema us4;
+get privileges for user sql_user4;
 
 grant select (b,d) on t3 to sql_user3 with grant option;
 grant select (f,g) on t4 to sql_user3;
@@ -278,8 +276,8 @@
 showddl t3;
 
 ?section step6
-cqd CAT_TEST_BOOL 'ON';
 set schema us4;
+get privileges for user sql_user4;
 
 -- Testing other variations of column level
 
@@ -306,9 +304,9 @@
 showddl t1;
 
 ?section invalidate
-cqd CAT_TEST_BOOL 'ON';
 log LOG129;
 -- as user1
+get privileges for user sql_user1;
 
 cqd query_cache '0' ;
 cqd metadata_cache_size '0' ;
@@ -325,12 +323,12 @@
 
 cqd metadata_cache_size reset ;
 
-select case when current_cache_size > 0 then 1 else 0 end from table(natablecache());
+select case when current_cache_size > 0 then 1 else 0 end from table(natablecache('all', 'local'));
 
 --should error but place t129_a in natable cache
 prepare s1 from select * from us4.t129_a where c1 > 10;
 
-select case when current_cache_size > 0 then 1 else 0 end from table(natablecache());
+select case when current_cache_size > 0 then 1 else 0 end from table(natablecache('all', 'local'));
 
 sh  sh runmxci.ksh -i "TEST129(grant1)" -u sql_user4; 
 
@@ -421,22 +419,18 @@
 exit ;
 
 ?section revoke1
-cqd CAT_TEST_BOOL 'ON';
 log LOG129;
 revoke select on us4.t129_a from sql_user1 ;
 
 ?section grant1
-cqd CAT_TEST_BOOL 'ON';
 log LOG129;
 grant select on us4.t129_a to sql_user1 ;
 
 ?section grant2
-cqd CAT_TEST_BOOL 'ON';
 log LOG129;
 grant select on us4.t129_a to sql_user2 ;
 
 ?section grant3
-cqd CAT_TEST_BOOL 'ON';
 log LOG129;
 grant select on us4.t129_a to sql_user3 ;
 
diff --git a/core/sql/regress/privs2/TEST144 b/core/sql/regress/privs2/TEST144
index 910e120..f5e1934 100755
--- a/core/sql/regress/privs2/TEST144
+++ b/core/sql/regress/privs2/TEST144
@@ -23,6 +23,9 @@
 -- @@@ END COPYRIGHT @@@
 --
 --  Tests grant and revoke for functions
+--  Tests get commands:
+--    get [libraries, functions, table_mapping_functions, procedures] for user
+--    get [libraries, functions, table_mapping_functions, procedures] for role
 -- ============================================================================
 
 cqd SHOWDDL_DISPLAY_PRIVILEGE_GRANTS 'ON';
@@ -40,6 +43,8 @@
 -- drop database
 drop schema if exists t144user1 cascade;
 
+revoke update, usage on library t144_l1 from sql_user2;
+revoke usage on library t144_l2 from t144role1;
 revoke execute on procedure "_LIBMGR_".help from t144role1;
 revoke role t144role1 from sql_user4;
 drop role t144role1;
@@ -49,6 +54,7 @@
 revoke execute on procedure "_LIBMGR_".help from sql_user2;
 
 grant component privilege "SHOW" on sql_operations to "PUBLIC";
+
 ?section create_db
 create schema t144user1 authorization sql_user1;
 set schema t144user1;
@@ -115,18 +121,20 @@
 showddl customers;
 create role t144role1;
 
+grant update, usage on library t144_l1 to sql_user2;
+grant usage on library t144_l2 to t144role1;
+
 revoke component privilege "SHOW" on sql_operations from "PUBLIC";
 get privileges on component sql_operations for "PUBLIC";
 
 ?section set_up
-set schema "_PRIVMGR_MD_";
 prepare get_privs from
 select distinct
    trim(substring (o.object_name,1,15)) as object_name,
    grantor_id, grantee_id,
    t144user1.t144_translatePrivsBitmap(privileges_bitmap) as granted_privs,
    t144user1.t144_translatePrivsBitmap(grantable_bitmap) as grantable_privs
-from object_privileges p, "_MD_".objects o 
+from "_PRIVMGR_MD_".object_privileges p, "_MD_".objects o 
 where p.object_uid in 
   (select object_uid
    from "_MD_".objects
@@ -153,12 +161,22 @@
 get privileges on function gen_phone for sql_user1;
 get privileges on procedure "_LIBMGR_".help for sql_user1;
 get privileges on table_mapping function "_LIBMGR_".event_log_reader for sql_user1;
-sh sqlci -i "TEST144(cmds)" -u sql_user1;
+
+get functions for user sql_user1;
+get table_mapping functions for user sql_user1;
+get procedures for user sql_user1;
+
+get libraries for user sql_user2;
+get libraries for user sql_user3;
+get libraries for user sql_user4;
+get libraries for role t144role1;
+
+sh sqlci -i "TEST144(cmds_user1)" -u sql_user1;
 
 -- no other user or role has privileges
-sh sqlci -i "TEST144(cmds)" -u sql_user2;
-sh sqlci -i "TEST144(cmds)" -u sql_user3;
-sh sqlci -i "TEST144(cmds)" -u sql_user4;
+sh sqlci -i "TEST144(cmds_user2)" -u sql_user2;
+sh sqlci -i "TEST144(cmds_user3)" -u sql_user3;
+sh sqlci -i "TEST144(cmds_user4)" -u sql_user4;
 
 -- grant user2 execute
 grant execute on function gen_phone to sql_user2 with grant option;
@@ -169,14 +187,16 @@
 get privileges on function gen_random for sql_user2;
 get privileges on function gen_time for user sql_user2;
 get privileges on procedure "_LIBMGR_".help for user sql_user2;
+get functions for user sql_user2;
+get table_mapping functions for user sql_user2;
+get procedures for user sql_user2;
 execute get_privs;
 
-
 -- user2 can execute
-sh sqlci -i "TEST144(cmds)" -u sql_user2;
+sh sqlci -i "TEST144(cmds_user2)" -u sql_user2;
 
 -- user3 still cannot execute
-sh sqlci -i "TEST144(cmds)" -u sql_user3;
+sh sqlci -i "TEST144(cmds_user3)" -u sql_user3;
 
 -- grant user3 by user2
 grant execute on function gen_phone to sql_user3 with grant option by sql_user2;
@@ -189,10 +209,13 @@
 get privileges on function gen_random for user sql_user3;
 get privileges on function gen_time for user sql_user3;
 get privileges on procedure "_LIBMGR_".help for user sql_user3;
+get functions for user sql_user3;
+get table_mapping functions for user sql_user3;
+get procedures for user sql_user3;
 execute get_privs;
 
 -- user 3 can execute gen_phone, gen_random, and help but not gen_time
-sh sqlci -i "TEST144(cmds)" -u sql_user3;
+sh sqlci -i "TEST144(cmds_user3)" -u sql_user3;
 grant execute on function gen_phone to sql_user5 by sql_user3;
 grant execute on procedure "_LIBMGR_".help to sql_user5 by sql_user3;
  
@@ -200,16 +223,24 @@
 grant execute on function gen_random to t144role1;
 grant execute on function gen_time to t144role1;
 grant execute on procedure "_LIBMGR_".help to t144role1;
+get functions for role t144role1;
+get table_mapping functions for role t144role1;
+get procedures for role t144role1;
 grant role t144role1 to sql_user4;
+
 get privileges on function gen_phone for user sql_user4;
 get privileges on function gen_random for user sql_user4;
 get privileges on function gen_time for user sql_user4;
 get privileges on procedure "_LIBMGR_".help for user sql_user4;
 get privileges on function gen_random for t144role1;
+get functions for user sql_user4;
+get table_mapping functions for user sql_user4;
+get procedures for user sql_user4;
+get libraries for user sql_user4;
 execute get_privs;
 
 -- user4 can execute through role t144role1
-sh sqlci -i "TEST144(cmds)" -u sql_user4;
+sh sqlci -i "TEST144(cmds_user4)" -u sql_user4;
 
 get privileges on function gen_phone;
 get privileges on function gen_random;
@@ -222,6 +253,8 @@
 set schema t144user1;
 execute get_privs;
 
+revoke usage on library t144_l2 from t144role1;
+
 revoke grant option for execute on function gen_phone from sql_user3 by sql_user2;
 revoke execute on function gen_phone from sql_user5 by sql_user3;
 revoke grant option for execute on function gen_phone from sql_user3 by sql_user2;
@@ -246,14 +279,74 @@
 obey TEST144(set_up);
 execute get_privs;
 
+revoke execute on function t144_translatePrivsBitmap from "PUBLIC";
+execute get_privs;
+sh sqlci -i "TEST144(cmds_user2)" -u sql_user2;
+
+?section cmds_user1
+-- ============================================================================
+-- verify user1 privs
+-- ============================================================================
+log LOG144;
+values (user);
+set schema t144user1;
+get functions for user sql_user1;
+get table_mapping functions for user sql_user1;
+get procedures for user sql_user1;
+get functions for user sql_user2;
+obey TEST144(cmds);
+
+?section cmds_user2
+-- ============================================================================
+-- verify user1 privs
+-- ============================================================================
+log LOG144;
+values (user);
+set schema t144user1;
+get functions for user sql_user2;
+get table_mapping functions for user sql_user2;
+get procedures for user sql_user2;
+get libraries for user sql_user2;
+
+-- no privs
+get table_mapping functions for user sql_user1;
+get libraries for user sql_user3;
+get libraries for role t144role1;
+
+obey TEST144(cmds);
+
+?section cmds_user3
+-- ============================================================================
+-- verify user1 privs
+-- ============================================================================
+log LOG144;
+values (user);
+set schema t144user1;
+get functions for user sql_user3;
+get table_mapping functions for user sql_user3;
+get procedures for user sql_user3;
+get procedures for user sql_user1;
+obey TEST144(cmds);
+
+?section cmds_user4
+-- ============================================================================
+-- verify user1 privs
+-- ============================================================================
+log LOG144;
+values (user);
+set schema t144user1;
+get functions for user sql_user4;
+get table_mapping functions for user sql_user4;
+get procedures for user sql_user4;
+get libraries for user sql_user4;
+get libraries for role t144role1;
+
+obey TEST144(cmds);
 
 ?section cmds
 -- ============================================================================
 -- execute functions
 -- ============================================================================
-log LOG144;
-values (user);
-set schema t144user1;
 -- should return privileges only for users that have execute privilege
 get privileges on function gen_time;
 -- should return no rows for users other than sql_user1
@@ -276,3 +369,4 @@
 
 set param ?proc 'rm';
 call "_LIBMGR_".help (?proc);
+
diff --git a/core/sql/regress/tools/regress-filter-linux b/core/sql/regress/tools/regress-filter-linux
index c32d3ea..dc74b1b 100755
--- a/core/sql/regress/tools/regress-filter-linux
+++ b/core/sql/regress/tools/regress-filter-linux
@@ -35,10 +35,18 @@
   exit 1
 fi
 SYSKEY=`grep '\<SYSKEY\>' $fil | egrep -v '(--|^>>|^\*\*)'`
+# A SYSKEY can be as few as 15 decimal digits. The high order 15 bits
+# are an XOR of the low 15 bits of the node id and the linux thread ID,
+# while the low 49 bits are taken from JULIANTIMESTAMP. It is possible
+# for the high order bits to be zero (e.g. node id 0, linux TID 16384),
+# in which case all the decimal digits come from JULIANTIMESTAMP. At
+# present, JULIANTIMESTAMP yields 15 decimal digits and will until it
+# wraps many many years from now. See the code in function
+# generateUniqueValueFast in sqlshare/CatSQLShare.cpp.
 if [ "$SYSKEY" = "" ]; then
   SYSKEY='@syskey@'
 else
-  SYSKEY='[0-9]\{16,20\}\>'
+  SYSKEY='[0-9]\{15,20\}\>'
 fi
 #       123456789 123456789
 
diff --git a/core/sql/regress/udr/EXPECTED002 b/core/sql/regress/udr/EXPECTED002
index b5d92cb..ab8f3c4 100644
--- a/core/sql/regress/udr/EXPECTED002
+++ b/core/sql/regress/udr/EXPECTED002
@@ -6560,7 +6560,7 @@
 >>
 >>-- copy a file with known content to the log directory and see whether
 >>-- we get the correct results
->>sh cp $$scriptsdir$$/udr/TEST002.sample_events $$TRAF_HOME$$/logs/master_exec_regr_999_99999.log;
+>>sh cp $$scriptsdir$$/udr/TEST002.sample_events $$TRAF_LOG$$/master_exec_regr_999_99999.log;
 >>
 >>select count(*) as num_events,
 +>       max(log_file_line) as num_lines,
@@ -6597,7 +6597,7 @@
 --- 8 row(s) selected.
 >>-- lines 20, 30 and 31 have parse errors and are also displayed
 >>
->>sh rm $$TRAF_HOME$$/logs/master_exec_regr_999_99999.log;
+>>sh rm $$TRAF_LOG$$/master_exec_regr_999_99999.log;
 >>
 >>-- some negative test cases
 >>prepare s from select * from udf(event_log_reader(10));
diff --git a/core/sql/regress/udr/TEST002 b/core/sql/regress/udr/TEST002
index 381d557..4b9ed8b 100644
--- a/core/sql/regress/udr/TEST002
+++ b/core/sql/regress/udr/TEST002
@@ -175,7 +175,7 @@
 
 -- copy a file with known content to the log directory and see whether
 -- we get the correct results
-sh cp $$scriptsdir$$/udr/TEST002.sample_events $$TRAF_HOME$$/logs/master_exec_regr_999_99999.log;
+sh cp $$scriptsdir$$/udr/TEST002.sample_events $$TRAF_LOG$$/master_exec_regr_999_99999.log;
 
 select count(*) as num_events,
        max(log_file_line) as num_lines,
@@ -191,7 +191,7 @@
 order by log_file_line;
 -- lines 20, 30 and 31 have parse errors and are also displayed
 
-sh rm $$TRAF_HOME$$/logs/master_exec_regr_999_99999.log;
+sh rm $$TRAF_LOG$$/master_exec_regr_999_99999.log;
 
 -- some negative test cases
 prepare s from select * from udf(event_log_reader(10));
diff --git a/core/sql/regress/udr/Utils.java b/core/sql/regress/udr/Utils.java
index c48846a..53c747c 100644
--- a/core/sql/regress/udr/Utils.java
+++ b/core/sql/regress/udr/Utils.java
@@ -44,7 +44,7 @@
    static boolean log = false;
    static String logFileName = "udr_tools.log";
    static String logLocation = null;
-   static String sqRoot = null;
+   static String sqLogs = null;
    static String userName = null;
 
    Utils () 
@@ -53,8 +53,8 @@
        log = Boolean.getBoolean("debugOn");
      
      if (log) { 
-       sqRoot = System.getenv("TRAF_HOME");
-       logLocation = sqRoot + "/logs/";
+       sqLogs = System.getenv("TRAF_LOG");
+       logLocation = sqLogs + "/";
      }
    }
 
diff --git a/core/sql/runtimestats/SqlStats.cpp b/core/sql/runtimestats/SqlStats.cpp
index 3fcf9d3..58f8eb4 100644
--- a/core/sql/runtimestats/SqlStats.cpp
+++ b/core/sql/runtimestats/SqlStats.cpp
@@ -194,17 +194,15 @@
   }
 }
 
-void StatsGlobals::addProcess(pid_t pid, NAHeap *heap)
+bool StatsGlobals::addProcess(pid_t pid, NAHeap *heap)
 {
+  bool pidReincarnated = false;
   if (pid >= configuredPidMax_)
-     return;
+     return pidReincarnated;
   char msg[256];;
   if (statsArray_[pid].processStats_ != NULL)
   {
-    snprintf(msg, sizeof(msg),
-        "Pid %d,%d got recycled soon or SSMP didn't receive the death message ",
-           cpu_, pid);
-    SQLMXLoggingArea::logExecRtInfo(__FILE__, __LINE__, msg, 0);
+    pidReincarnated = true;
     removeProcess(pid, TRUE);
   }   
   statsArray_[pid].processId_ = pid;
@@ -214,7 +212,7 @@
   incProcessStatsHeaps();
   if (pid > maxPid_)
      maxPid_ = pid;
-  return;
+  return pidReincarnated;
 }
 
 void StatsGlobals::removeProcess(pid_t pid, NABoolean calledAtAdd)
@@ -304,6 +302,8 @@
   error = getStatsSemaphore(ssmpProcSemId_, myPid);
 
   int pidRemainingToCheck = 20;
+  pid_t pidsRemoved[pidRemainingToCheck]; 
+  int numPidsRemoved = 0;
   pid_t firstPid = pidToCheck_;
   for (;maxPid_ > 0;)
   {
@@ -326,11 +326,16 @@
       Int32 ln_error = msg_mon_get_process_name(
                        cpu_, statsArray_[pidToCheck_].processId_, 
                        processName);
-      if (ln_error == XZFIL_ERR_NOSUCHDEV) 
-        removeProcess(pidToCheck_);
+      if (ln_error == XZFIL_ERR_NOSUCHDEV)  {
+         pidsRemoved[numPidsRemoved++]; 
+         removeProcess(pidToCheck_);
+      }
     }
   }
   releaseStatsSemaphore(ssmpProcSemId_, myPid);
+  // death messages are logged outside of semaphore due to process hop
+  for (int i = 0 ; i < numPidsRemoved ; i++) 
+      logProcessDeath(cpu_, pidsRemoved[i], "Dead Process");
 }
 
 // We expect a death message to be delivered to MXSSMP by the monitor
@@ -340,48 +345,55 @@
 // be unexpectedly holding the stats semaphore.  
 
 static Int32 SemHeldTooManySeconds = -1;
+static bool dumpRmsDeadLockProcess = true;
 
 void StatsGlobals::cleanupDanglingSemaphore(NABoolean checkForSemaphoreHolders)
 {
   CliGlobals *cliGlobals = GetCliGlobals();
   NABoolean cleanupSemaphore = FALSE;
+  char coreFile[512];
   if (semPid_ == -1)
-    return; // Nobody has the semaphore, nothing to do here.
+     return; // Nobody has the semaphore, nothing to do here.
     
   if (NOT (cliGlobals->myPin() == getSsmpPid()
           && cliGlobals->myStartTime() == getSsmpTimestamp()))
-    return; // Only ssmp is allowed to cleanup after another process.
+     return; // Only ssmp is allowed to cleanup after another process.
 
   // Coverage notes - it would be too difficult to automate a test
   // for this since usually a death message is used to clean up a
   // generic SQL process' exit.  But this code has been unit tested
   // using gdb sessions on the generic process and on this MXSSMP
   // process.
-    if (checkForSemaphoreHolders)
-    {
-       if (SemHeldTooManySeconds < 0)
-       {
-          // call getenv once per process
-          char *shtms = getenv("MXSSMP_SEM_RELEASE_SECONDS");
-          if (shtms)
-          {
-             SemHeldTooManySeconds = str_atoi(shtms, str_len(shtms));
-             if (SemHeldTooManySeconds < 1)
-                SemHeldTooManySeconds = 10;
-           }
-           else
+  Int32 lockedTimeInSecs = 0;
+  timespec ts;
+  if (SemHeldTooManySeconds < 0)
+  {
+     // call getenv once per process
+     char *shtms = getenv("MXSSMP_SEM_RELEASE_SECONDS");
+     if (shtms)
+     {
+        SemHeldTooManySeconds = str_atoi(shtms, str_len(shtms));
+        if (SemHeldTooManySeconds < 1)
            SemHeldTooManySeconds = 10;
-        }
-
-        timespec ts;
-        clock_gettime(CLOCK_REALTIME, &ts);
-        if ((ts.tv_sec - lockingTimestamp_.tv_sec) >= SemHeldTooManySeconds)
-           cleanupSemaphore  = TRUE;
-    }
-    else
-        cleanupSemaphore = TRUE;
-    if (cleanupSemaphore)
-    {
+     }
+     else
+        SemHeldTooManySeconds = 10;
+     char *dumpRmsDeadLockProcessEnv = getenv("RMS_DEADLOCK_PROCESS_DUMP");
+     if ((dumpRmsDeadLockProcessEnv != NULL) &&
+         (strcmp(dumpRmsDeadLockProcessEnv, "N") == 0))
+           dumpRmsDeadLockProcess = false;
+  }
+  clock_gettime(CLOCK_REALTIME, &ts);
+  lockedTimeInSecs = ts.tv_sec - lockingTimestamp_.tv_sec;
+  if (checkForSemaphoreHolders) 
+  { 
+     if (lockedTimeInSecs >= SemHeldTooManySeconds)
+        cleanupSemaphore  = TRUE;
+  }
+  else
+     cleanupSemaphore = TRUE;
+  if (cleanupSemaphore) 
+  {
       NAProcessHandle myPhandle;
       myPhandle.getmine();
       myPhandle.decompose();
@@ -398,6 +410,16 @@
       }
       else
       {
+         char msg[256];
+         if (semPid_ != -1 && lockedTimeInSecs >= SemHeldTooManySeconds) {
+            snprintf(msg, sizeof(msg), "Pid %d, %d held semaphore for more than %d seconds ",
+                      cpu_, semPid_, lockedTimeInSecs); 
+            SQLMXLoggingArea::logExecRtInfo(__FILE__, __LINE__, msg, 0);
+            if (dumpRmsDeadLockProcess)
+                msg_mon_dump_process_id(NULL, cpu_, semPid_, coreFile);
+         }
+         
+/*
         // Is this the same incarnation of the process name?
         // Do not be fooled by pid recycle.
         MS_Mon_Process_Info_Type processInfo;
@@ -411,6 +433,7 @@
           seabedPidRecycle_ = true;
           semHoldingProcessExists = false;
         }
+*/
       }
       if (!semHoldingProcessExists)
       {
@@ -1483,16 +1506,22 @@
 
   removeProcess(pidToCleanup);
   releaseStatsSemaphore(semId, myPid);
+  logProcessDeath(cpu_, pidToCleanup, "Clean dangling semaphore");
 }
 
 void StatsGlobals::verifyAndCleanup(pid_t pidThatDied, SB_Int64_Type seqNum)
 {
+  bool processRemoved = false;
   int error = getStatsSemaphore(ssmpProcSemId_, getSsmpPid());
   if (statsArray_ && 
       (statsArray_[pidThatDied].processId_ == pidThatDied) &&
-      (statsArray_[pidThatDied].phandleSeqNum_ == seqNum))
-    removeProcess(pidThatDied);
+      (statsArray_[pidThatDied].phandleSeqNum_ == seqNum)) {
+     removeProcess(pidThatDied);
+     processRemoved = true;
+  }
   releaseStatsSemaphore(ssmpProcSemId_, getSsmpPid());
+  if (processRemoved)
+     logProcessDeath(cpu_, pidThatDied, "Received death message");
 }
 
 void StatsGlobals::updateMemStats(pid_t pid, 
@@ -1631,6 +1660,16 @@
    return retcode; 
 }
 
+void StatsGlobals::logProcessDeath(short cpu, pid_t pid, const char *reason)
+{
+   char msg[256];
+
+   snprintf(msg, sizeof(msg),
+        "Pid %d,%d de-registered from shared segment. Reason: %s ", cpu, pid, reason);
+   SQLMXLoggingArea::logExecRtInfo(__FILE__, __LINE__, msg, 0);
+   return;
+}
+
 short getMasterCpu(char *uniqueStmtId, Lng32 uniqueStmtIdLen, char *nodeName, short maxLen, short &cpu)
 {
   Int32 nodeNumber = 0;
diff --git a/core/sql/runtimestats/SqlStats.h b/core/sql/runtimestats/SqlStats.h
index 1cfc18f..77721ec 100644
--- a/core/sql/runtimestats/SqlStats.h
+++ b/core/sql/runtimestats/SqlStats.h
@@ -329,7 +329,7 @@
 public:
   StatsGlobals(void *baseAddr, short envType, Lng32 maxSegSize);
   static void* operator new (size_t size, void* loc = 0);
-  void addProcess(pid_t pid, NAHeap *heap);
+  bool addProcess(pid_t pid, NAHeap *heap);
   void removeProcess(pid_t pid, NABoolean calledDuringAdd = FALSE);
   ProcessStats *checkProcess(pid_t pid);
   void setStatsArea(pid_t pid, ExStatisticsArea *stats)
@@ -346,6 +346,8 @@
       return NULL;
   }
 
+  void logProcessDeath(short cpu, pid_t pid, const char *reason);
+
   StmtStats *addQuery(pid_t pid, char *queryId, Lng32 queryIdLen, void *backRef,
                      Lng32 fragId, char *sourceStr = NULL, Lng32 sourceStrLen = 0,
                      NABoolean isMaster = FALSE);
diff --git a/core/sql/runtimestats/sscpipc.cpp b/core/sql/runtimestats/sscpipc.cpp
index ccb8dbb..8ec84ef 100755
--- a/core/sql/runtimestats/sscpipc.cpp
+++ b/core/sql/runtimestats/sscpipc.cpp
@@ -93,7 +93,9 @@
        NAHeap("Process Stats Heap", statsGlobals_->getStatsHeap(),
                8192,
                0);
-  statsGlobals_->addProcess(myPin_, statsHeap);
+  bool reincarnated = statsGlobals_->addProcess(myPin_, statsHeap);
+  if (reincarnated)
+     statsGlobals_->logProcessDeath(myCpu, myPin_, "Process reincarnated before RIP");
 
   statsGlobals_->releaseStatsSemaphore(semId_, myPin_);
   CliGlobals *cliGlobals = GetCliGlobals();
diff --git a/core/sql/sqlcomp/CmpMain.cpp b/core/sql/sqlcomp/CmpMain.cpp
index 650d181..da25eaf 100644
--- a/core/sql/sqlcomp/CmpMain.cpp
+++ b/core/sql/sqlcomp/CmpMain.cpp
@@ -454,6 +454,7 @@
     int ret = dlclose(dlptr);
     dlptr = NULL;
     CmpMain::msGui_ = NULL;
+    CmpMain::pExpFuncs_ = NULL;
   }	
 
   CURRENTSTMT->clearDisplayGraph();
@@ -2566,7 +2567,7 @@
 
         if (((RelRoot *)queryExpr)->getDisplayTree() && CmpMain::msGui_ == CmpCommon::context() )
           {
-            if (CmpMain::pExpFuncs_->fpDisplayExecution())
+            if (CmpMain::pExpFuncs_->fpExecutionDisplayIsEnabled())
               {
                 //------------------------------------------------------------
                 // GSH: User has set a breakpoint for display in execution
@@ -2575,7 +2576,7 @@
                 //------------------------------------------------------------
 		ComTdbRoot * originalRootTdb =
 		  (ComTdbRoot *) generator.getFragmentDir()->getTopObj(0);
-                originalRootTdb->setDisplayExecution(2);
+                originalRootTdb->setDisplayExecution(1);
               }
             else
               {
@@ -2586,6 +2587,7 @@
                 NADELETEBASIC(cb, heap);
                 *gen_code = 0;
                 *gen_code_len = 0;
+                *CmpCommon::diags() << DgSqlCode(1032);
                 retval = DISPLAYDONE;
               }
         } // display TCB tree
@@ -2846,7 +2848,7 @@
         {
            GetExportedFunctions = (fpGetSqlcmpdbgExpFuncs) dlsym(dlptr, "GetSqlcmpdbgExpFuncs");
            if (GetExportedFunctions)
-                CmpMain::pExpFuncs_ = GetExportedFunctions();
+             CmpMain::pExpFuncs_ = GetExportedFunctions();
            if ( CmpMain::pExpFuncs_ == NULL )
            {
               int ret = dlclose(dlptr);
@@ -2855,7 +2857,9 @@
         }
         else // dlopen() failed 
         { 
-           char *msg = dlerror(); 
+           char *msg = dlerror();
+           *CmpCommon::diags() << DgSqlCode(-2245)
+                               << DgString0(msg);
         }
         if ( dlptr == NULL )
            CmpMain::msGui_ = NULL ;  //This Compiler Instance cannot use debugger
@@ -2894,6 +2898,8 @@
         else // dlopen() failed 
         { 
            char *msg = dlerror(); 
+           *CmpCommon::diags() << DgSqlCode(-2245)
+                               << DgString0(msg);
         }
         if ( dlptr == NULL )
            CmpMain::msGui_ = NULL ;  //This Compiler Instance cannot use debugger
@@ -2917,12 +2923,11 @@
         }
 
       // Pass information about the plan to be displayed to the GUI:
-      expFuncs->fpSqldbgSetPointers(CURRSTMT_OPTGLOBALS->memo
-                                      ,CURRSTMT_OPTGLOBALS->task_list
-                                      ,QueryAnalysis::Instance()
-                                      ,cmpCurrentContext
-                                      ,gpClusterInfo
-                                      );
+      expFuncs->fpSqldbgSetCmpPointers(CURRSTMT_OPTGLOBALS->memo,
+                                       CURRSTMT_OPTGLOBALS->task_list,
+                                       QueryAnalysis::Instance(),
+                                       cmpCurrentContext,
+                                       gpClusterInfo);
 } // initializeGUIData(...)
 
 #endif
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLauth.cpp b/core/sql/sqlcomp/CmpSeabaseDDLauth.cpp
index 3c9939d..d4a2038 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLauth.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLauth.cpp
@@ -246,9 +246,24 @@
   }
 }
 
+// ----------------------------------------------------------------------------
+// public method:  getRoleIDs
+//
+// Return the list of roles that granted to the passed in authID
+//
+// Input:
+//    authID - the database authorization ID to search for
+//
+//  Output:
+//    A returned parameter:
+//       STATUS_GOOD: list of roles returned
+//       STATUS_NOTFOUND: no roles were granted
+//       STATUS_ERROR: error was returned, diags area populated
+// ----------------------------------------------------------------------------
 CmpSeabaseDDLauth::AuthStatus CmpSeabaseDDLauth::getRoleIDs(
   const Int32 authID,
-  std::vector<int32_t> &roleIDs)
+  std::vector<int32_t> &roleIDs,
+  std::vector<int32_t> &grantees)
 {
   NAString privMgrMDLoc;
   CONCAT_CATSCH(privMgrMDLoc,systemCatalog_.data(),SEABASE_PRIVMGR_SCHEMA);
@@ -257,11 +272,13 @@
                     std::string(privMgrMDLoc.data()),
                     CmpCommon::diags());
   std::vector<std::string> roleNames;
-  std::vector<int32_t> roleDepths;
+  std::vector<int32_t> grantDepths;
 
-  if (role.fetchRolesForUser(authID,roleNames,roleIDs,roleDepths) == PrivStatus::STATUS_ERROR)
+  if (role.fetchRolesForAuth(authID,roleNames,roleIDs,grantDepths,grantees) == PrivStatus::STATUS_ERROR)
     return STATUS_ERROR;
-  return STATUS_GOOD; 
+
+  assert (roleIDs.size() == grantees.size());
+  return STATUS_GOOD;
 }
 
 // ----------------------------------------------------------------------------
@@ -1820,16 +1837,15 @@
       std::vector<std::string> granteeNames;
       std::vector<int32_t> grantDepths;
       std::vector<int32_t> grantorIDs;
-      
-      PrivStatus privStatus = PrivStatus::STATUS_GOOD;
-      
-      privStatus = roles.fetchUsersForRole(getAuthID(),granteeNames,
-                                           grantorIDs,grantDepths);
-      
-      // If no users were granted this role, nothing to do.                                     
+
+
+      PrivStatus privStatus = roles.fetchGranteesForRole(getAuthID() ,granteeNames,
+                                                         grantorIDs,grantDepths);
+
+      // If nobody was granted this role, nothing to do.                                     
       if (privStatus == PrivStatus::STATUS_NOTFOUND || granteeNames.size() == 0)
          return true;
-         
+
       if (privStatus == PrivStatus::STATUS_ERROR)                                   
          SEABASEDDL_INTERNAL_ERROR("Could not fetch users granted role.");
          
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLauth.h b/core/sql/sqlcomp/CmpSeabaseDDLauth.h
index fbfe354..d451fb7 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLauth.h
+++ b/core/sql/sqlcomp/CmpSeabaseDDLauth.h
@@ -78,7 +78,8 @@
      virtual bool describe       (const NAString &authName, 
                                     NAString &authText);
      AuthStatus   getRoleIDs     (const Int32 authID,
-                                    std::vector<int32_t> &roleIDs);
+                                    std::vector<int32_t> &roleIDs,
+                                    std::vector<int32_t> &granteeIDs);
      NAString     getObjectName  (const std::vector <int64_t> objectUIDs);
 
      // accessors
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
index 3569b90..ffe995d 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
@@ -12613,23 +12613,20 @@
 
   // Summarize privileges for object
   PrivStatus privStatus = STATUS_GOOD;
-  std::vector<PrivMgrDesc> privDescs;
+  ComTdbVirtTablePrivInfo *privInfo = new (heap_) ComTdbVirtTablePrivInfo();
+  privInfo->privmgr_desc_list = new (STMTHEAP) PrivMgrDescList(STMTHEAP);
+
+  // Summarize privileges for object
   PrivMgrCommands command(std::string(MDLoc.data()),
                           std::string(privMgrMDLoc.data()),
                           CmpCommon::diags());
-  if (command.getPrivileges(objUID, objType, privDescs) != STATUS_GOOD)
+  if (command.getPrivileges(objUID, objType,
+                            *privInfo->privmgr_desc_list) != STATUS_GOOD)
     {
       *CmpCommon::diags() << DgSqlCode(-CAT_UNABLE_TO_RETRIEVE_PRIVS);
       return NULL;
     }
 
-  ComTdbVirtTablePrivInfo *privInfo = new (STMTHEAP) ComTdbVirtTablePrivInfo();
-
-  // PrivMgrDesc operator= is a deep copy
-  privInfo->privmgr_desc_list = new (STMTHEAP) NAList<PrivMgrDesc>(STMTHEAP);
-  for (size_t i = 0; i < privDescs.size(); i++)
-    privInfo->privmgr_desc_list->insert(privDescs[i]);
-
   return privInfo;
 }
 
diff --git a/core/sql/sqlcomp/DefaultConstants.h b/core/sql/sqlcomp/DefaultConstants.h
index de79a27..09ac553 100644
--- a/core/sql/sqlcomp/DefaultConstants.h
+++ b/core/sql/sqlcomp/DefaultConstants.h
@@ -383,7 +383,7 @@
   DYN_QUEUE_RESIZE_INIT_DOWN,
   DYN_QUEUE_RESIZE_INIT_UP,
   DYN_QUEUE_RESIZE_LIMIT,
-
+  DYN_QUEUE_RESIZE_OVERRIDE,
   // -------------------------------------------------------------------------
   // Enable 'ON' or disable 'OFF' considering hash joins of any form
   // -------------------------------------------------------------------------
@@ -2115,7 +2115,6 @@
   GEN_ONLJ_SET_QUEUE_RIGHT,
   GEN_ONLJ_SET_QUEUE_LEFT,
 
-
   
   SORT_REC_THRESHOLD,
   SORT_MERGE_BUFFER_UNIT_56KB,
@@ -2946,6 +2945,12 @@
   // this is used to change cache size of sequence numbers for a session.
   // It overwrites the cache size that was specified during sequence creation.
   TRAF_SEQUENCE_CACHE_SIZE,
+ 
+  // this is used to set the retry time if two concurrent update of sequence
+  // conflict, and how many times will retry
+  // by default it is 100, when you saw error 1583, you can try to increase
+  // this settings
+  TRAF_SEQUENCE_RETRY_TIMES,
 
   TRAF_LOAD_MAX_HFILE_SIZE,
 
diff --git a/core/sql/sqlcomp/PrivMgr.cpp b/core/sql/sqlcomp/PrivMgr.cpp
index 0a5f265..1920b37 100644
--- a/core/sql/sqlcomp/PrivMgr.cpp
+++ b/core/sql/sqlcomp/PrivMgr.cpp
@@ -36,6 +36,7 @@
 #include "PrivMgrComponentOperations.h"
 #include "PrivMgrComponentPrivileges.h"
 #include "PrivMgrPrivileges.h"
+#include "PrivMgrRoles.h"
 
 // Trafodion includes
 #include "ComDistribution.h"
@@ -154,6 +155,42 @@
   resetFlags();
 }
 
+// *****************************************************************************
+// * Method: getGranteeIDsForRoleIDs                              
+// *                                                       
+// *    Returns the grantees assigned to the passed in roles
+// *    role list
+// *                                                       
+// *  Parameters:    
+// *                                                                       
+// *  <roleIDs>    list of roles to check
+// *  <granteeIDs> passed back the list (potentially empty) of users granted to 
+// *               the roleIDs
+// *                                                                     
+// * Returns: PrivStatus                                               
+// *                                                                  
+// * STATUS_GOOD: Role list returned
+// *           *: Unable to fetch granted roles, see diags.     
+// *                                                               
+// *****************************************************************************
+PrivStatus PrivMgr::getGranteeIDsForRoleIDs(
+  const std::vector<int32_t>  & roleIDs,
+  std::vector<int32_t> & granteeIDs,
+  bool includeSysGrantor)
+{
+  std::vector<int32_t> granteeIDsForRoleIDs;
+  PrivMgrRoles roles(" ",metadataLocation_,pDiags_);
+  if (roles.fetchGranteesForRoles(roleIDs, granteeIDsForRoleIDs, includeSysGrantor) == STATUS_ERROR)
+    return STATUS_ERROR;
+  for (size_t i = 0; i < granteeIDsForRoleIDs.size(); i++)
+  {
+     int32_t authID = granteeIDsForRoleIDs[i];
+     if (std::find(granteeIDs.begin(), granteeIDs.end(), authID) == granteeIDs.end())
+       granteeIDs.insert( std::upper_bound( granteeIDs.begin(), granteeIDs.end(), authID ), authID);
+  }
+  return STATUS_GOOD;
+}
+
 // ----------------------------------------------------------------------------
 // method:  authorizationEnabled
 //
@@ -1068,7 +1105,7 @@
 //   QRLogger generates a message calls the log method in 
 //      sqf/commonLogger/CommonLogger (.h & .cpp) 
 //   CommonLogger interfaces with the log4cxx code which eventually puts
-//      a message into a log file called ../sqf/logs/master_exec_0_pid.log.  
+//      a message into a log file called $TRAF_LOG/master_exec_0_pid.log.  
 //      A new master log is created for each new SQL process started.
 //
 // Sometimes it is amazing that things actually work with all these levels
diff --git a/core/sql/sqlcomp/PrivMgr.h b/core/sql/sqlcomp/PrivMgr.h
index fd6b8bd..0cd52ce 100644
--- a/core/sql/sqlcomp/PrivMgr.h
+++ b/core/sql/sqlcomp/PrivMgr.h
@@ -168,6 +168,11 @@
     // -------------------------------------------------------------------
     // Accessors and destructors:
     // -------------------------------------------------------------------
+    PrivStatus getGranteeIDsForRoleIDs(
+      const std::vector<int32_t> & roleIDs,
+      std::vector<int32_t> & userIDs,
+      bool includeSysGrantor = true);
+
     inline std::string getMetadataLocation (void) {return metadataLocation_;}
     inline const std::string & getMetadataLocation (void) const {return metadataLocation_;}
     inline std::string getTrafMetadataLocation (void) {return trafMetadataLocation_;}
diff --git a/core/sql/sqlcomp/PrivMgrCommands.cpp b/core/sql/sqlcomp/PrivMgrCommands.cpp
index 05aaec9..b80b77c 100644
--- a/core/sql/sqlcomp/PrivMgrCommands.cpp
+++ b/core/sql/sqlcomp/PrivMgrCommands.cpp
@@ -41,6 +41,7 @@
 #include "PrivMgrRoles.h"
 #include "ComSecurityKey.h"
 #include "ComUser.h"
+#include "CmpSeabaseDDL.h"
 #include <cstdio>
 #include <algorithm>
 
@@ -396,48 +397,74 @@
   NATable *naTable,
   const int32_t userID,
   PrivMgrUserPrivs &userPrivs,
-  std::vector <ComSecurityKey *>* secKeySet)
+  ComSecurityKeySet *secKeySet)
 {
   PrivMgrDesc privsOfTheUser;
+  PrivStatus retcode = STATUS_GOOD;
 
   // authorization is not enabled, return bitmaps with all bits set
   // With all bits set, privilege checks will always succeed
   if (!authorizationEnabled())
   {
-    privsOfTheUser.setAllTableGrantPrivileges(true);
+    privsOfTheUser.setAllTableGrantPrivileges(true /*priv*/, true/*wgo*/);
     userPrivs.initUserPrivs(privsOfTheUser);
     return STATUS_GOOD;
   }
 
-  // if a hive table and does not have an external table and is not
-  // registered in traf metadata, assume no privs
-  if ((naTable->isHiveTable()) && 
-      (NOT naTable->isRegistered()) &&
-      (!naTable->hasExternalTable()))
+  // if a native table that is not registered nor has an external table
+  // assume no privs.  No privileges, so no security keys are required
+  else if ((naTable->isHiveTable() ||
+            naTable->isHbaseCellTable() ||
+            naTable->isHbaseRowTable()) &&
+           (!naTable->isRegistered() && !naTable->hasExternalTable()))
   {
     PrivMgrDesc emptyDesc;
     userPrivs.initUserPrivs(emptyDesc);
   }
 
-  // if an hbase table and is not registered, assume no privs
- else if ((naTable->isHbaseCellTable() || naTable->isHbaseRowTable()) &&
-          (!naTable->hasExternalTable() && !naTable->isRegistered()))
-  {
-    PrivMgrDesc emptyDesc;
-    userPrivs.initUserPrivs(emptyDesc);
-  }
+  // Check for privileges defined in Trafodion metadata
   else
   {
-    PrivMgrPrivileges objectPrivs (metadataLocation_, pDiags_);
-    PrivStatus retcode = objectPrivs.getPrivsOnObjectForUser((int64_t)naTable->objectUid().get_value(),
-                                                             naTable->getObjectType(),
-                                                             userID,
-                                                             privsOfTheUser,
-                                                             secKeySet);
-    if (retcode != STATUS_GOOD)
-      return retcode;
+    int64_t objectUID = (int64_t)naTable->objectUid().get_value();
 
-    userPrivs.initUserPrivs(privsOfTheUser);
+    // If we are not storing privileges for the object in NATable, go read MD
+    if (naTable->getPrivDescs() == NULL)
+    {
+      PrivMgrPrivileges objectPrivs (metadataLocation_, pDiags_);
+      retcode = objectPrivs.getPrivsOnObjectForUser(objectUID,
+                                                    naTable->getObjectType(),
+                                                    userID,
+                                                    privsOfTheUser);
+      if (retcode != STATUS_GOOD)
+        return retcode;
+
+      userPrivs.initUserPrivs(privsOfTheUser);
+
+      if (secKeySet != NULL)
+      {
+        // The PrivMgrDescList destructor deletes memory
+        PrivMgrDescList descList(naTable->getHeap());
+        PrivMgrDesc *tableDesc = new (naTable->getHeap()) PrivMgrDesc(privsOfTheUser);
+        descList.insert(tableDesc);
+        if (!userPrivs.setPrivInfoAndKeys(descList, userID, objectUID, secKeySet))
+        {
+          SEABASEDDL_INTERNAL_ERROR("Could not create security keys");
+          return STATUS_ERROR;
+        }
+      }
+    }
+
+    // generate privileges from the stored desc list 
+    else
+    {
+      NAList<int32_t> roleIDs (naTable->getHeap());
+      if (ComUser::getCurrentUserRoles(roleIDs) != 0)
+        return STATUS_ERROR;
+
+      if (userPrivs.initUserPrivs(roleIDs, naTable->getPrivDescs(),
+                                  userID, objectUID, secKeySet) == STATUS_ERROR)
+        return retcode;
+    }
   }
 
   return STATUS_GOOD;
@@ -464,15 +491,26 @@
 PrivStatus PrivMgrCommands::getPrivileges(
   const int64_t objectUID,
   ComObjectType objectType,
-  std::vector <PrivMgrDesc > &privDescs)
+  PrivMgrDescList &privDescs)
 {
-  // If authorization is enabled, go get privilege bitmaps from metadata
+  PrivStatus retcode = STATUS_GOOD;
   if (authorizationEnabled())
   {
+    std::vector<PrivMgrDesc> privDescList;
+
     PrivMgrPrivileges privInfo (objectUID, metadataLocation_, pDiags_);
-    return privInfo.getPrivsOnObject(objectType, privDescs);
+    retcode = privInfo.getPrivsOnObject(objectType, privDescList);
+    if (retcode == STATUS_ERROR)
+      return STATUS_ERROR;
+
+    // copy privDescList to privDescs
+    for (size_t i = 0; i < privDescList.size(); i++)
+    {
+      PrivMgrDesc *desc = new (privDescs.getHeap()) PrivMgrDesc(privDescList[i]);
+      privDescs.insert(desc);
+    }
   }
-  return STATUS_GOOD;
+  return retcode;
 }
 
 
@@ -496,8 +534,7 @@
   const int64_t objectUID,
   ComObjectType objectType,
   const int32_t userID,
-  PrivMgrUserPrivs &userPrivs,
-  std::vector <ComSecurityKey *>* secKeySet)
+  PrivMgrUserPrivs &userPrivs)
 {
   PrivMgrDesc privsOfTheUser;
 
@@ -508,8 +545,7 @@
     PrivStatus retcode = objectPrivs.getPrivsOnObjectForUser(objectUID,
                                                              objectType,
                                                              userID,
-                                                             privsOfTheUser,
-                                                             secKeySet);
+                                                             privsOfTheUser);
     if (retcode != STATUS_GOOD)
       return retcode;
   }
@@ -524,34 +560,6 @@
   return STATUS_GOOD;
 }
 
-// ----------------------------------------------------------------------------
-// method: getRoles
-//
-// Returns roleIDs for the grantee.
-//                                                                       
-//  <granteeID> the authorization ID to obtain roles for
-//  <roleIDs> is the returned list of roles
-//                                                                  
-// Returns: PrivStatus                                               
-//                                                                  
-//   STATUS_GOOD: role list was built
-//             *: unexpected error occurred, see diags.     
-// ----------------------------------------------------------------------------
-PrivStatus PrivMgrCommands::getRoles(
-  const int32_t granteeID,
-  std::vector <int32_t > &roleIDs)
-{
-  // If authorization is not enabled, return
-  if (!authorizationEnabled())
-    return STATUS_GOOD;
-  
-  PrivMgrRoles roles(" ",metadataLocation_,pDiags_);
-  std::vector<std::string> roleNames;
-  std::vector<int32_t> roleDepths;
-
-  return  roles.fetchRolesForUser(granteeID,roleNames,roleIDs,roleDepths);
-}
-
 // *****************************************************************************
 // *                                                                           *
 // * Function: PrivMgrCommands::getPrivRowsForObject                           *
diff --git a/core/sql/sqlcomp/PrivMgrCommands.h b/core/sql/sqlcomp/PrivMgrCommands.h
index 312cbab..e5275b6 100644
--- a/core/sql/sqlcomp/PrivMgrCommands.h
+++ b/core/sql/sqlcomp/PrivMgrCommands.h
@@ -119,28 +119,23 @@
       NATable *naTable,
       const int32_t granteeUID,
       PrivMgrUserPrivs &userPrivileges,
-      std::vector <ComSecurityKey *>* secKeySet = NULL);
+      NASet<ComSecurityKey> *secKeySet = NULL);
 
    PrivStatus getPrivileges(
       const int64_t objectUID,
       ComObjectType objectType,
-      std::vector<PrivMgrDesc> &userPrivileges);
-     
+      PrivMgrDescList &userPrivileges);
+
    PrivStatus getPrivileges(
       const int64_t objectUID,
       ComObjectType objectType,
       const int32_t granteeUID,
-      PrivMgrUserPrivs &userPrivileges,
-      std::vector <ComSecurityKey *>* secKeySet = NULL);
-     
+      PrivMgrUserPrivs &userPrivileges);
+
    PrivStatus getPrivRowsForObject(
       const int64_t objectUID,
       std::vector<ObjectPrivsRow> & objectPrivsRows);
       
-   PrivStatus getRoles(
-      const int32_t grantee,
-      std::vector<int32_t> &roleIDs);
-
    PrivStatus givePrivForObjects(
          const int32_t currentOwnerID,
          const int32_t newOwnerID,
diff --git a/core/sql/sqlcomp/PrivMgrComponentPrivileges.cpp b/core/sql/sqlcomp/PrivMgrComponentPrivileges.cpp
index 257a123..9c85ffe 100644
--- a/core/sql/sqlcomp/PrivMgrComponentPrivileges.cpp
+++ b/core/sql/sqlcomp/PrivMgrComponentPrivileges.cpp
@@ -1299,11 +1299,13 @@
       std::vector<std::string> roleNames;
       std::vector<int32_t> roleIDs;
       std::vector<int32_t> grantDepths;
+      std::vector<int32_t> grantees;
       
       PrivMgrRoles roles(" ",metadataLocation_,pDiags_);
       
-      PrivStatus privStatus = roles.fetchRolesForUser(authID,roleNames,
-                                                      roleIDs,grantDepths);
+      PrivStatus privStatus = roles.fetchRolesForAuth(authID,roleNames,
+                                                      roleIDs,grantDepths,
+                                                      grantees);
       
       for (size_t r = 0; r < roleIDs.size(); r++)
       {
@@ -1379,11 +1381,13 @@
    std::vector<std::string> roleNames;
    std::vector<int32_t> roleIDs;
    std::vector<int32_t> grantDepths;
+   std::vector<int32_t> grantees;
 
    PrivMgrRoles roles(" ",metadataLocation_,pDiags_);
 
-   if (roles.fetchRolesForUser(authID,roleNames,
-                               roleIDs,grantDepths) == STATUS_ERROR)
+   if (roles.fetchRolesForAuth(authID,roleNames,
+                               roleIDs,grantDepths, 
+                               grantees) == STATUS_ERROR)
       return false;
 
    MyTable &myTable = static_cast<MyTable &>(myTable_);
diff --git a/core/sql/sqlcomp/PrivMgrDesc.cpp b/core/sql/sqlcomp/PrivMgrDesc.cpp
index ec55129..3cfaf72 100644
--- a/core/sql/sqlcomp/PrivMgrDesc.cpp
+++ b/core/sql/sqlcomp/PrivMgrDesc.cpp
@@ -120,109 +120,6 @@
   }
 }
 
-// Set all privilege indicators for Grant to Table
-// (Sel/Ins/Upd/Del/Ref only) (Sets these "priv" to True,
-//  with wgo indicators set as specified).
-//   If updatable=False, suppress Insert,Delete,Update.
-//   If insertable=False, suppress Insert.
-void PrivMgrCoreDesc::setAllDMLGrantPrivileges(const bool wgo,
-                                        const bool updatable,
-                                        const bool insertable,
-                                        const bool deletable)
-{
-  this->setPriv(SELECT_PRIV, true);
-  this->setWgo(SELECT_PRIV, wgo);
-
-  if (updatable)
-   {
-      this->setPriv(UPDATE_PRIV, true);
-      this->setWgo(UPDATE_PRIV, wgo);
-      this->setPriv(REFERENCES_PRIV, true);
-      this->setWgo(REFERENCES_PRIV, wgo);
-
-      if ( insertable)
-      {
-         this->setPriv(INSERT_PRIV, true);
-         this->setWgo(INSERT_PRIV, wgo);
-      }
-      if ( deletable )
-      {
-         this->setPriv(DELETE_PRIV, true);
-         this->setWgo(DELETE_PRIV, wgo);
-      }
-   }
-}
-
-void PrivMgrCoreDesc::setAllDDLGrantPrivileges(const bool wgo)
-
-{
-  this->setPriv(ALL_DDL, true);
-  this->setWgo (ALL_DDL, wgo);
-
-}
-
-/*
- * The following setAllRevoke.. functions are used to set a mask in revoking privileges.
- *
- * When grantOptionFor is specified, we set the wgo bits because we want to use the mask
- * in revoking the with grant option for those privileges.
- *
- * Otherwise, we set the priv bits because we want to use the mask to revoke those 
- * privileges.  
- *
-*/
-
-void PrivMgrCoreDesc::setAllDMLRevokePrivileges(const bool grantOption)
-{
-  if (grantOption)
-  {
-    //set all dml privs in wgo to true
-    //set all dml privs in priv to false
-    this->setPriv(ALL_DML, false);
-    this->setWgo(ALL_DML, true);
-  }
-  else
-  {
-    //set all dml privs in wgo to false
-    //set all dml privs in priv to true
-    this->setPriv(ALL_DML, true);
-    this->setWgo(ALL_DML, false);
-  }
- }
-
-void PrivMgrCoreDesc::setAllDDLRevokePrivileges(const bool grantOption)
-{
-  if (grantOption) 
-  {
-    //set all ddl privs in wgo to true
-    //set all ddl privs in priv to false
-    this->setPriv(ALL_DDL, false);
-    this->setWgo(ALL_DDL, true);
-  }
-  else 
-  {
-    //set all ddl privs in wgo to false
-    //set all ddl privs in priv to true
-    this->setPriv(ALL_DDL, true);
-    this->setWgo(ALL_DDL, false);
-  }
-}
-
-// Set all privilege indicators for Revoke.
-void PrivMgrCoreDesc::setAllRevokePrivileges(const bool grantOption)
-{
-  if (grantOption)
-  {
-     priv_.reset();   // For "Revoke Grant Option for.."
-     wgo_.set();     //   get priv=F, wgo=T.
-  }
-  else
-  {
-     priv_.set();    // For "Revoke ..."
-     wgo_.reset();    //   get priv=T, wgo=F.
-  }
-}
-
 // ----------------------------------------------------------------------------
 // method: setAllObjectGrantPrivilege
 //
@@ -233,33 +130,36 @@
 // Params:
 //     objectType - The type of object.  Based on the object type (e.g. table,
 //                  routine, sequence, etc.) all the relevant privs are set
+//     priv - privilege setting. If true, the corresponding priv bits are set.             
 //     wgo - WITH GRANT OPTION.  If true, the corresponding WGO bits are set.
 //
 // ---------------------------------------------------------------------------- 
-void PrivMgrCoreDesc::setAllObjectGrantPrivilege(
+void PrivMgrCoreDesc::setAllObjectPrivileges(
    const ComObjectType objectType,
+   const bool priv,
    const bool wgo)
 
 {
-
    switch (objectType)
    {
       case COM_BASE_TABLE_OBJECT:
-         setAllTableGrantPrivileges(wgo);
+         setAllTableGrantPrivileges(priv, wgo);
          break;
       case COM_LIBRARY_OBJECT:
-         setAllLibraryGrantPrivileges(wgo);
+         setAllLibraryGrantPrivileges(priv, wgo);
          break;
       case COM_SEQUENCE_GENERATOR_OBJECT:
-         setAllSequenceGrantPrivileges(wgo);
+         setAllSequenceGrantPrivileges(priv, wgo);
          break;
+      // all spjs, functions, and table_mapping functions 
+      // are USER_DEFINED_ROUTINE_OBJECT
       case COM_USER_DEFINED_ROUTINE_OBJECT:
-      case COM_STORED_PROCEDURE_OBJECT:
-         setAllUdrGrantPrivileges(wgo);
+      case COM_STORED_PROCEDURE_OBJECT: /*TBD: remove?*/
+         setAllUdrGrantPrivileges(priv, wgo);
          break;
       case COM_VIEW_OBJECT:
         // will reach here for native hive views
-         setAllTableGrantPrivileges(wgo);
+         setAllTableGrantPrivileges(priv, wgo);
          break;
       default:
          ; //TODO: internal error?
@@ -583,3 +483,4 @@
   return result;
 }
 
+
diff --git a/core/sql/sqlcomp/PrivMgrDesc.h b/core/sql/sqlcomp/PrivMgrDesc.h
index 13e83a2..d0e94d4 100644
--- a/core/sql/sqlcomp/PrivMgrDesc.h
+++ b/core/sql/sqlcomp/PrivMgrDesc.h
@@ -289,47 +289,50 @@
                 const bool value);
     void  setAllPrivAndWgo(const bool val);
 
-    void setAllDMLGrantPrivileges(const bool wgo,
-                                  const bool updatable=true,
-                                  const bool insertable=true,
-                                  const bool deletable=true);
-    void setAllDDLGrantPrivileges(const bool wgo);
-    void setAllObjectGrantPrivilege(const ComObjectType objectType,const bool wgo);
-    void setAllRevokePrivileges(const bool grantOptionFor);
-    void setAllDMLRevokePrivileges(const bool grantOptionFor);
-    void setAllDDLRevokePrivileges(const bool grantOption);
+    void setAllObjectPrivileges(
+      const ComObjectType objectType,
+      const bool priv,
+      const bool wgo);
    
-    inline void setAllLibraryGrantPrivileges(const bool wgo)
+    inline void setAllLibraryGrantPrivileges(
+      const bool priv,
+      const bool wgo)
     {
-      setPriv(UPDATE_PRIV, TRUE);
+      setPriv(UPDATE_PRIV, priv);
       setWgo(UPDATE_PRIV, wgo);
-      setPriv(USAGE_PRIV, TRUE);
+      setPriv(USAGE_PRIV, priv);
       setWgo(USAGE_PRIV, wgo);
     }
     
-    inline void setAllTableGrantPrivileges(const bool wgo)
+    inline void setAllTableGrantPrivileges(
+      const bool priv,
+      const bool wgo)
     {
-      setPriv(SELECT_PRIV, TRUE);
+      setPriv(SELECT_PRIV, priv);
       setWgo(SELECT_PRIV, wgo);
-      setPriv(INSERT_PRIV, TRUE);
+      setPriv(INSERT_PRIV, priv);
       setWgo(INSERT_PRIV, wgo);
-      setPriv(DELETE_PRIV, TRUE);
+      setPriv(DELETE_PRIV, priv);
       setWgo(DELETE_PRIV, wgo);
-      setPriv(UPDATE_PRIV, TRUE);
+      setPriv(UPDATE_PRIV, priv);
       setWgo(UPDATE_PRIV, wgo);
-      setPriv(REFERENCES_PRIV, TRUE);
+      setPriv(REFERENCES_PRIV, priv);
       setWgo(REFERENCES_PRIV, wgo);
     }
 
-    inline void setAllSequenceGrantPrivileges(const bool wgo)
+    inline void setAllSequenceGrantPrivileges(
+      const bool priv,
+      const bool wgo)
     {
-      setPriv(USAGE_PRIV, TRUE);
+      setPriv(USAGE_PRIV, priv);
       setWgo(USAGE_PRIV, wgo);
     }
 
-    inline void setAllUdrGrantPrivileges(const bool wgo)
+    inline void setAllUdrGrantPrivileges(
+      const bool priv,
+      const bool wgo)
     {
-      setPriv(EXECUTE_PRIV, TRUE);
+      setPriv(EXECUTE_PRIV, priv);
       setWgo(EXECUTE_PRIV, wgo);
     }
 
@@ -510,14 +513,6 @@
    bool       getOneTablePriv(const PrivType which) const;
    bool       getOneTableWgo(const PrivType which) const;
 
-   //bool       getOneColPriv(const PrivType which,
-   //                               const int32_t ordinal
-   //                              ) const;
-   //bool       getOneColWgo(const PrivType which,
-   //                              const int32_t ordinal
-   //                              ) const;
-   //PrivMgrCoreDesc&        getOneColOrdPriv(const int32_t ordinal) const;
-
    // Mutators
 
    void setGrantee(const int32_t&grantee) { grantee_ = grantee; }
@@ -525,58 +520,52 @@
    void resetTablePrivs() { tableLevel_.setAllPrivAndWgo(0); }
    void setColumnPrivs(const NAList<PrivMgrCoreDesc> &privs) { columnLevel_ = privs; }
 
-   // This will replace setAllDMLGrantPrivileges for the table level.  This function
-   // is also used to set a view's privileges as well.
-   void setAllTableGrantPrivileges(const bool wgo)
+   void setAllObjectPrivileges(
+     const ComObjectType objectType,
+     const bool priv,
+     const bool wgo)
+   {
+     PrivMgrCoreDesc objectCorePrivs;
+     objectCorePrivs.setAllObjectPrivileges(objectType, priv, wgo);
+     setTablePrivs(objectCorePrivs);
+   }
+
+   void setAllTableGrantPrivileges(const bool priv, const bool wgo)
    {
      PrivMgrCoreDesc tableCorePrivs;
-     
-     tableCorePrivs.setAllTableGrantPrivileges(wgo);
-
+     tableCorePrivs.setAllTableGrantPrivileges(priv, wgo);
      setTablePrivs(tableCorePrivs);
    }
 
-   void setAllLibraryGrantPrivileges(const bool wgo)
+   void setAllLibraryGrantPrivileges(const bool priv, const bool wgo)
    {
      PrivMgrCoreDesc tableCorePrivs;
-     
-     tableCorePrivs.setAllLibraryGrantPrivileges(wgo);
-     
+     tableCorePrivs.setAllLibraryGrantPrivileges(priv, wgo);
      setTablePrivs(tableCorePrivs);
    }
 
-   void setAllUdrGrantPrivileges(const bool wgo)
+   void setAllUdrGrantPrivileges(const bool priv, const bool wgo)
    {
      PrivMgrCoreDesc tableCorePrivs;
-     
-     tableCorePrivs.setAllUdrGrantPrivileges(wgo);
-     
+     tableCorePrivs.setAllUdrGrantPrivileges(priv, wgo);
      setTablePrivs(tableCorePrivs);
    }
 
-   void setAllSequenceGrantPrivileges(const bool wgo)
+   void setAllSequenceGrantPrivileges(const bool priv, const bool wgo)
    {
      PrivMgrCoreDesc corePrivs;
-     
-     corePrivs.setAllSequenceGrantPrivileges(wgo);
-     
+     corePrivs.setAllSequenceGrantPrivileges(priv, wgo);
      setTablePrivs(corePrivs);
    }
-   void setAllTableRevokePrivileges(const bool grantOption);
-   void setAllLibraryRevokePrivileges(const bool grantOption);
-   void setAllUdrRevokePrivileges(const bool grantOption);
-   void setAllSequenceRevokePrivileges(const bool grantOption);
 
    bool getHasPublicPriv() { return hasPublicPriv_; }
    void setHasPublicPriv(bool hasPublicPriv) { hasPublicPriv_ = hasPublicPriv; }
 
    PrivMgrCoreDesc::PrivResult grantTablePrivs(PrivMgrCoreDesc& priv)
    { return tableLevel_.grantPrivs(priv); }
-   //PrivMgrCoreDesc::PrivResult grantColumnPrivs(PrivMgrCoreDesc& priv, const int32_t ordinal);
 
    PrivMgrCoreDesc::PrivResult revokeTablePrivs(PrivMgrCoreDesc& priv)
    { return tableLevel_.revokePrivs(priv); }
-   //PrivMgrCoreDesc::PrivResult revokeColumnPrivs(PrivMgrCoreDesc& priv, const int32_t ordinal);
 
 
    void pTrace() const;   // Debug trace
@@ -591,6 +580,36 @@
 };
 
 
+/* *******************************************************************
+ * Class PrivMgrDescList -- A list of PrivMgrDesc pointers
+ * ****************************************************************** */
+
+class PrivMgrDescList : public LIST(PrivMgrDesc *)
+{
+  public:
+
+  // constructor
+  PrivMgrDescList(CollHeap *heap)
+   : LIST(PrivMgrDesc *)(heap),
+     heap_(heap)
+  {}
+
+  // virtual destructor
+  virtual ~PrivMgrDescList()
+  {
+    for (CollIndex i = 0; i < entries(); i++)
+      NADELETE(operator[](i), PrivMgrDesc, heap_);
+    clear();
+  }
+
+  CollHeap *getHeap() { return heap_; }
+
+  private:
+
+  CollHeap *heap_;
+
+}; // class PrivMgrDescList
+
 
 
 #endif // PRIVMGR_DESC_H
diff --git a/core/sql/sqlcomp/PrivMgrPrivileges.cpp b/core/sql/sqlcomp/PrivMgrPrivileges.cpp
index 81e6b37..1e85905 100644
--- a/core/sql/sqlcomp/PrivMgrPrivileges.cpp
+++ b/core/sql/sqlcomp/PrivMgrPrivileges.cpp
@@ -462,59 +462,6 @@
 }
 
 // *****************************************************************************
-// * Method: buildSecurityKeys                                
-// *                                                       
-// *    Builds security keys for the current object and specified user.
-// *                                                       
-// *  Parameters:    
-// *                                                                       
-// *  <granteeID> is the unique identifier for the grantee
-// *  <privs> is the list of privileges the user has on the object
-// *  <secKeySet> is the set of security keys to be passed back.  Caller is 
-// *              responsible for freeing keys.
-// *                                                                  
-// * Returns: PrivStatus                                               
-// *                                                                  
-// * STATUS_GOOD: Security keys were built
-// *           *: Security keys were not built, see diags.     
-// *                                                               
-// *****************************************************************************
-PrivStatus PrivMgrPrivileges::buildSecurityKeys(
-  const int32_t granteeID,
-  const PrivMgrCoreDesc &privs,
-  std::vector <ComSecurityKey *> & secKeySet)
-{
-  if (privs.isNull())
-    return STATUS_GOOD;
-
-  // Only need to generate keys for DML privileges
-  for ( size_t i = FIRST_DML_PRIV; i <= LAST_DML_PRIV; i++ )
-  {
-    if ( privs.getPriv(PrivType(i)))
-    {
-      ComSecurityKey *key = NULL;
-      if (ComUser::isPublicUserID(granteeID))
-        key = new ComSecurityKey(granteeID, 
-                                 ComSecurityKey::OBJECT_IS_SPECIAL_ROLE);
-      else
-        key = new ComSecurityKey(granteeID, 
-                                 objectUID_,
-                                 PrivType(i),
-                                 ComSecurityKey::OBJECT_IS_OBJECT);
-      if (key->isValid())
-         secKeySet.push_back(key);
-      else
-      {
-        PRIVMGR_INTERNAL_ERROR("ComSecurityKey is null");
-        return STATUS_ERROR;
-      }
-    }
-  }
-   
-  return STATUS_GOOD;
-}
-
-// *****************************************************************************
 // * Method: getPrivsOnObject                                
 // *                                                       
 // * Creates a set of priv descriptors for all user grantees on an object
@@ -571,7 +518,7 @@
     // getUserPrivs returns object and column privileges summarized across all
     // grantors.  Just get direct grants to the user (role list is empty) 
     if (getUserPrivs(objectType, userID, emptyRoleIDs, privsOfTheUser,
-                     hasManagePrivileges, NULL ) != STATUS_GOOD)
+                     hasManagePrivileges) != STATUS_GOOD)
       return STATUS_ERROR;
     
     if (!privsOfTheUser.isNull())
@@ -590,7 +537,7 @@
     // getUserPrivs returns object and column privileges summarized across
     // all grantors. 
     if (getUserPrivs(objectType, grantee, emptyRoleIDs, privsOfTheUser,
-                     hasManagePrivileges, NULL ) != STATUS_GOOD)
+                     hasManagePrivileges) != STATUS_GOOD)
       return STATUS_ERROR;
     
     if (!privsOfTheUser.isNull())
@@ -1661,7 +1608,7 @@
 PrivObjectBitmap privsBitmap; 
 PrivObjectBitmap grantableBitmap; 
 
-   corePrivs.setAllObjectGrantPrivilege(objectType,true);
+   corePrivs.setAllObjectPrivileges(objectType,true/*priv*/,true/*wgo*/);
    privsBitmap = corePrivs.getPrivBitmap();
    grantableBitmap = corePrivs.getWgoBitmap();
    
@@ -1760,7 +1707,7 @@
   // get column and object privileges across all grantors 
   bool hasManagePrivileges;
   retcode = getUserPrivs(objectType, grantorID_, roleIDs, privsOfTheGrantor,
-                         hasManagePrivileges, NULL );
+                         hasManagePrivileges);
   if (retcode != STATUS_GOOD)
     return retcode;
 
@@ -2320,9 +2267,9 @@
   // views have same privileges as tables
   bool setWGOtrue = true;
   PrivMgrDesc summarizedOriginalPrivs;
-  summarizedOriginalPrivs.setAllTableGrantPrivileges(setWGOtrue);
+  summarizedOriginalPrivs.setAllTableGrantPrivileges(true/*priv*/, setWGOtrue);
   PrivMgrDesc summarizedCurrentPrivs;
-  summarizedCurrentPrivs.setAllTableGrantPrivileges(setWGOtrue);
+  summarizedCurrentPrivs.setAllTableGrantPrivileges(true/*priv*/, setWGOtrue);
 
   // Get list of objects referenced by the view
   std::vector<ObjectReference *> objectList;
@@ -2417,8 +2364,8 @@
   }
 
   // Turn on bits to prepare for intersecting with object privileges
-  originalPrivs.setAllTableGrantPrivileges(setWGOtrue);
-  currentPrivs.setAllTableGrantPrivileges(setWGOtrue);
+  originalPrivs.setAllTableGrantPrivileges(true/*priv*/, setWGOtrue);
+  currentPrivs.setAllTableGrantPrivileges(true/*priv*/, setWGOtrue);
 
   std::vector<ColumnReference *> summarizedColRefs;
 
@@ -3185,11 +3132,8 @@
          revokedPrivs |= adjustedPrivs.getPrivBitmap(); 
       }
       else
-      {
-         // The row should exist in "grantedColPrivs" 
-         PRIVMGR_INTERNAL_ERROR("Column privilege not found to revoke");
-         return STATUS_ERROR;
-      }   
+         // if column not exist, just continue (ComDiags contains a warning)
+         continue;
 
       
       if (deleteRow)
@@ -3646,8 +3590,9 @@
                       std::vector<int32_t> roleIDs;
                       std::vector<int32_t> userIDs;
                       roleIDs.push_back(thisGrantee);
-                      if (getUserIDsForRoleIDs(roleIDs,userIDs) == STATUS_ERROR)
+                      if (getGranteeIDsForRoleIDs(roleIDs,userIDs) == STATUS_ERROR)
                         return;
+
                       for (size_t j = 0; j < userIDs.size(); j++)
                       {
                          granteeAsGrantor = userIDs[j];
@@ -3913,7 +3858,7 @@
                   std::vector<int32_t> roleIDs;
                   std::vector<int32_t> userIDs;
                   roleIDs.push_back(thisGrantee);
-                  if (getUserIDsForRoleIDs(roleIDs,userIDs) == STATUS_ERROR)
+                  if (getGranteeIDsForRoleIDs(roleIDs,userIDs) == STATUS_ERROR)
                     return;
                   for (size_t j = 0; j < userIDs.size(); j++)
                   {
@@ -4004,53 +3949,68 @@
   const int32_t granteeID, 
   const PrivMgrDesc &revokedPrivs)
 {
-  // Go through the list of table privileges and generate SQL_QIKEYs
-  std::vector<ComSecurityKey *> keyList;
-  const PrivMgrCoreDesc &privs = revokedPrivs.getTablePrivs();
-  PrivStatus privStatus = buildSecurityKeys(granteeID,
-                                            revokedPrivs.getTablePrivs(),
-                                            keyList);
-  if (privStatus != STATUS_GOOD)
+  NAList<int32_t> roleGrantees (STMTHEAP);
+
+  // If the privilege is revoked from a role, then need to generate QI keys for 
+  // the users associated with the role.
+  if (PrivMgr::isRoleID(granteeID))
   {
-    for(size_t k = 0; k < keyList.size(); k++)
-     delete keyList[k]; 
-    keyList.clear();
-    return privStatus;
+    // Get users granted to role (granteeID)
+    std::vector<int32_t> roleID;
+    roleID.push_back(granteeID);
+    std::vector<int32_t> granteeIDs;
+    if (getGranteeIDsForRoleIDs(roleID, granteeIDs, false) == STATUS_ERROR)
+      return STATUS_ERROR;
+
+    for (size_t g = 0; g < granteeIDs.size(); g++)
+      roleGrantees.insert(granteeIDs[g]);
   }
+  else
+    roleGrantees.insert(grantorID_);
+
+  // Go through the list of table privileges and generate SQL_QIKEYs
+  ComSecurityKeySet keyList(NULL);
+  const PrivMgrCoreDesc &privs = revokedPrivs.getTablePrivs();
+  if (!buildSecurityKeys(roleGrantees,
+                         granteeID,
+                         objectUID_,
+                         false, /* isColumn */
+                         revokedPrivs.getTablePrivs(),
+                         keyList))
+  {
+    PRIVMGR_INTERNAL_ERROR("ComSecurityKey is null");
+    return STATUS_ERROR;
+  }
+
 
   for (int i = 0; i < revokedPrivs.getColumnPrivs().entries(); i++)
   {
     const NAList<PrivMgrCoreDesc> &columnPrivs = revokedPrivs.getColumnPrivs();
-    privStatus = buildSecurityKeys(granteeID,
-                                   columnPrivs[i],
-                                   keyList);
-    if (privStatus != STATUS_GOOD)
+    if (!buildSecurityKeys(roleGrantees,
+                           granteeID,
+                           objectUID_,
+                           true, /* isColumn */
+                           columnPrivs[i],
+                           keyList))
     {
-      for(size_t k = 0; k < keyList.size(); k++)
-       delete keyList[k]; 
-      keyList.clear();
-      return privStatus;
+      PRIVMGR_INTERNAL_ERROR("ComSecurityKey is null");
+      return STATUS_ERROR;
     }
   }
-  
+
   // Create an array of SQL_QIKEYs
-  int32_t numKeys = keyList.size();
+  int32_t numKeys = keyList.entries();
   SQL_QIKEY siKeyList[numKeys];
-  for (size_t j = 0; j < keyList.size(); j++)
+  for (size_t j = 0; j < numKeys; j++)
   {
-    ComSecurityKey *pKey = keyList[j];
-    siKeyList[j].revokeKey.subject = pKey->getSubjectHashValue();
-    siKeyList[j].revokeKey.object = pKey->getObjectHashValue();
+    ComSecurityKey key = keyList[j];
+    siKeyList[j].revokeKey.subject = key.getSubjectHashValue();
+    siKeyList[j].revokeKey.object = key.getObjectHashValue();
     std::string actionString;
-    pKey->getSecurityKeyTypeAsLit(actionString);
+    key.getSecurityKeyTypeAsLit(actionString);
     strncpy(siKeyList[j].operation, actionString.c_str(), 2);
   }
   
-  // delete the security list
-  for(size_t k = 0; k < keyList.size(); k++)
-   delete keyList[k]; 
-  keyList.clear();
-
   // Call the CLI to send details to RMS
   SQL_EXEC_SetSecInvalidKeys(numKeys, siKeyList);
 
@@ -4209,8 +4169,7 @@
   const int64_t objectUID,
   ComObjectType objectType,
   const int32_t userID,
-  PrivMgrDesc &privsOfTheUser,
-  std::vector <ComSecurityKey *>* secKeySet)
+  PrivMgrDesc &privsOfTheUser)
 {
   PrivStatus retcode = STATUS_GOOD;
   
@@ -4239,7 +4198,7 @@
   bool hasManagePrivileges = false;
   
   retcode = getUserPrivs(objectType, userID, roleIDs, privsOfTheUser, 
-                         hasManagePrivileges, secKeySet);
+                         hasManagePrivileges);
 
   return retcode;
 }
@@ -4272,48 +4231,14 @@
 PrivMgrRoles roles(" ",metadataLocation_,pDiags_);
 std::vector<std::string> roleNames;
 std::vector<int32_t> roleDepths;
+std::vector<int32_t> grantees;
   
-   retcode =  roles.fetchRolesForUser(userID,roleNames,roleIDs,roleDepths);
+   retcode =  roles.fetchRolesForAuth(userID,roleNames,roleIDs,roleDepths,grantees);
    return retcode;
 }
 //*************** End of PrivMgrPrivileges::getRoleIDsForUserID ****************
 
 // *****************************************************************************
-// * Method: getUserIDsForRoleIDs                              
-// *                                                       
-// *    Returns the userIDs granted to the role passed in role list
-// *                                                       
-// *  Parameters:    
-// *                                                                       
-// *  <roleIDs> list of roles to check
-// *  <userIDs> passed back the list (potentially empty) of users granted to 
-// *            the roleIDs
-// *                                                                     
-// * Returns: PrivStatus                                               
-// *                                                                  
-// * STATUS_GOOD: Role list returned
-// *           *: Unable to fetch granted roles, see diags.     
-// *                                                               
-// *****************************************************************************
-PrivStatus PrivMgrPrivileges::getUserIDsForRoleIDs(
-  const std::vector<int32_t>  & roleIDs,
-  std::vector<int32_t> & userIDs)
-{
-  std::vector<int32_t> userIDsForRoleIDs;
-  PrivMgrRoles roles(" ",metadataLocation_,pDiags_);
-  if (roles.fetchUsersForRoles(roleIDs, userIDsForRoleIDs) == STATUS_ERROR)
-    return STATUS_ERROR;
-
-  for (size_t i = 0; i < userIDsForRoleIDs.size(); i++)
-  {
-     int32_t authID = userIDsForRoleIDs[i];
-     if (std::find(userIDs.begin(), userIDs.end(), authID) == userIDs.end())
-       userIDs.insert( std::upper_bound( userIDs.begin(), userIDs.end(), authID ), authID);
-  }
-  return STATUS_GOOD;
-}
-
-// *****************************************************************************
 // * Method: getUserPrivs                                
 // *                                                       
 // *    Accumulates privileges for a user summarized over all grantors
@@ -4326,7 +4251,6 @@
 // *  <roleIDs> specifies a list of roles granted to the grantee
 // *  <summarizedPrivs> contains the summarized privileges
 // *  <hasManagePrivileges> returns whether the grantee has MANAGE_PRIVILEGES authority
-// *  <secKeySet> if not NULL, returns a set of keys for user
 // *                                                                     
 // * Returns: PrivStatus                                               
 // *                                                                  
@@ -4339,8 +4263,7 @@
   const int32_t granteeID,
   const std::vector<int32_t> & roleIDs,
   PrivMgrDesc &summarizedPrivs,
-  bool & hasManagePrivileges,
-  std::vector<ComSecurityKey *>* secKeySet 
+  bool & hasManagePrivileges
   )
 {
    PrivStatus retcode = STATUS_GOOD;
@@ -4351,8 +4274,7 @@
                                       granteeID,
                                       roleIDs,
                                       temp,
-                                      hasManagePrivileges,
-                                      secKeySet
+                                      hasManagePrivileges
                                       );
    if (retcode != STATUS_GOOD)
     return retcode;
@@ -4390,8 +4312,7 @@
    const int32_t granteeID,
    const std::vector<int32_t> & roleIDs,
    PrivMgrDesc &summarizedPrivs,
-   bool & hasManagePrivPriv,
-   std::vector <ComSecurityKey *>* secKeySet 
+   bool & hasManagePrivPriv
    )
 {
   PrivStatus retcode = STATUS_GOOD;
@@ -4429,7 +4350,7 @@
   // Accumulate object level privileges
   else
   {
-    retcode = getRowsForGrantee(objectUID, granteeID, true, roleIDs, rowList, secKeySet);
+    retcode = getRowsForGrantee(objectUID, granteeID, true, roleIDs, rowList);
     if (retcode == STATUS_ERROR)
       return retcode; 
 
@@ -4443,15 +4364,6 @@
         hasPublicGrantee = true;
 
       PrivMgrCoreDesc temp (row.privsBitmap_, row.grantableBitmap_);
-      if (secKeySet)
-      {
-        retcode = buildSecurityKeys(granteeID,
-                                    temp,
-                                    *secKeySet);
-        if (retcode == STATUS_ERROR)
-          return retcode;
-      }
-
       coreTablePrivs.unionOfPrivs(temp);
     }
   
@@ -4468,7 +4380,7 @@
 
   // Add accumulated column level privileges
   rowList.clear();
-  retcode = getRowsForGrantee(objectUID, granteeID, false, roleIDs, rowList, secKeySet);
+  retcode = getRowsForGrantee(objectUID, granteeID, false, roleIDs, rowList);
   if (retcode == STATUS_ERROR)
     return retcode;
 
@@ -4483,15 +4395,6 @@
 
     // See if the ordinal has already been specified
     PrivMgrCoreDesc temp (row.privsBitmap_, row.grantableBitmap_, row.columnOrdinal_);
-    if (secKeySet)
-    {
-      retcode = buildSecurityKeys(granteeID,
-                                  temp,
-                                  *secKeySet);
-      if (retcode == STATUS_ERROR)
-        return retcode;
-    }
-
     PrivMgrCoreDesc *coreColumnPriv = findColumnEntry(coreColumnPrivs, row.columnOrdinal_);
     if (coreColumnPriv)
       coreColumnPriv->unionOfPrivs(temp);
@@ -4576,8 +4479,7 @@
   const int32_t granteeID,
   const bool isObjectTable,
   const std::vector<int_32> &roleIDs,
-  std::vector<PrivMgrMDRow *> &rowList,
-  std::vector <ComSecurityKey *>* secKeySet) 
+  std::vector<PrivMgrMDRow *> &rowList)
 {
   PrivStatus retcode = STATUS_GOOD;
 
@@ -4747,7 +4649,7 @@
 
   // get OBJECT_PRIVILEGES rows where the grantee has received privileges
   std::vector<PrivMgrMDRow *> rowList;
-  retcode = getRowsForGrantee(objectUID, granteeID, true, roleIDs, rowList, NULL);
+  retcode = getRowsForGrantee(objectUID, granteeID, true, roleIDs, rowList);
 
   // rowList contains the original privileges, 
   // listOfChangedPrivs contains any updates to privileges
@@ -5012,14 +4914,14 @@
   // If all is specified, set bits appropriate for the object type and return
   if (isAllSpecified)
   {
-    if (isLibrary)
-      privsToProcess.setAllLibraryGrantPrivileges(isWgoSpecified);
-    else if (isUdr)
-      privsToProcess.setAllUdrGrantPrivileges(isWgoSpecified);
-    else if (isSequence)
-      privsToProcess.setAllSequenceGrantPrivileges(isWgoSpecified);
-    else
-      privsToProcess.setAllTableGrantPrivileges(isWgoSpecified);
+    // For grant:
+    //    WGO is set if WITH GRANT OPTION specified in syntax
+    //    GOF is false, so always turn on the priv bits
+    // For revoke:
+    //    WGO is always true, so always remove the WGO bits
+    //    GOF is set if GRANT OPTION FOR specified in syntax, so don't set privs
+    //       bit if only removing the grant option (JIRA 3194)
+    privsToProcess.setAllObjectPrivileges(objectType, !isGofSpecified, isWgoSpecified);
     return STATUS_GOOD;
   }
 
@@ -6255,16 +6157,16 @@
 
   // Create bitmaps for all supported object types;
   PrivMgrDesc privDesc;
-  privDesc.setAllTableGrantPrivileges(true);
+  privDesc.setAllTableGrantPrivileges(true, true);
   int64_t tableBits = privDesc.getTablePrivs().getPrivBitmap().to_ulong();
  
-  privDesc.setAllLibraryGrantPrivileges(true);
+  privDesc.setAllLibraryGrantPrivileges(true, true);
   int64_t libraryBits = privDesc.getTablePrivs().getPrivBitmap().to_ulong();
 
-  privDesc.setAllUdrGrantPrivileges(true);
+  privDesc.setAllUdrGrantPrivileges(true, true);
   int64_t udrBits = privDesc.getTablePrivs().getPrivBitmap().to_ulong();
 
-  privDesc.setAllSequenceGrantPrivileges(true);
+  privDesc.setAllSequenceGrantPrivileges(true, true);
   int64_t sequenceBits = privDesc.getTablePrivs().getPrivBitmap().to_ulong();
 
   // for views, privilegesBitmap is set to 1 (SELECT), wgo to 0 (no)
diff --git a/core/sql/sqlcomp/PrivMgrPrivileges.h b/core/sql/sqlcomp/PrivMgrPrivileges.h
index e0597a2..5b687a6 100644
--- a/core/sql/sqlcomp/PrivMgrPrivileges.h
+++ b/core/sql/sqlcomp/PrivMgrPrivileges.h
@@ -110,11 +110,6 @@
   // -------------------------------------------------------------------
   // Public functions:
   // -------------------------------------------------------------------
-   PrivStatus buildSecurityKeys(
-      const int32_t granteeID, 
-      const PrivMgrCoreDesc &privs,
-      std::vector <ComSecurityKey *> & secKeySet);
-      
    PrivStatus getGrantorDetailsForObject(
       const bool isGrantedBySpecified,
       const std::string grantedByName,
@@ -135,8 +130,7 @@
       const int64_t objectUID,
       ComObjectType objectType,
       const int32_t userID,
-      PrivMgrDesc &privsForTheUser,
-      std::vector <ComSecurityKey *>* secKeySet);
+      PrivMgrDesc &privsForTheUser);
 
    PrivStatus getPrivRowsForObject(
       const int64_t objectUID,
@@ -243,8 +237,7 @@
      const int32_t grantee,
      const std::vector<int32_t> & roleIDs,
      PrivMgrDesc &privs,
-     bool & hasManagePrivileges,
-     std::vector <ComSecurityKey *>* secKeySet = NULL
+     bool & hasManagePrivileges
      );
           
    PrivStatus getUserPrivs(
@@ -252,8 +245,7 @@
      const int32_t grantee,
      const std::vector<int32_t> & roleIDs,
      PrivMgrDesc &privs,
-     bool & hasManagePrivileges,
-     std::vector <ComSecurityKey *>* secKeySet = NULL
+     bool & hasManagePrivileges
      );
      
 private: 
@@ -359,17 +351,12 @@
     const int32_t granteeID,
     const bool isObjectTable,
     const std::vector<int32_t> & roleIDs,
-    std::vector<PrivMgrMDRow *> &rowList,
-    std::vector <ComSecurityKey *>* secKeySet); 
+    std::vector<PrivMgrMDRow *> &rowList);
     
   void getTreeOfGrantors(
     const int32_t granteeID,
     std::set<int32_t> &listOfGrantors);
 
-  PrivStatus getUserIDsForRoleIDs(
-    const std::vector<int32_t> & roleIDs,
-    std::vector<int32_t> & userIDs);
-
   PrivStatus givePriv(
      const int32_t currentOwnerID,
      const int32_t newOwnerID,
diff --git a/core/sql/sqlcomp/PrivMgrRoles.cpp b/core/sql/sqlcomp/PrivMgrRoles.cpp
index 882ce93..64644d4 100644
--- a/core/sql/sqlcomp/PrivMgrRoles.cpp
+++ b/core/sql/sqlcomp/PrivMgrRoles.cpp
@@ -580,7 +580,7 @@
 
 // *****************************************************************************
 // *                                                                           *
-// * Function: PrivMgrRoles::fetchRolesForUser                                 *
+// * Function: PrivMgrRoles::fetchRolesForAuth                                 *
 // *                                                                           *
 // *    Returns all unique roles granted to an authorization ID.  If a role is *
 // * granted more than once, it is only returned one time.  If one or more of  *
@@ -615,24 +615,22 @@
 // *              error.  The error is put into the diags area.                *
 // *                                                                           *
 // *****************************************************************************
-PrivStatus PrivMgrRoles::fetchRolesForUser(
+PrivStatus PrivMgrRoles::fetchRolesForAuth(
    const int32_t authID,
    std::vector<std::string> & roleNames,
    std::vector<int32_t> & roleIDs,
-   std::vector<int32_t> & grantDepths)
-
+   std::vector<int32_t> & grantDepths,
+   std::vector<int32_t> & grantees)
 {
-
-std::string whereClause(" WHERE GRANTEE_ID = ");
-
+   std::string whereClause(" WHERE GRANTEE_ID = ");
    whereClause += authIDToString(authID);
-   
-std::vector<MyRow> rows;
-MyTable &myTable = static_cast<MyTable &>(myTable_);
 
-std::string orderByClause(" ORDER BY ROLE_ID");
+   std::vector<MyRow> rows;
+   MyTable &myTable = static_cast<MyTable &>(myTable_);
 
-PrivStatus privStatus = myTable.selectAllWhere(whereClause,orderByClause,rows);
+   std::string orderByClause(" ORDER BY ROLE_ID");
+
+   PrivStatus privStatus = myTable.selectAllWhere(whereClause,orderByClause,rows);
    
    if (privStatus != STATUS_GOOD && privStatus != STATUS_WARNING)
       return privStatus;
@@ -641,28 +639,24 @@
    {
       MyRow &row = rows[r];
       
-      if (hasValue(roleIDs,row.roleID_))
+      if (hasValue(roleIDs,row.roleID_) &&
+          hasValue(grantees, row.granteeID_))
       {
          if (grantDepths.back() == 0)
             grantDepths.back() = row.grantDepth_;
          continue;
       }
-      roleNames.push_back(row.granteeName_);
+      roleNames.push_back(row.roleName_);
       roleIDs.push_back(row.roleID_);
+      grantees.push_back(row.granteeID_);
       grantDepths.push_back(row.grantDepth_);
    }
 
    return STATUS_GOOD;
-
 }
-//****************** End of PrivMgrRoles::fetchRolesForUser ********************
+//****************** End of PrivMgrRoles::fetchRolesForAuth ********************
 
-// *****************************************************************************
-// *                                                                           *
-// * Function: PrivMgrRoles::fetchUsersForRole                                 *
-// *                                                                           *
-// *    Returns all grantees of a role.                                        *
-// *                                                                           *
+
 // *****************************************************************************
 // *                                                                           *
 // *  Parameters:                                                              *
@@ -688,45 +682,42 @@
 // *              A CLI error is put into the diags area.                      *
 // *                                                                           *
 // *****************************************************************************
-PrivStatus PrivMgrRoles::fetchUsersForRole(
+
+PrivStatus PrivMgrRoles::fetchGranteesForRole(
    const int32_t roleID,
    std::vector<std::string> & granteeNames,
    std::vector<int32_t> & grantorIDs,
    std::vector<int32_t> & grantDepths)
-
 {
-
-std::string whereClause(" WHERE ROLE_ID = ");
-
+  std::string whereClause(" WHERE ROLE_ID = ");
    whereClause += authIDToString(roleID);
-   
-std::vector<MyRow> rows;
-MyTable &myTable = static_cast<MyTable &>(myTable_);
 
-std::string orderByClause(" ORDER BY GRANTEE_NAME");
+  std::vector<MyRow> rows;
+  MyTable &myTable = static_cast<MyTable &>(myTable_);
 
-PrivStatus privStatus = myTable.selectAllWhere(whereClause,orderByClause,rows);
-   
+  std::string orderByClause(" ORDER BY GRANTEE_NAME");
+
+  PrivStatus privStatus = myTable.selectAllWhere(whereClause,orderByClause,rows);
+
    if (privStatus != STATUS_GOOD && privStatus != STATUS_WARNING)
       return privStatus;
-   
+
    for (size_t r = 0; r < rows.size(); r++)
    {
       MyRow &row = rows[r];
-      
+
       granteeNames.push_back(row.granteeName_);
       grantorIDs.push_back(row.grantorID_);
       grantDepths.push_back(row.grantDepth_);
    }
 
    return STATUS_GOOD;
-
 }
-//****************** End of PrivMgrRoles::fetchUsersForRole ********************
+//**************** End of PrivMgrRoles::fetchGranteesForRole *******************
 
 // *****************************************************************************
 // *                                                                           *
-// * Function: PrivMgrRoles::fetchUsersForRoles                                *
+// * Function: PrivMgrRoles::fetchGranteesForRoles                             *
 // *                                                                           *
 // *    Returns all users granted the list of roles                            *
 // *                                                                           *
@@ -737,30 +728,34 @@
 // *  <roleIDs>                       const std::vector<int32_t> &    In       *
 // *    is a list of roles.                                                    *
 // *                                                                           *
-// *  <userIDs>                       std::vector<std::int32_t> &     Out      *
-// *    passes back a list of user grantees for the roles.                     *
+// *  <granteeIDs>                    std::vector<std::int32_t> &     Out      *
+// *    passes back a list of user and group grantees for the roles.           *
 // *                                                                           *
 // *****************************************************************************
 // *                                                                           *
 // * Returns: PrivStatus                                                       *
 // *                                                                           *
-// *   STATUS_GOOD: Zero or more userIDs were returned                         *
+// *   STATUS_GOOD: Zero or more granteeIDs were returned                      *
 // *             *: Grants for roles were not returned due to SQL error.       *
 // *                A CLI error is put into the diags area.                    *
 // *                                                                           *
 // *****************************************************************************
-PrivStatus PrivMgrRoles::fetchUsersForRoles(
-   const std::vector<int32_t> & userIDs,
-   std::vector<std::int32_t> & granteeIDs)
+PrivStatus PrivMgrRoles::fetchGranteesForRoles(
+   const std::vector<int32_t> & roleIDs,
+   std::vector<std::int32_t> & granteeIDs,
+   bool includeSysGrantor)
 {
    std::string whereClause(" WHERE ROLE_ID IN( ");
-   for (size_t i = 0; i < userIDs.size(); i++)
+   for (size_t i = 0; i < roleIDs.size(); i++)
    {
       if (i > 0)
         whereClause += ", ";
-      whereClause += authIDToString(userIDs[i]);
+      whereClause += authIDToString(roleIDs[i]);
    }
    whereClause += ")";
+
+   if (!includeSysGrantor)
+     whereClause += " AND GRANTOR_ID <> -2 ";
    std::string orderByClause(" ORDER BY GRANTEE_ID");
 
    std::vector<MyRow> rows;
@@ -775,14 +770,13 @@
       MyRow &row = rows[r];
 
       if (CmpSeabaseDDLauth::isUserID(row.granteeID_))
-         granteeIDs.push_back(row.granteeID_);
+         if (row.grantorID_ != SYSTEM_USER)
+           granteeIDs.push_back(row.granteeID_);
    }
 
    return STATUS_GOOD;
 }
-//****************** End of PrivMgrRoles::fetchUsersForRole ********************
-
-
+//**************** End of PrivMgrRoles::fetchGranteesForRoles ******************
 
 // *****************************************************************************
 // *                                                                           *
diff --git a/core/sql/sqlcomp/PrivMgrRoles.h b/core/sql/sqlcomp/PrivMgrRoles.h
index 83a9120..354fb22 100644
--- a/core/sql/sqlcomp/PrivMgrRoles.h
+++ b/core/sql/sqlcomp/PrivMgrRoles.h
@@ -54,22 +54,24 @@
 // Public functions:
 // -------------------------------------------------------------------
    
-   PrivStatus fetchRolesForUser(
+   PrivStatus fetchRolesForAuth(
       const int32_t authID,
       std::vector<std::string> & roleNames,
       std::vector<int32_t> & roleIDs,
-      std::vector<int32_t> & grantDepths);
-   
-   PrivStatus fetchUsersForRole(
+      std::vector<int32_t> & grantDepths,
+      std::vector<int32_t> & grantees);
+
+   PrivStatus fetchGranteesForRole(
       const int32_t roleID,
       std::vector<std::string> & granteeNames,
       std::vector<int32_t> & grantorIDs,
       std::vector<int32_t> & grantDepths);
-   
-   PrivStatus fetchUsersForRoles(
+
+   PrivStatus fetchGranteesForRoles(
       const std::vector<int32_t> & roleIDs,
-      std::vector<int32_t> & userIDs);
-   
+      std::vector<int32_t> & granteeIDs,
+      bool includeSysGrantor = true);
+
    PrivStatus grantRole(
       const std::vector<int32_t> & roleIDs,
       const std::vector<std::string> & roleNames,
diff --git a/core/sql/sqlcomp/PrivMgrUserPrivs.cpp b/core/sql/sqlcomp/PrivMgrUserPrivs.cpp
index fcdf247..af07694 100644
--- a/core/sql/sqlcomp/PrivMgrUserPrivs.cpp
+++ b/core/sql/sqlcomp/PrivMgrUserPrivs.cpp
@@ -77,113 +77,52 @@
 // ****************************************************************************
 // Class: PrivMgrUserPrivs
 // ****************************************************************************
+
+// ----------------------------------------------------------------------------
+// method: initUserPrivs
+//
+// Creates a PrivMgrUserPrivs object from a PrivMgrDescs list
+// ----------------------------------------------------------------------------
 bool PrivMgrUserPrivs::initUserPrivs(
-  const std::vector<int32_t> & roleIDs,
-  const TrafDesc *priv_desc,
+  const NAList<Int32> & roleIDs,
+  PrivMgrDescList *privDescs,
   const int32_t userID,
   const int64_t objectUID,
-  ComSecurityKeySet & secKeySet)
+  ComSecurityKeySet * secKeySet)
 {
   hasPublicPriv_ = false;
 
-  // generate PrivMgrUserPrivs from the priv_desc structure
-  TrafDesc *priv_grantees_desc = priv_desc->privDesc()->privGrantees;
-  NAList<PrivMgrDesc> descList(NULL);
-
-  // Find relevant descs for the user
-  while (priv_grantees_desc)
+  // create a subset of PrivDesc containing privs applicable for the userID
+  PrivMgrDescList userDescList(privDescs->getHeap());
+  for ( CollIndex i = 0; i < privDescs->entries(); i++)
   {
-    Int32 grantee = priv_grantees_desc->privGranteeDesc()->grantee;
+    const PrivMgrDesc *privs = privDescs->operator[](i);
+    Int32 grantee = privs->getGrantee();
     bool addDesc = false;
-    if (grantee == userID)
+    if (ComUser::isPublicUserID(grantee))
+    {
+      hasPublicPriv_ = true;
+      addDesc = true;
+    }
+    else if (grantee == userID)
       addDesc = true;
 
-    if (PrivMgr::isRoleID(grantee))
+    else if (PrivMgr::isRoleID(grantee))
     {
-      if ((std::find(roleIDs.begin(), roleIDs.end(), grantee)) != roleIDs.end())
+      Int32 entry;
+      if (roleIDs.find(grantee, entry))
         addDesc = true;
     }
 
-    if (ComUser::isPublicUserID(grantee))
-    {
-      addDesc = true;
-      hasPublicPriv_ = true;
-    }
-
-    // Create a list of PrivMgrDesc contain privileges for user, user's roles,
-    // and public
     if (addDesc)
     {
-      TrafDesc *objectPrivs = priv_grantees_desc->privGranteeDesc()->objectBitmap;
-
-      PrivMgrCoreDesc objectDesc(objectPrivs->privBitmapDesc()->privBitmap,
-                                 objectPrivs->privBitmapDesc()->privWGOBitmap);
-      
-      TrafDesc *priv_grantee_desc = priv_grantees_desc->privGranteeDesc();
-      TrafDesc *columnPrivs = priv_grantee_desc->privGranteeDesc()->columnBitmaps;
-      NAList<PrivMgrCoreDesc> columnDescs(NULL);
-      while (columnPrivs)
-      {
-        PrivMgrCoreDesc columnDesc(columnPrivs->privBitmapDesc()->privBitmap,
-                                   columnPrivs->privBitmapDesc()->privWGOBitmap,
-                                   columnPrivs->privBitmapDesc()->columnOrdinal);
-        columnDescs.insert(columnDesc);
-        columnPrivs = columnPrivs->next;
-      }
-
-      PrivMgrDesc privs(priv_grantees_desc->privGranteeDesc()->grantee);
-      privs.setTablePrivs(objectDesc);
-      privs.setColumnPrivs(columnDescs);
-      privs.setHasPublicPriv(hasPublicPriv_);
-
-      descList.insert(privs);
-    }
-    priv_grantees_desc = priv_grantees_desc->next;
-  }
-
-  // Union privileges from all grantees together to create a single set of
-  // bitmaps.  Create security invalidation keys
-  for (int i = 0; i < descList.entries(); i++)
-  {
-    PrivMgrDesc privs = descList[i];
-
-    // Set up object level privileges
-    objectBitmap_ |= privs.getTablePrivs().getPrivBitmap();
-    grantableBitmap_ |= privs.getTablePrivs().getWgoBitmap();
-
-    // Set up column level privileges
-    NAList<PrivMgrCoreDesc> columnPrivs = privs.getColumnPrivs();
-    std::map<size_t,PrivColumnBitmap>::iterator it;
-    for (int j = 0; j < columnPrivs.entries(); j++)
-    {
-      PrivMgrCoreDesc colDesc = columnPrivs[j];
-      Int32 columnOrdinal = colDesc.getColumnOrdinal();
-      it = colPrivsList_.find(columnOrdinal);
-      if (it == colPrivsList_.end())
-      {
-        colPrivsList_[columnOrdinal] = colDesc.getPrivBitmap();
-        colGrantableList_[columnOrdinal] = colDesc.getWgoBitmap();
-      }
-      else
-      {
-        colPrivsList_[columnOrdinal] |= colDesc.getPrivBitmap();
-        colGrantableList_[columnOrdinal] |= colDesc.getWgoBitmap();
-      }
-    }
-
-    // set up security invalidation keys
-    if (!buildSecurityKeys(userID, privs.getGrantee(), objectUID, privs.getTablePrivs(), secKeySet))
-      return false;
-
-    for (int k = 0; k < colPrivsList_.size(); k++)
-    {
-      PrivMgrCoreDesc colDesc(colPrivsList_[k], colGrantableList_[k]);
-      if (!buildSecurityKeys(userID, privs.getGrantee(), objectUID, colDesc, secKeySet))
-        return false;
+      PrivMgrDesc *myPrivs = new (userDescList.getHeap()) PrivMgrDesc (*privs);
+      userDescList.insert(myPrivs);
     }
   }
 
-  // TBD - add schema privilege bitmaps
+  if (userDescList.entries() > 0)
+    return setPrivInfoAndKeys(userDescList, userID, objectUID, secKeySet);
   return true;
 }
 
@@ -206,3 +145,106 @@
   hasPublicPriv_ = privsOfTheUser.getHasPublicPriv();
 }
 
+// ----------------------------------------------------------------------------
+// method: setPrivInfoAndKeys
+//
+// Creates a security keys for a list of PrivMgrDescs
+// ----------------------------------------------------------------------------
+bool PrivMgrUserPrivs::setPrivInfoAndKeys(
+  PrivMgrDescList &descList,
+  const int32_t userID,
+  const int64_t objectUID,
+  NASet<ComSecurityKey> *secKeySet)
+{
+  // Get the list of roleIDs and grantees from cache
+  NAList<int32_t> roleIDs (descList.getHeap());
+  NAList<int32_t> grantees (descList.getHeap());
+  if (ComUser::getCurrentUserRoles(roleIDs, grantees) != 0)
+    return false;
+
+  for (int i = 0; i < descList.entries(); i++)
+  {
+    PrivMgrDesc *privs = descList[i];
+
+    // Set up object level privileges
+    objectBitmap_ |= privs->getTablePrivs().getPrivBitmap();
+    grantableBitmap_ |= privs->getTablePrivs().getWgoBitmap();
+
+    // Set up column level privileges
+    NAList<PrivMgrCoreDesc> columnPrivs = privs->getColumnPrivs();
+    std::map<size_t,PrivColumnBitmap>::iterator it;
+    for (int j = 0; j < columnPrivs.entries(); j++)
+    {
+      PrivMgrCoreDesc colDesc = columnPrivs[j];
+      Int32 columnOrdinal = colDesc.getColumnOrdinal();
+      it = colPrivsList_.find(columnOrdinal);
+      if (it == colPrivsList_.end())
+      {
+        colPrivsList_[columnOrdinal] = colDesc.getPrivBitmap();
+        colGrantableList_[columnOrdinal] = colDesc.getWgoBitmap();
+      }
+      else
+      {
+        colPrivsList_[columnOrdinal] |= colDesc.getPrivBitmap();
+        colGrantableList_[columnOrdinal] |= colDesc.getWgoBitmap();
+      }
+    }
+
+    // set up security invalidation keys
+    Int32 grantee = privs->getGrantee();
+    NAList<Int32> roleGrantees(descList.getHeap());
+
+    // If the grantee is a role, then get all users that
+    // have been granted the role.  Create a security key for each.
+    if (PrivMgr::isRoleID(grantee))
+    {
+      for (Int32 j = 0; j < grantees.entries(); j++)
+      {
+         if (grantee == roleIDs[j])
+           roleGrantees.insert(grantees[j]);
+      }
+    }
+
+    // add object security keys
+    if (!buildSecurityKeys(roleGrantees, grantee, objectUID, false, privs->getTablePrivs(), *secKeySet))
+      return false;
+
+    // add column security keys
+    NAList<PrivMgrCoreDesc> colPrivs = privs->getColumnPrivs();
+    for (int k = 0; k < colPrivs.entries(); k++)
+    {
+      PrivMgrCoreDesc colDesc = colPrivs[0];
+      //PrivMgrCoreDesc colDesc(colPrivs[k], colGrantableList_[k]);
+      if (!buildSecurityKeys(roleGrantees, grantee, objectUID, true, colDesc, *secKeySet))
+        return false;
+    }
+  }
+
+  return true;
+}
+
+
+// -----------------------------------------------------------------------------
+// Method:: print
+//
+// Prints out the bitmaps for the current user
+// -----------------------------------------------------------------------------
+std::string PrivMgrUserPrivs::print()
+{
+  std::string privList("Obj: ");
+  privList += objectBitmap_.to_string<char,std::string::traits_type,std::string::allocator_type>();
+
+  privList += ", Col: ";
+  Int32 bufSize = 100;
+  char buf[bufSize];
+  for (size_t i = 0; i < colPrivsList_.size(); i++)
+  {
+    std::string bits = colPrivsList_[i].to_string<char,std::string::traits_type,std::string::allocator_type>();
+    // Ignore potential buffer overruns
+    snprintf(buf, bufSize, "%d %s ", (int)i, bits.c_str());
+    privList += buf;
+  }
+
+  return privList;
+}
+
diff --git a/core/sql/sqlcomp/PrivMgrUserPrivs.h b/core/sql/sqlcomp/PrivMgrUserPrivs.h
index a5264c5..473e59e 100644
--- a/core/sql/sqlcomp/PrivMgrUserPrivs.h
+++ b/core/sql/sqlcomp/PrivMgrUserPrivs.h
@@ -28,6 +28,7 @@
 #include <vector>
 #include <bitset>
 #include "PrivMgrDefs.h"
+#include "PrivMgrDesc.h"
 
 class ComSecurityKey;
 class ComDiagsArea;
@@ -333,6 +334,11 @@
     return false;
   }
 
+  bool setPrivInfoAndKeys ( PrivMgrDescList &privDescs,
+                            const int32_t userID,
+                            const int64_t objectUID,
+                            NASet<ComSecurityKey> *secKeySet);
+
   PrivColList & getColPrivList() {return colPrivsList_;}
   void setColPrivList(PrivColList colPrivsList)
      {colPrivsList_ = colPrivsList;}
@@ -379,11 +385,14 @@
   bool getHasPublicPriv() { return hasPublicPriv_; }
   void setHasPublicPriv(bool hasPublicPriv) {hasPublicPriv_ = hasPublicPriv;}
   void initUserPrivs (PrivMgrDesc &privsOfTheGrantor);
-  bool initUserPrivs ( const std::vector<int32_t> &roleIDs,
-                       const TrafDesc *priv_desc,
+
+  bool initUserPrivs ( const NAList<Int32> &roleIDs,
+                       PrivMgrDescList *privDescs,
                        const int32_t userID,
                        const int64_t objectUID,
-                       NASet<ComSecurityKey> & secKeySet);
+                       NASet<ComSecurityKey> *secKeySet = NULL);
+
+  std::string print();
 
  private:
    PrivObjectBitmap objectBitmap_;
diff --git a/core/sql/sqlcomp/nadefaults.cpp b/core/sql/sqlcomp/nadefaults.cpp
index a43a201..7f33f4a 100644
--- a/core/sql/sqlcomp/nadefaults.cpp
+++ b/core/sql/sqlcomp/nadefaults.cpp
@@ -1119,6 +1119,7 @@
   DDui2__(DYN_QUEUE_RESIZE_INIT_DOWN,		"4"),
   DDui2__(DYN_QUEUE_RESIZE_INIT_UP,		"4"),
   DDui1__(DYN_QUEUE_RESIZE_LIMIT,		"9"),
+  DDkwd__(DYN_QUEUE_RESIZE_OVERRIDE,             "OFF"),
 
   DDkwd__(EID_SPACE_USAGE_OPT,			"OFF"),
 
@@ -1319,7 +1320,7 @@
   DDui1__(GEN_MJ_BUFFER_SIZE,			"32768"),
   DDui1__(GEN_MJ_NUM_BUFFERS,			"1"),
   DDui1__(GEN_MJ_SIZE_DOWN,			"2"),
-  DDui1__(GEN_MJ_SIZE_UP,			"1024"),
+  DDui1__(GEN_MJ_SIZE_UP,			"2048"),
   DDui1__(GEN_ONLJ_BUFFER_SIZE,			"5120"),
   DDui1__(GEN_ONLJ_LEFT_CHILD_QUEUE_DOWN,       "4"),
   DDui1__(GEN_ONLJ_LEFT_CHILD_QUEUE_UP,         "2048"),
@@ -1338,10 +1339,10 @@
   DDui1__(GEN_PROBE_CACHE_SIZE_UP,              "2048"),
   DDui1__(GEN_SAMPLE_SIZE_DOWN,			"16"),
   DDui1__(GEN_SAMPLE_SIZE_UP,			"16"),
-  DDui1__(GEN_SEQFUNC_BUFFER_SIZE,		"5120"),
-  DDui1__(GEN_SEQFUNC_NUM_BUFFERS,		"5"),
-  DDui1__(GEN_SEQFUNC_SIZE_DOWN,		"16"),
-  DDui1__(GEN_SEQFUNC_SIZE_UP,			"16"),
+  DDui1__(GEN_SEQFUNC_BUFFER_SIZE,		"10240"),
+  DDui1__(GEN_SEQFUNC_NUM_BUFFERS,		"10"),
+  DDui1__(GEN_SEQFUNC_SIZE_DOWN,		"512"),
+  DDui1__(GEN_SEQFUNC_SIZE_UP,			"2048"),
   DDui1__(GEN_SGBY_BUFFER_SIZE,			"5120"),
   DDui1__(GEN_SGBY_NUM_BUFFERS,			"5"),
   DDui1__(GEN_SGBY_SIZE_DOWN,			"2048"),
@@ -1360,7 +1361,7 @@
   DDui1__(GEN_SORT_MAX_BUFFER_SIZE,		"5242880"),
   DDui1__(GEN_SORT_MAX_NUM_BUFFERS,             "160"),
   DDui1__(GEN_SORT_NUM_BUFFERS,			"2"),
-  DDui1__(GEN_SORT_SIZE_DOWN,			"2"),
+  DDui1__(GEN_SORT_SIZE_DOWN,			"8"),
   DDui1__(GEN_SORT_SIZE_UP,			"1024"),
   DDkwd__(GEN_SORT_TOPN,		        "ON"),
   DDui1__(GEN_SORT_TOPN_THRESHOLD,              "10000"),
@@ -1381,8 +1382,8 @@
   DDui1__(GEN_TRAN_SIZE_UP,			"4"),
   DDui1__(GEN_TRSP_BUFFER_SIZE,			"10240"),
   DDui1__(GEN_TRSP_NUM_BUFFERS,			"5"),
-  DDui1__(GEN_TRSP_SIZE_DOWN,			"16"),
-  DDui1__(GEN_TRSP_SIZE_UP,			"16"),
+  DDui1__(GEN_TRSP_SIZE_DOWN,			"2048"),
+  DDui1__(GEN_TRSP_SIZE_UP,			"2048"),
   DDui1__(GEN_TUPL_BUFFER_SIZE,			"1024"),
   DDui1__(GEN_TUPL_NUM_BUFFERS,			"4"),
   DDui1__(GEN_TUPL_SIZE_DOWN,			"2048"),
@@ -1403,9 +1404,8 @@
 
   DDui1__(GEN_UN_BUFFER_SIZE,			"10240"),
   DDui1__(GEN_UN_NUM_BUFFERS,			"5"),
-  DDui1__(GEN_UN_SIZE_DOWN,			"8"),
-  DDui1__(GEN_UN_SIZE_UP,			"16"),
-
+  DDui1__(GEN_UN_SIZE_DOWN,			"2048"),
+  DDui1__(GEN_UN_SIZE_UP,			"2048"),
 
 
   // When less or equal to this CQD (5000 rows by default), a partial root 
@@ -2954,6 +2954,8 @@
   DD_____(TRAF_SAMPLE_TABLE_LOCATION,                  "/user/trafodion/sample/"),
   DDint__(TRAF_SEQUENCE_CACHE_SIZE,        "-1"),
 
+  DDint__(TRAF_SEQUENCE_RETRY_TIMES,        "100"),
+
   DDkwd__(TRAF_SIMILARITY_CHECK,			"ROOT"),
 
   DDkwd__(TRAF_STORE_OBJECT_DESC,                    "OFF"),   
diff --git a/core/sql/sqludr/SqlUdrPredefLogReader.cpp b/core/sql/sqludr/SqlUdrPredefLogReader.cpp
index 255e3ad..dac87c5 100644
--- a/core/sql/sqludr/SqlUdrPredefLogReader.cpp
+++ b/core/sql/sqludr/SqlUdrPredefLogReader.cpp
@@ -530,37 +530,29 @@
   {
     char* logrootdir = NULL;
     char* confrootdir = NULL;
+
+    logrootdir = getenv("TRAF_LOG");
+    if (strlen(logrootdir) > 1000)
+	throw UDRException(38001, "TRAF_LOG 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");
+      logDirName += "/rest";
       break ;
     default:
       throw UDRException(38001, "Internal error in determining logroot directory");
     }
       
-    std::string logDirName(logrootdir);
     std::string logFileName;
     std::string eventLogFileName(logrootdir);
     
-    logDirName += "/logs";
-    
     if (doTrace)
     {
       printf("(%d) EVENT_LOG_READER open log dir %s\n", pid, logDirName.data());
diff --git a/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java b/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java
index 8853495..ddd7a7b 100644
--- a/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java
+++ b/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java
@@ -1275,15 +1275,15 @@
       final String HFILE_NAME_PATTERN  = "[0-9a-f]*";
 
       // To estimate incidence of nulls, read the first 500 rows worth
-      // of KeyValues.
-      final int ROWS_TO_SAMPLE = 500;
+      // of KeyValues. For aligned format (numCols == 1), the whole row 
+      // is in one cell so we don't need to look for missing cells.
+      final int ROWS_TO_SAMPLE = ((numCols > 1) ? 500 : 0);  // don't bother sampling for aligned format
       int putKVsSampled = 0;
       int nonPutKVsSampled = 0;
       int missingKVsCount = 0;
       int sampleRowCount = 0;
       long totalEntries = 0;   // KeyValues in all HFiles for table
       long totalSizeBytes = 0; // Size of all HFiles for table 
-      long estimatedTotalPuts = 0;
       boolean more = true;
 
       // Make sure the config doesn't specify HBase bucket cache. If it does,
@@ -1398,13 +1398,32 @@
       long estimatedEntries = (ROWS_TO_SAMPLE > 0
                                  ? 0               // get from sample data, below
                                  : totalEntries);  // no sampling, use stored value
-      if (putKVsSampled > 0) // avoid div by 0 if no Put KVs in sample
-        {
-          estimatedTotalPuts = (putKVsSampled * totalEntries) / 
-                               (putKVsSampled + nonPutKVsSampled);
-          estimatedEntries = ((putKVsSampled + missingKVsCount) * estimatedTotalPuts)
+      if ((putKVsSampled > 0) && // avoid div by 0 if no Put KVs in sample
+          (putKVsSampled >= ROWS_TO_SAMPLE/10)) { // avoid really small samples
+        // Formerly, we would multiply this by a factor of 
+        // putKVsSampled / (putKVsSampled + nonPutKVsSampled).
+        // If non-put records are evenly distributed among the cells, then
+        // that would give a better estimate. However, we find that often
+        // (e.g. time-ordered data that is being aged out), the non-put cells
+        // clump up in one place -- they might even take a whole HFile!
+        // There is no real way to compensate other than reading the entire
+        // table. So, we don't try to scale down the number of rows based 
+        // on the proportion of non-Put cells. That means the value below
+        // will sometimes over-estimate, but it is much better to over-
+        // estimate than to under-estimate when it comes to row counts.
+        estimatedEntries = ((putKVsSampled + missingKVsCount) * totalEntries)
                                    / putKVsSampled;
-        }
+      } else { // few or no Puts found
+        // The first file might have been full of deletes, which can happen
+        // when time-ordered data ages out. We don't want to infer that the
+        // table as a whole is all deletes (it almost certainly isn't in the
+        // time-ordered data age-out case). We could just keep reading HFiles
+        // until we find one with a decent sample of rows but that might take
+        // awhile. Instead, we'll just punt and use totalEntries for our
+        // estimate. This will over-estimate, but it is far better to do that
+        // than to under-estimate.
+        estimatedEntries = totalEntries;
+      }
 
       // Calculate estimate of rows in all HFiles of table.
       rc[0] = (estimatedEntries + (numCols/2)) / numCols; // round instead of truncate
@@ -1442,8 +1461,6 @@
       long memStoreRows = estimateMemStoreRows(tblName, rowSize);
 
       if (logger.isDebugEnabled()) logger.debug(tblName + " contains a total of " + totalEntries + " KeyValues in all HFiles.");
-      if (logger.isDebugEnabled()) logger.debug("Based on a sample, it is estimated that " + estimatedTotalPuts +
-                   " of these KeyValues are of type Put.");
       if (putKVsSampled + missingKVsCount > 0)
         if (logger.isDebugEnabled()) logger.debug("Sampling indicates a null incidence of " + 
                      (missingKVsCount * 100)/(putKVsSampled + missingKVsCount) +
@@ -1555,13 +1572,33 @@
       long estimatedEntries = ((ROWS_TO_SAMPLE > 0) && (numCols > 1)
                                  ? 0               // get from sample data, below
                                  : totalEntries);  // no sampling, use stored value
-      if (putKVsSampled > 0) // avoid div by 0 if no Put KVs in sample
-        {
-          long estimatedTotalPuts = (putKVsSampled * totalEntries) / 
-                               (putKVsSampled + nonPutKVsSampled);
-          estimatedEntries = ((putKVsSampled + missingKVsCount) * estimatedTotalPuts)
+
+      if ((putKVsSampled > 0) && // avoid div by 0 if no Put KVs in sample
+          (putKVsSampled >= ROWS_TO_SAMPLE/10)) { // avoid really small samples
+        // Formerly, we would multiply this by a factor of 
+        // putKVsSampled / (putKVsSampled + nonPutKVsSampled).
+        // If non-put records are evenly distributed among the cells, then
+        // that would give a better estimate. However, we find that often
+        // (e.g. time-ordered data that is being aged out), the non-put cells
+        // clump up in one place -- they might even take a whole HFile!
+        // There is no real way to compensate other than reading the entire
+        // table. So, we don't try to scale down the number of rows based 
+        // on the proportion of non-Put cells. That means the value below
+        // will sometimes over-estimate, but it is much better to over-
+        // estimate than to under-estimate when it comes to row counts.
+        estimatedEntries = ((putKVsSampled + missingKVsCount) * totalEntries)
                                    / putKVsSampled;
-        }
+      } else { // few or no Puts found
+        // The first file might have been full of deletes, which can happen
+        // when time-ordered data ages out. We don't want to infer that the
+        // table as a whole is all deletes (it almost certainly isn't in the
+        // time-ordered data age-out case). We could just keep reading HFiles
+        // until we find one with a decent sample of rows but that might take
+        // awhile. Instead, we'll just punt and use totalEntries for our
+        // estimate. This will over-estimate, but it is far better to do that
+        // than to under-estimate.
+        estimatedEntries = totalEntries;
+      }
 
       if (logger.isDebugEnabled()) { 
         logger.debug("estimatedEntries = " + estimatedEntries + ", numCols = " + numCols);
diff --git a/core/sql/src/main/java/org/trafodion/sql/OrcFileReader.java b/core/sql/src/main/java/org/trafodion/sql/OrcFileReader.java
index c0ee050..b3913de 100644
--- a/core/sql/src/main/java/org/trafodion/sql/OrcFileReader.java
+++ b/core/sql/src/main/java/org/trafodion/sql/OrcFileReader.java
@@ -52,8 +52,8 @@
 	*/
     	String confFile = System.getProperty("trafodion.log4j.configFile");
     	if (confFile == null) {
-    		System.setProperty("trafodion.sql.log", System.getenv("TRAF_HOME") + "/logs/trafodion.sql.java.log");
-    		confFile = System.getenv("TRAF_HOME") + "/conf/log4j.sql.config";
+    		System.setProperty("trafodion.sql.log", System.getenv("TRAF_LOG") + "/trafodion.sql.java.log");
+    		confFile = System.getenv("TRAF_CONF") + "/log4j.sql.config";
     	}
     	PropertyConfigurator.configure(confFile);
 	m_conf = TrafConfiguration.create(TrafConfiguration.HDFS_CONF);
diff --git a/core/sql/src/main/java/org/trafodion/sql/SequenceFileReader.java b/core/sql/src/main/java/org/trafodion/sql/SequenceFileReader.java
index 20e648a..88995cc 100644
--- a/core/sql/src/main/java/org/trafodion/sql/SequenceFileReader.java
+++ b/core/sql/src/main/java/org/trafodion/sql/SequenceFileReader.java
@@ -57,7 +57,7 @@
   static { 
     String confFile = System.getProperty("trafodion.log4j.configFile");
     if (confFile == null) {
-   	System.setProperty("trafodion.sql.log", System.getenv("TRAF_HOME") + "/logs/trafodion.sql.java.log");
+   	System.setProperty("trafodion.sql.log", System.getenv("TRAF_LOG") + "/trafodion.sql.java.log");
     	confFile = System.getenv("TRAF_CONF") + "/log4j.sql.config";
     }
     PropertyConfigurator.configure(confFile);
diff --git a/core/sql/ustat/hs_globals.cpp b/core/sql/ustat/hs_globals.cpp
index d6069e8..6fd65df 100644
--- a/core/sql/ustat/hs_globals.cpp
+++ b/core/sql/ustat/hs_globals.cpp
@@ -3803,12 +3803,12 @@
 // the fully-qualified table names.
 void HSGlobalsClass::initJITLogData()
 {
-  char* sqroot = getenv("TRAF_HOME");
-  if (!sqroot)
+  char* sqlogs = getenv("TRAF_LOG");
+  if (!sqlogs)
     return;
   
-  NAString filePath = sqroot;
-  filePath.append("/logs/jit_ulog_params");
+  NAString filePath = sqlogs;
+  filePath.append("/jit_ulog_params");
   FILE* jitParamFile = fopen(filePath.data(), "r");
   if (!jitParamFile)
     return;
diff --git a/dcs/bin/dcs b/dcs/bin/dcs
index 1c91600..42c5900 100755
--- a/dcs/bin/dcs
+++ b/dcs/bin/dcs
@@ -168,7 +168,7 @@
 
 # default log directory & file
 if [ "$DCS_LOG_DIR" = "" ]; then
-  DCS_LOG_DIR="$DCS_HOME/logs"
+  DCS_LOG_DIR="$TRAF_LOG/dcs"
 fi
 if [ "$DCS_LOGFILE" = "" ]; then
   DCS_LOGFILE='dcs.log'
diff --git a/dcs/bin/dcs-daemon.sh b/dcs/bin/dcs-daemon.sh
index 36f9650..63f9d32 100755
--- a/dcs/bin/dcs-daemon.sh
+++ b/dcs/bin/dcs-daemon.sh
@@ -97,12 +97,12 @@
 
 # get log directory
 if [ "$DCS_LOG_DIR" = "" ]; then
-  export DCS_LOG_DIR="$DCS_HOME/logs"
+  export DCS_LOG_DIR="$TRAF_LOG/dcs"
 fi
 mkdir -p "$DCS_LOG_DIR"
 
 if [ "$DCS_PID_DIR" = "" ]; then
-  DCS_PID_DIR="$DCS_HOME/tmp"
+  DCS_PID_DIR="$TRAF_VAR"
 fi
 
 #DCS_IDENT_STRING can be set in environment to uniquely identify dcs instances
diff --git a/dcs/conf/dcs-env.sh b/dcs/conf/dcs-env.sh
index 224791c..0bc4a31 100644
--- a/dcs/conf/dcs-env.sh
+++ b/dcs/conf/dcs-env.sh
@@ -92,8 +92,8 @@
 # Extra ssh options.  Empty by default.
 # export DCS_SSH_OPTS="-o ConnectTimeout=1 -o SendEnv=DCS_CONF_DIR"
 
-# Where log files are stored.  $DCS_HOME/logs by default.
-# export DCS_LOG_DIR=${DCS_HOME}/logs
+# Where log files are stored.  $TRAF_LOG/dcs by default.
+# export DCS_LOG_DIR=$TRAF_LOG/dcs
 
 # Enable remote JDWP debugging of major dcs processes. Meant for Core Developers 
 # export DCS_MASTER_OPTS="$DCS_MASTER_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8070"
diff --git a/dcs/src/main/asciidoc/_chapters/troubleshooting.adoc b/dcs/src/main/asciidoc/_chapters/troubleshooting.adoc
index 814e74b..87fa3d4 100644
--- a/dcs/src/main/asciidoc/_chapters/troubleshooting.adoc
+++ b/dcs/src/main/asciidoc/_chapters/troubleshooting.adoc
@@ -34,9 +34,9 @@
 == Logs
 The key process logs are as follows...(replace <user> with the user that started the service, <instance> for the server instance and <hostname> for the machine name)
  
-* DcsMaster: $DCS_HOME/logs/dcs-<user>-<instance>-master-<hostname>.log
-* DcsServer: $DCS_HOME/logs/dcs-<user>-<instance>-server-<hostname>.log
-* ZooKeeper: $DCS_HOME/logs/dcs-<user>-<instance>-zookeeper-<hostname>.log
+* DcsMaster: $TRAF_LOG/dcs/dcs-<user>-<instance>-master-<hostname>.log
+* DcsServer: $TRAF_LOG/dcs/dcs-<user>-<instance>-server-<hostname>.log
+* ZooKeeper: $TRAF_LOG/dcs/dcs-<user>-<instance>-zookeeper-<hostname>.log
 
 [[trouble-resources]]
 == Resources 
@@ -155,7 +155,7 @@
 
 [[trouble-ha]]
 == High Availability
-On Linux cluster, if you run into issues please check dcs log files located in $DCS_INSTALL_DIR/logs folder. 
+On Linux cluster, if you run into issues please check dcs log files located in $TRAF_LOG/dcs folder. 
 
 Validate that the interace is set up correctly. This command should only show one additional interface for HA configuration
 ----
diff --git a/docs/cqd_reference/src/asciidoc/_chapters/operational_controls.adoc b/docs/cqd_reference/src/asciidoc/_chapters/operational_controls.adoc
index dd4ff8b..ac3eb72 100644
--- a/docs/cqd_reference/src/asciidoc/_chapters/operational_controls.adoc
+++ b/docs/cqd_reference/src/asciidoc/_chapters/operational_controls.adoc
@@ -143,7 +143,7 @@
 A query cache setting of *'16384'* means a maximum of 16,384 KB of compiler memory can be used for keeping previously compiled plans
 before evicting the oldest unused plan(s) to make room for the latest cacheable plan.
 | *Values*                    |
-*Up through 4294967295*: Kilobytes of memory allocated to query cache. +
+*Up through 200,000*: Kilobytes of memory allocated to query cache. +
 *'0'*: Turns off query plan caching. +
  +
 The default value is *'16384'* (16 MB).
diff --git a/docs/cqd_reference/src/asciidoc/_chapters/query_execution.adoc b/docs/cqd_reference/src/asciidoc/_chapters/query_execution.adoc
index 5e41c99..3391fed 100644
--- a/docs/cqd_reference/src/asciidoc/_chapters/query_execution.adoc
+++ b/docs/cqd_reference/src/asciidoc/_chapters/query_execution.adoc
@@ -288,3 +288,34 @@
 | *Introduced In Release*     | Trafodion 2.1.
 | *Deprecated In Release*     | Not applicable.
 |===
+
+
+<<<
+[[sequence_retry_time]]
+== TRAF_SEQUENCE_RETRY_TIMES
+
+[cols="25%h,75%"]
+|===
+| *Description*               |	Set the max retry time when concurrent processes try to get next sequence conflict
+| *Values*                    |
+Numeric value. 
+The default value is *'100'*. 
+
+| *Usage*                     a|
+Multiple clients try to do NEXT operation on a same sequence, when cache runs out, all of the clients try to get the next range and go into race. So one client may get a range that another client already got. So Trafodion needs to do concurrent control in this case.
+After the SQL engine gets the next range from system metadata table, it will set an upate timestamp. Each time it get the next range,  it will check the updated timestamp, if it is same as the timestampt set by itself, then it is successful. Otherwise, the range is obtained by some other concurrent clients. Then the engine wait and retry.
+
+When concurrency conflict is very high, for example a query is running with high DOP and processing billions of rows, it is possible to fail due to run out of retry time. In that case, user will get SQL ERROR-1583.
+
+This CQD is to set the retry number. It is set to 100 by default. When specific query using sequence run into SQL ERROR-1583, one can increase this CQD to allow SQL engine to retry for more times, and avoid the SQL ERROR-1583.
+
+| *Production Usage*          | Please contact {project-support}.
+| *Impact*                    |
+It will allow the user to avoid 1583 ERROR in high concurrent use cases.
+
+| *Level*                     | System.
+| *Conflicts/Synergies*       | Not applicable.
+| *Real Problem Addressed*    | Not applicable.
+| *Introduced In Release*     | Trafodion 2.1.
+| *Deprecated In Release*     | Not applicable.
+|===
diff --git a/docs/cqd_reference/src/asciidoc/_chapters/query_plans.adoc b/docs/cqd_reference/src/asciidoc/_chapters/query_plans.adoc
index 2791e96..c1548cb 100644
--- a/docs/cqd_reference/src/asciidoc/_chapters/query_plans.adoc
+++ b/docs/cqd_reference/src/asciidoc/_chapters/query_plans.adoc
@@ -40,11 +40,11 @@
 | *Values*                    |
 Unsigned Integer. +
  +
-The default value is *'16'*.
+The default value is *2*.
 | *Usage*                     | For systems running at higher levels of concurrency with workloads that include a large 
 number of small queries, reducing the default degree of parallelism may help achieve higher throughput. +
  +
-With the default of 16, for 32-node systems, adaptive segmentation can use two 16-node virtual segments to execute queries that 
+If the degree of parallelism is 16, for 32-node systems, adaptive segmentation can use two 16-node virtual segments to execute queries that 
 do not require a degree of parallelism of 32.  This default setting can, for example, be changed to 8 for a 16-node system, 
 to allow adaptive segmentation to leverage a lower degree of parallelism.
 
diff --git a/docs/provisioning_guide/src/asciidoc/_chapters/activate.adoc b/docs/provisioning_guide/src/asciidoc/_chapters/activate.adoc
index 1cc092c..19dad44 100644
--- a/docs/provisioning_guide/src/asciidoc/_chapters/activate.adoc
+++ b/docs/provisioning_guide/src/asciidoc/_chapters/activate.adoc
@@ -145,4 +145,4 @@
  
 If problems persist please review logs:
 
-* `$TRAF_HOME/logs`: {project-name} logs.
+* `$TRAF_LOG`: {project-name} logs.
diff --git a/docs/src/site/markdown/management.md b/docs/src/site/markdown/management.md
index 587cab3..b103b18 100644
--- a/docs/src/site/markdown/management.md
+++ b/docs/src/site/markdown/management.md
@@ -59,4 +59,4 @@
 If problems persist please review logs:
 
 * **```$TRAF_HOME/sql/local_hadoop/\*/log```**: Hadoop, HBase, and Hive logs.
-* **```$TRAF_HOME/logs```**: Trafodion logs.
\ No newline at end of file
+* **```$TRAF_LOG```**: Trafodion logs.
diff --git a/install/ambari-installer/traf-mpack/common-services/TRAFODION/2.1/configuration/dcs-env.xml b/install/ambari-installer/traf-mpack/common-services/TRAFODION/2.1/configuration/dcs-env.xml
index b168db1..c2fb449 100644
--- a/install/ambari-installer/traf-mpack/common-services/TRAFODION/2.1/configuration/dcs-env.xml
+++ b/install/ambari-installer/traf-mpack/common-services/TRAFODION/2.1/configuration/dcs-env.xml
@@ -110,8 +110,8 @@
 # Extra ssh options.  Empty by default.
 # export DCS_SSH_OPTS="-o ConnectTimeout=1 -o SendEnv=DCS_CONF_DIR"
 
-# Where log files are stored.  $DCS_HOME/logs by default.
-# export DCS_LOG_DIR=${DCS_HOME}/logs
+# Where log files are stored.  $TRAF_LOG/dcs by default.
+# export DCS_LOG_DIR=$TRAF_LOG/dcs
 
 # Enable remote JDWP debugging of major dcs processes. Meant for Core Developers 
 # export DCS_MASTER_OPTS="$DCS_MASTER_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8070"
diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile
index c849072..3a9111b 100644
--- a/tools/docker/Dockerfile
+++ b/tools/docker/Dockerfile
@@ -18,7 +18,7 @@
 MAINTAINER Trafodion Community <dev@trafodion.apache.org>
 
 LABEL Vendor="Apache Trafodion"
-LABEL version=unstable
+LABEL version=stable
 
 # download and install environment dependencies
 RUN	yum install -y epel-release alsa-lib-devel ant ant-nodeps boost-devel cmake \
diff --git a/tools/docker/build-base-docker.sh b/tools/docker/build-base-docker.sh
index a280321..4f23342 100755
--- a/tools/docker/build-base-docker.sh
+++ b/tools/docker/build-base-docker.sh
@@ -19,7 +19,7 @@
 
 BASE_SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
 
-export DOCKER_ENV_VERSION="0.1"
+export DOCKER_ENV_VERSION="2.3"
 export BASE_IMAGE_NAME="trafodion/base:${DOCKER_ENV_VERSION}"
 
 pushd ${BASE_SCRIPT_DIR}
diff --git a/win-odbc64/Install/win64_installer/installer.iss b/win-odbc64/Install/win64_installer/installer.iss
index 7b4b2e5..e84a511 100644
--- a/win-odbc64/Install/win64_installer/installer.iss
+++ b/win-odbc64/Install/win64_installer/installer.iss
@@ -18,11 +18,11 @@
 ; Script generated by the Inno Script Studio Wizard.
 ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
 
-#define MyAppName "Trafodion ODBC64 2.2"
-#define MyAppVersion "2.2.0"
+#define MyAppName "Trafodion ODBC64 2.3"
+#define MyAppVersion "2.3.0"
 #define MyAppPublisher "Apache Trafodion"
 #define MyAppURL ""
-#define MyDriverName "TRAF ODBC 2.2"
+#define MyDriverName "TRAF ODBC 2.3"
 #define BUILDDIR  GetEnv('BUILDDIR')
 
 [Setup]
@@ -38,7 +38,7 @@
 AppSupportURL={#MyAppURL}
 AppUpdatesURL={#MyAppURL}
 DefaultGroupName={#MyAppName}
-DefaultDirName={pf}\Trafodion\TRAF ODBC 2.2
+DefaultDirName={pf}\Trafodion\TRAF ODBC 2.3
 OutputBaseFilename=TFODBC64-{#MyAppVersion}
 Compression=lzma
 SolidCompression=yes
diff --git a/win-odbc64/odbcclient/DSNConverter/DSNConverter.def b/win-odbc64/odbcclient/DSNConverter/DSNConverter.def
index c96c6a5..778bfbc 100644
--- a/win-odbc64/odbcclient/DSNConverter/DSNConverter.def
+++ b/win-odbc64/odbcclient/DSNConverter/DSNConverter.def
@@ -23,7 +23,7 @@
 

 ; DSNConverter.def : Declares the module parameters for the DLL.

 

-DESCRIPTION "ODBC/MX DSN Converter DLL, (C) Copyright (c) 2015-2017 Apache Software Foundation"

+DESCRIPTION "ODBC/MX DSN Converter DLL, (C) Copyright (c) 2015-2018 Apache Software Foundation"

 LIBRARY DSNConverter

 EXPORTS

 	IsDriverInstalled @1

diff --git a/win-odbc64/odbcclient/Drvr35Res/Drvr35Res.rc b/win-odbc64/odbcclient/Drvr35Res/Drvr35Res.rc
index d778f8c..6ac1674 100644
--- a/win-odbc64/odbcclient/Drvr35Res/Drvr35Res.rc
+++ b/win-odbc64/odbcclient/Drvr35Res/Drvr35Res.rc
@@ -73,8 +73,8 @@
 //

 

 VS_VERSION_INFO VERSIONINFO

- FILEVERSION 2,2,0,0

- PRODUCTVERSION 2,2,0,0

+ FILEVERSION 2,3,0,0

+ PRODUCTVERSION 2,3,0,0

  FILEFLAGSMASK 0x3fL

 #ifdef _DEBUG

  FILEFLAGS 0x1L

@@ -91,12 +91,12 @@
         BEGIN

             VALUE "CompanyName", "Apache Trafodion"

             VALUE "FileDescription", "TRAF ODBC Driver Resource DLL"

-            VALUE "FileVersion", "2.2.0.0"

+            VALUE "FileVersion", "2.3.0.0"

             VALUE "InternalName", "TRAF ODBC Driver Resource DLL"

-            VALUE "LegalCopyright", "?Copyright 2015-2017 Apache Software Foundation"

+            VALUE "LegalCopyright", "?Copyright 2015-2018 Apache Software Foundation"

             VALUE "OriginalFilename", "traf_ores0100.dll"

             VALUE "ProductName", "TRAF ODBC"

-            VALUE "ProductVersion", "2.2.0.0"

+            VALUE "ProductVersion", "2.3.0.0"

         END

     END

     BLOCK "VarFileInfo"

diff --git a/win-odbc64/odbcclient/Drvr35Res/Drvr35Res_os.vcxproj b/win-odbc64/odbcclient/Drvr35Res/Drvr35Res_os.vcxproj
index 880d8f2..970db42 100755
--- a/win-odbc64/odbcclient/Drvr35Res/Drvr35Res_os.vcxproj
+++ b/win-odbc64/odbcclient/Drvr35Res/Drvr35Res_os.vcxproj
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>

-<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

   <ItemGroup Label="ProjectConfigurations">

     <ProjectConfiguration Include="Debug|Win32">

       <Configuration>Debug</Configuration>

@@ -39,13 +39,13 @@
     <ConfigurationType>DynamicLibrary</ConfigurationType>

     <UseOfMfc>Dynamic</UseOfMfc>

     <CharacterSet>MultiByte</CharacterSet>

-    <PlatformToolset>v140</PlatformToolset>

+    <PlatformToolset>v120</PlatformToolset>

   </PropertyGroup>

   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">

     <ConfigurationType>DynamicLibrary</ConfigurationType>

     <UseOfMfc>Dynamic</UseOfMfc>

     <CharacterSet>MultiByte</CharacterSet>

-    <PlatformToolset>v140</PlatformToolset>

+    <PlatformToolset>v120</PlatformToolset>

   </PropertyGroup>

   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />

   <ImportGroup Label="ExtensionSettings">

diff --git a/win-odbc64/odbcclient/TranslationDll/TranslationDll.def b/win-odbc64/odbcclient/TranslationDll/TranslationDll.def
index 3517aa4..8a831de 100644
--- a/win-odbc64/odbcclient/TranslationDll/TranslationDll.def
+++ b/win-odbc64/odbcclient/TranslationDll/TranslationDll.def
@@ -21,7 +21,7 @@
 

 ; TranslationDll.def : Declares the module parameters for the DLL.

 

-;DESCRIPTION "ODBC Translation DLL, Copyright (c) 2015-2017 Apache Software Foundation"

+;DESCRIPTION "ODBC Translation DLL, Copyright (c) 2015-2018 Apache Software Foundation"

 LIBRARY hp_translation03

 EXPORTS

 	SQLDriverToDataSource @1

diff --git a/win-odbc64/odbcclient/TranslationDll/TranslationDll.rc b/win-odbc64/odbcclient/TranslationDll/TranslationDll.rc
index 4ed1e2f..2d6c1c1 100644
--- a/win-odbc64/odbcclient/TranslationDll/TranslationDll.rc
+++ b/win-odbc64/odbcclient/TranslationDll/TranslationDll.rc
@@ -25,8 +25,8 @@
 //

 

 VS_VERSION_INFO VERSIONINFO

- FILEVERSION 2,2,0,0

- PRODUCTVERSION 2,2,0,0

+ FILEVERSION 2,3,0,0

+ PRODUCTVERSION 2,3,0,0

  FILEFLAGSMASK 0x3fL

 #ifdef _DEBUG

  FILEFLAGS 0x1L

@@ -43,12 +43,12 @@
         BEGIN

             VALUE "CompanyName", "Apache Trafodion"

             VALUE "FileDescription", "TRAF ODBC Translation DLL"

-            VALUE "FileVersion", "2.2.0.0"

+            VALUE "FileVersion", "2.3.0.0"

             VALUE "InternalName", "TRAF ODBC Translation DLL"

-            VALUE "LegalCopyright", "?Copyright 2015-2017 Apache Software Foundation"

+            VALUE "LegalCopyright", "?Copyright 2015-2018 Apache Software Foundation"

             VALUE "OriginalFilename", "traf_translation01.dll"

             VALUE "ProductName", "TRAF ODBC"

-            VALUE "ProductVersion", "2.2.0.0"

+            VALUE "ProductVersion", "2.3.0.0"

         END

     END

     BLOCK "VarFileInfo"

diff --git a/win-odbc64/odbcclient/TranslationDll/TranslationDll_os.vcxproj b/win-odbc64/odbcclient/TranslationDll/TranslationDll_os.vcxproj
index 951ce36..2f2b797 100755
--- a/win-odbc64/odbcclient/TranslationDll/TranslationDll_os.vcxproj
+++ b/win-odbc64/odbcclient/TranslationDll/TranslationDll_os.vcxproj
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>

-<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

   <ItemGroup Label="ProjectConfigurations">

     <ProjectConfiguration Include="Debug|Win32">

       <Configuration>Debug</Configuration>

@@ -27,17 +27,17 @@
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">

     <ConfigurationType>DynamicLibrary</ConfigurationType>

     <CharacterSet>MultiByte</CharacterSet>

-    <PlatformToolset>v140</PlatformToolset>

+    <PlatformToolset>v120</PlatformToolset>

   </PropertyGroup>

   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">

     <ConfigurationType>DynamicLibrary</ConfigurationType>

     <CharacterSet>MultiByte</CharacterSet>

-    <PlatformToolset>v140</PlatformToolset>

+    <PlatformToolset>v120</PlatformToolset>

   </PropertyGroup>

   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">

     <ConfigurationType>DynamicLibrary</ConfigurationType>

     <CharacterSet>MultiByte</CharacterSet>

-    <PlatformToolset>v140</PlatformToolset>

+    <PlatformToolset>v120</PlatformToolset>

   </PropertyGroup>

   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">

     <ConfigurationType>DynamicLibrary</ConfigurationType>

diff --git a/win-odbc64/odbcclient/build_os.bat b/win-odbc64/odbcclient/build_os.bat
index f81567c..d2a0b30 100644
--- a/win-odbc64/odbcclient/build_os.bat
+++ b/win-odbc64/odbcclient/build_os.bat
@@ -155,10 +155,10 @@
 )
 
 ISCC.exe /Q %BUILDDIR%\win-odbc64\Install\win64_installer\installer.iss
-copy /Y %BUILDDIR%\win-odbc64\Install\win64_installer\Output\TFODBC64-2.2.0.exe %PACKDIR%
+copy /Y %BUILDDIR%\win-odbc64\Install\win64_installer\Output\TFODBC64-2.3.0.exe %PACKDIR%
 @echo on
 
-if exist %PACKDIR%\TFODBC64-2.2.0.exe (
+if exist %PACKDIR%\TFODBC64-2.3.0.exe (
 	set ALL_SUCCESS=1
 )
 cd %BUILDDIR%\win-odbc64\odbcclient
diff --git a/win-odbc64/odbcclient/drvr35/TCPIPV4/TCPIPV4.RC b/win-odbc64/odbcclient/drvr35/TCPIPV4/TCPIPV4.RC
index 4bb903c..0db9b09 100644
--- a/win-odbc64/odbcclient/drvr35/TCPIPV4/TCPIPV4.RC
+++ b/win-odbc64/odbcclient/drvr35/TCPIPV4/TCPIPV4.RC
@@ -25,8 +25,8 @@
 //

 

 VS_VERSION_INFO VERSIONINFO

- FILEVERSION 2,2,0,0

- PRODUCTVERSION 2,2,0,0

+ FILEVERSION 2,3,0,0

+ PRODUCTVERSION 2,3,0,0

  FILEFLAGSMASK 0x3fL

 #ifdef _DEBUG

  FILEFLAGS 0x1L

@@ -43,12 +43,12 @@
         BEGIN

             VALUE "CompanyName", "Apache Trafodion"

             VALUE "FileDescription", "TRAF ODBC TCPIPV4 DLL"

-            VALUE "FileVersion", "2.2.0.0"

+            VALUE "FileVersion", "2.3.0.0"

             VALUE "InternalName", "TRAF ODBC TCPIPV4 DLL"

-            VALUE "LegalCopyright", "?Copyright 2015-2017 Apache Software Foundation"

+            VALUE "LegalCopyright", "?Copyright 2015-2018 Apache Software Foundation"

             VALUE "OriginalFilename", "traf_tcpipv40100.dll"

             VALUE "ProductName", "TRAF ODBC"

-            VALUE "ProductVersion", "2.2.0.0"

+            VALUE "ProductVersion", "2.3.0.0"

         END

     END

     BLOCK "VarFileInfo"

diff --git a/win-odbc64/odbcclient/drvr35/TCPIPV4/TCPIPV4_os.vcxproj b/win-odbc64/odbcclient/drvr35/TCPIPV4/TCPIPV4_os.vcxproj
index c74d916..e9489d8 100755
--- a/win-odbc64/odbcclient/drvr35/TCPIPV4/TCPIPV4_os.vcxproj
+++ b/win-odbc64/odbcclient/drvr35/TCPIPV4/TCPIPV4_os.vcxproj
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>

-<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

   <ItemGroup Label="ProjectConfigurations">

     <ProjectConfiguration Include="Debug|Win32">

       <Configuration>Debug</Configuration>

@@ -27,17 +27,17 @@
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">

     <ConfigurationType>DynamicLibrary</ConfigurationType>

     <CharacterSet>MultiByte</CharacterSet>

-    <PlatformToolset>v140</PlatformToolset>

+    <PlatformToolset>v120</PlatformToolset>

   </PropertyGroup>

   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">

     <ConfigurationType>DynamicLibrary</ConfigurationType>

     <CharacterSet>MultiByte</CharacterSet>

-    <PlatformToolset>v140</PlatformToolset>

+    <PlatformToolset>v120</PlatformToolset>

   </PropertyGroup>

   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">

     <ConfigurationType>DynamicLibrary</ConfigurationType>

     <CharacterSet>MultiByte</CharacterSet>

-    <PlatformToolset>v140</PlatformToolset>

+    <PlatformToolset>v120</PlatformToolset>

   </PropertyGroup>

   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">

     <ConfigurationType>DynamicLibrary</ConfigurationType>

diff --git a/win-odbc64/odbcclient/drvr35/TCPIPV6/TCPIPV6.RC b/win-odbc64/odbcclient/drvr35/TCPIPV6/TCPIPV6.RC
index c43710e..d5d96ce 100644
--- a/win-odbc64/odbcclient/drvr35/TCPIPV6/TCPIPV6.RC
+++ b/win-odbc64/odbcclient/drvr35/TCPIPV6/TCPIPV6.RC
@@ -25,8 +25,8 @@
 //

 

 VS_VERSION_INFO VERSIONINFO

- FILEVERSION 2,2,0,0

- PRODUCTVERSION 2,2,0,0

+ FILEVERSION 2,3,0,0

+ PRODUCTVERSION 2,3,0,0

  FILEFLAGSMASK 0x3fL

 #ifdef _DEBUG

  FILEFLAGS 0x1L

@@ -43,12 +43,12 @@
         BEGIN

             VALUE "CompanyName", "Apache Trafodion"

             VALUE "FileDescription", "TRAF ODBC TCPIPV6 DLL"

-            VALUE "FileVersion", "2.2.0.0"

+            VALUE "FileVersion", "2.3.0.0"

             VALUE "InternalName", "TRAF ODBC TCPIPV6 DLL"

-            VALUE "LegalCopyright", "?Copyright 2015-2017 Apache Software Foundation"

+            VALUE "LegalCopyright", "?Copyright 2015-2018 Apache Software Foundation"

             VALUE "OriginalFilename", "traf_tcpipv60100.dll"

             VALUE "ProductName", "TRAF ODBC"

-            VALUE "ProductVersion", "2.2.0.0"

+            VALUE "ProductVersion", "2.3.0.0"

         END

     END

     BLOCK "VarFileInfo"

diff --git a/win-odbc64/odbcclient/drvr35/TCPIPV6/TCPIPV6_os.vcxproj b/win-odbc64/odbcclient/drvr35/TCPIPV6/TCPIPV6_os.vcxproj
index 2db2996..70f3522 100755
--- a/win-odbc64/odbcclient/drvr35/TCPIPV6/TCPIPV6_os.vcxproj
+++ b/win-odbc64/odbcclient/drvr35/TCPIPV6/TCPIPV6_os.vcxproj
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>

-<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

   <ItemGroup Label="ProjectConfigurations">

     <ProjectConfiguration Include="Debug|Win32">

       <Configuration>Debug</Configuration>

@@ -27,7 +27,7 @@
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">

     <ConfigurationType>DynamicLibrary</ConfigurationType>

     <CharacterSet>MultiByte</CharacterSet>

-    <PlatformToolset>v140</PlatformToolset>

+    <PlatformToolset>v120</PlatformToolset>

   </PropertyGroup>

   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">

     <ConfigurationType>DynamicLibrary</ConfigurationType>

@@ -37,12 +37,12 @@
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">

     <ConfigurationType>DynamicLibrary</ConfigurationType>

     <CharacterSet>MultiByte</CharacterSet>

-    <PlatformToolset>v140</PlatformToolset>

+    <PlatformToolset>v120</PlatformToolset>

   </PropertyGroup>

   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">

     <ConfigurationType>DynamicLibrary</ConfigurationType>

     <CharacterSet>MultiByte</CharacterSet>

-    <PlatformToolset>v140</PlatformToolset>

+    <PlatformToolset>v120</PlatformToolset>

   </PropertyGroup>

   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />

   <ImportGroup Label="ExtensionSettings">

diff --git a/win-odbc64/odbcclient/drvr35/cdatasource.cpp b/win-odbc64/odbcclient/drvr35/cdatasource.cpp
index 054621a..d20bbc2 100644
--- a/win-odbc64/odbcclient/drvr35/cdatasource.cpp
+++ b/win-odbc64/odbcclient/drvr35/cdatasource.cpp
@@ -28,7 +28,7 @@
 

 #define MAX_REGKEY_PATH_LEN			512

 #define	ODBC_DS_KEY					"SOFTWARE\\ODBC\\ODBC.INI\\"

-#define ODBC_CERTIFICATE_KEY		"SOFTWARE\\ODBC\\ODBCINST.INI\\TRAF ODBC 2.2"

+#define ODBC_CERTIFICATE_KEY		"SOFTWARE\\ODBC\\ODBCINST.INI\\TRAF ODBC 2.3"

 #define SYSTEM_DEFAULT				"SYSTEM_DEFAULT"

 #define NO_TIMEOUT					"NO_TIMEOUT"

 #define CONNECTION_TIMEOUT_DEFAULT	60

diff --git a/win-odbc64/odbcclient/drvr35/cstmt.cpp b/win-odbc64/odbcclient/drvr35/cstmt.cpp
index 67c453d..98550f3 100644
--- a/win-odbc64/odbcclient/drvr35/cstmt.cpp
+++ b/win-odbc64/odbcclient/drvr35/cstmt.cpp
@@ -897,6 +897,7 @@
         setDiagRowCount(-1, -1);

 

         InitParamColumnList();

+        m_NumResultCols = 0;

 

         if (m_StmtState == STMT_EXECUTED)

         {

diff --git a/win-odbc64/odbcclient/drvr35/drvr35.rc b/win-odbc64/odbcclient/drvr35/drvr35.rc
index 27595f7..8dabb04 100644
--- a/win-odbc64/odbcclient/drvr35/drvr35.rc
+++ b/win-odbc64/odbcclient/drvr35/drvr35.rc
@@ -25,8 +25,8 @@
 //

 

 VS_VERSION_INFO VERSIONINFO

- FILEVERSION 2,2,0,0

- PRODUCTVERSION 2,2,0,0

+ FILEVERSION 2,3,0,0

+ PRODUCTVERSION 2,3,0,0

  FILEFLAGSMASK 0x3fL

 #ifdef _DEBUG

  FILEFLAGS 0x1L

@@ -43,12 +43,12 @@
         BEGIN

             VALUE "CompanyName", "Apache Trafodion"

             VALUE "FileDescription", "TRAF ODBC Driver DLL"

-            VALUE "FileVersion", "2.2.0.0"

+            VALUE "FileVersion", "2.3.0.0"

             VALUE "InternalName", "TRAF ODBC Driver DLL"

-            VALUE "LegalCopyright", "?Copyright 2015-2017 Apache Software Foundation"

+            VALUE "LegalCopyright", "?Copyright 2015-2018 Apache Software Foundation"

             VALUE "OriginalFilename", "trfodbc1.dll"

             VALUE "ProductName", "TRAF ODBC"

-            VALUE "ProductVersion", "2.2.0.0"

+            VALUE "ProductVersion", "2.3.0.0"

         END

     END

     BLOCK "VarFileInfo"

diff --git a/win-odbc64/odbcclient/drvr35/drvr35_os.vcxproj b/win-odbc64/odbcclient/drvr35/drvr35_os.vcxproj
index 8613089..a1bbed7 100755
--- a/win-odbc64/odbcclient/drvr35/drvr35_os.vcxproj
+++ b/win-odbc64/odbcclient/drvr35/drvr35_os.vcxproj
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>

-<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

   <ItemGroup Label="ProjectConfigurations">

     <ProjectConfiguration Include="Debug|Win32">

       <Configuration>Debug</Configuration>

@@ -26,11 +26,11 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />

   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">

     <ConfigurationType>DynamicLibrary</ConfigurationType>

-    <PlatformToolset>v140</PlatformToolset>

+    <PlatformToolset>v120</PlatformToolset>

   </PropertyGroup>

   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">

     <ConfigurationType>DynamicLibrary</ConfigurationType>

-    <PlatformToolset>v140</PlatformToolset>

+    <PlatformToolset>v120</PlatformToolset>

   </PropertyGroup>

   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">

     <ConfigurationType>DynamicLibrary</ConfigurationType>

diff --git a/win-odbc64/odbcclient/drvr35/sqltocconv.h b/win-odbc64/odbcclient/drvr35/sqltocconv.h
index 6ef1fe2..2509585 100644
--- a/win-odbc64/odbcclient/drvr35/sqltocconv.h
+++ b/win-odbc64/odbcclient/drvr35/sqltocconv.h
@@ -28,6 +28,7 @@
 #include <sqlExt.h>

 #include "DrvrGlobal.h"

 #include "charsetconv.h"

+#include "cconnect.h"

 

 #define ENDIAN_PRECISION_MAX	39

 

diff --git a/win-odbc64/odbcclient/drvr35adm/Drvr35Adm_os.vcxproj b/win-odbc64/odbcclient/drvr35adm/Drvr35Adm_os.vcxproj
index 9dd4942..3a12c73 100755
--- a/win-odbc64/odbcclient/drvr35adm/Drvr35Adm_os.vcxproj
+++ b/win-odbc64/odbcclient/drvr35adm/Drvr35Adm_os.vcxproj
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>

-<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

   <ItemGroup Label="ProjectConfigurations">

     <ProjectConfiguration Include="Debug|Win32">

       <Configuration>Debug</Configuration>

@@ -36,12 +36,12 @@
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Template|x64'" Label="Configuration">

     <ConfigurationType>DynamicLibrary</ConfigurationType>

     <UseOfMfc>Dynamic</UseOfMfc>

-    <PlatformToolset>v140</PlatformToolset>

+    <PlatformToolset>v120</PlatformToolset>

   </PropertyGroup>

   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Template|Win32'" Label="Configuration">

     <ConfigurationType>DynamicLibrary</ConfigurationType>

     <UseOfMfc>Dynamic</UseOfMfc>

-    <PlatformToolset>v140</PlatformToolset>

+    <PlatformToolset>v120</PlatformToolset>

   </PropertyGroup>

   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">

     <ConfigurationType>DynamicLibrary</ConfigurationType>

@@ -61,11 +61,11 @@
   </PropertyGroup>

   <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">

     <UseOfMfc>Dynamic</UseOfMfc>

-    <PlatformToolset>v140</PlatformToolset>

+    <PlatformToolset>v120</PlatformToolset>

   </PropertyGroup>

   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">

     <UseOfMfc>Dynamic</UseOfMfc>

-    <PlatformToolset>v140</PlatformToolset>

+    <PlatformToolset>v120</PlatformToolset>

   </PropertyGroup>

   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />

   <ImportGroup Label="ExtensionSettings">

diff --git a/win-odbc64/odbcclient/drvr35adm/drvr35adm.h b/win-odbc64/odbcclient/drvr35adm/drvr35adm.h
index a69517e..5a9327d 100644
--- a/win-odbc64/odbcclient/drvr35adm/drvr35adm.h
+++ b/win-odbc64/odbcclient/drvr35adm/drvr35adm.h
@@ -93,7 +93,7 @@
 const char INI_COMPRESSION[]		= "Compression";

 

 const char TRACE_PATH[] = "Software\\ODBC\\ODBC.INI\\ODBC";

-const char DRIVER_NAME[] = "TRAF ODBC 2.2";

+const char DRIVER_NAME[] = "TRAF ODBC 2.3";

 const char CREATE_NEW_DSN[] = "Create a New Trafodion ODBC Data Source to Trafodion Database";

 const char CONFIGURE_DSN1[] = "Trafodion ODBC Data Source '";

 const char DRVR_MSG_DLL[] = "traf_odbcDrvMsg_intl0100.dll";

diff --git a/win-odbc64/odbcclient/drvr35adm/drvr35adm.rc b/win-odbc64/odbcclient/drvr35adm/drvr35adm.rc
index 88237c1..8c4d7c0 100644
--- a/win-odbc64/odbcclient/drvr35adm/drvr35adm.rc
+++ b/win-odbc64/odbcclient/drvr35adm/drvr35adm.rc
@@ -62,8 +62,8 @@
 //

 

 VS_VERSION_INFO VERSIONINFO

- FILEVERSION 2,2,0,0

- PRODUCTVERSION 2,2,0,0

+ FILEVERSION 2,3,0,0

+ PRODUCTVERSION 2,3,0,0

  FILEFLAGSMASK 0x3fL

 #ifdef _DEBUG

  FILEFLAGS 0x1L

@@ -80,12 +80,12 @@
         BEGIN

             VALUE "CompanyName", "Apache Trafodion"

             VALUE "FileDescription", "TRAF ODBC Client Adminstration DLL"

-            VALUE "FileVersion", "2.2.0.0"

+            VALUE "FileVersion", "2.3.0.0"

             VALUE "InternalName", "TRAF ODBC Client Adminstration DLL"

-            VALUE "LegalCopyright", "?Copyright 2015-2017 Apache Software Foundation"

+            VALUE "LegalCopyright", "?Copyright 2015-2018 Apache Software Foundation"

             VALUE "OriginalFilename", "trfoadm1.dll"

             VALUE "ProductName", "TRAF ODBC"

-            VALUE "ProductVersion", "2.2.0.0"

+            VALUE "ProductVersion", "2.3.0.0"

         END

     END

     BLOCK "VarFileInfo"

diff --git a/win-odbc64/odbcclient/drvr35msg/DrvMsg35.rc b/win-odbc64/odbcclient/drvr35msg/DrvMsg35.rc
index 28026c3..5bfb036 100644
--- a/win-odbc64/odbcclient/drvr35msg/DrvMsg35.rc
+++ b/win-odbc64/odbcclient/drvr35msg/DrvMsg35.rc
@@ -51,8 +51,8 @@
 //

 

 VS_VERSION_INFO VERSIONINFO

- FILEVERSION 2,2,0,0

- PRODUCTVERSION 2,2,0,0

+ FILEVERSION 2,3,0,0

+ PRODUCTVERSION 2,3,0,0

  FILEFLAGSMASK 0x3fL

 #ifdef _DEBUG

  FILEFLAGS 0x1L

@@ -69,12 +69,12 @@
         BEGIN

             VALUE "CompanyName", "Apache Trafodion"

             VALUE "FileDescription", "TRAF ODBC Client Msg DLL"

-            VALUE "FileVersion", "2.2.0.0"

+            VALUE "FileVersion", "2.3.0.0"

             VALUE "InternalName", "TRAF ODBC Client Msg DLL"

-            VALUE "LegalCopyright", "?Copyright 2015-2017 Apache Software Foundation"

+            VALUE "LegalCopyright", "?Copyright 2015-2018 Apache Software Foundation"

             VALUE "OriginalFilename", "traf_odbcDrvMsg_intl0100.dll"

             VALUE "ProductName", "TRAF ODBC"

-            VALUE "ProductVersion", "2.2.0.0"

+            VALUE "ProductVersion", "2.3.0.0"

         END

     END

     BLOCK "VarFileInfo"

diff --git a/win-odbc64/odbcclient/drvr35msg/Drvr35Msg_os.vcxproj b/win-odbc64/odbcclient/drvr35msg/Drvr35Msg_os.vcxproj
index 7dc1f5e..6938ac8 100755
--- a/win-odbc64/odbcclient/drvr35msg/Drvr35Msg_os.vcxproj
+++ b/win-odbc64/odbcclient/drvr35msg/Drvr35Msg_os.vcxproj
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>

-<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

   <ItemGroup Label="ProjectConfigurations">

     <ProjectConfiguration Include="Debug|Win32">

       <Configuration>Debug</Configuration>

@@ -34,11 +34,11 @@
   </PropertyGroup>

   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">

     <ConfigurationType>DynamicLibrary</ConfigurationType>

-    <PlatformToolset>v140</PlatformToolset>

+    <PlatformToolset>v120</PlatformToolset>

   </PropertyGroup>

   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">

     <ConfigurationType>DynamicLibrary</ConfigurationType>

-    <PlatformToolset>v140</PlatformToolset>

+    <PlatformToolset>v120</PlatformToolset>

   </PropertyGroup>

   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />

   <ImportGroup Label="ExtensionSettings">

diff --git a/win-odbc64/odbcclient/odbcclient_os.sln b/win-odbc64/odbcclient/odbcclient_os.sln
index f8fa376..ffb4225 100755
--- a/win-odbc64/odbcclient/odbcclient_os.sln
+++ b/win-odbc64/odbcclient/odbcclient_os.sln
@@ -1,8 +1,8 @@
 

 Microsoft Visual Studio Solution File, Format Version 12.00

-# Visual Studio 14

-VisualStudioVersion = 14.0.25420.1

-MinimumVisualStudioVersion = 10.0.40219.1

+# Visual Studio 2013

+VisualStudioVersion = 12.0.40629

+MinimumVisualStudioVersion = 12.0.40629

 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "drvr35_os", "drvr35\drvr35_os.vcxproj", "{4B7C62D7-1C63-4319-9818-98BFBB322CED}"

 	ProjectSection(ProjectDependencies) = postProject

 		{B83DDF3C-8D5C-45AB-868B-4B70BB258647} = {B83DDF3C-8D5C-45AB-868B-4B70BB258647}

diff --git a/wms/bin/wms b/wms/bin/wms
index eecc74a..ef2a979 100755
--- a/wms/bin/wms
+++ b/wms/bin/wms
@@ -172,7 +172,7 @@
 
 # default log directory & file
 if [ "$WMS_LOG_DIR" = "" ]; then
-  WMS_LOG_DIR="$WMS_HOME/logs"
+  WMS_LOG_DIR="$TRAF_LOG/wms"
 fi
 if [ "$WMS_LOGFILE" = "" ]; then
   WMS_LOGFILE='wms.log'
diff --git a/wms/bin/wms-daemon.sh b/wms/bin/wms-daemon.sh
index 4dc1c39..564c493 100755
--- a/wms/bin/wms-daemon.sh
+++ b/wms/bin/wms-daemon.sh
@@ -98,7 +98,7 @@
 
 # get log directory
 if [ "$WMS_LOG_DIR" = "" ]; then
-  export WMS_LOG_DIR="$WMS_HOME/logs"
+  export WMS_LOG_DIR="$TRAF_LOG/wms"
 fi
 mkdir -p "$WMS_LOG_DIR"
 
diff --git a/wms/conf/wms-env.sh b/wms/conf/wms-env.sh
index 304ee03..6b78e11 100644
--- a/wms/conf/wms-env.sh
+++ b/wms/conf/wms-env.sh
@@ -86,8 +86,8 @@
 # Extra ssh options.  Empty by default.
 # export WMS_SSH_OPTS="-o ConnectTimeout=1 -o SendEnv=WMS_CONF_DIR"
 
-# Where log files are stored.  $WMS_HOME/logs by default.
-# export WMS_LOG_DIR=${WMS_HOME}/logs
+# Where log files are stored.  $TRAF_LOG/wms by default.
+# export WMS_LOG_DIR=$TRAF_LOG/wms
 
 # Enable remote JDWP debugging of major wms processes. Meant for Core Developers 
 # export WMS_MASTER_OPTS="$WMS_MASTER_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8070"