[TRAFODION-3310] Commit transaction needs to be complete before returning to the caller

The no-waited commit is not an option that is valid in Trafodion.
SQL needs to ensure that commit completes before it gives control to the application.
Hence removed all the code that are related to nowait commit as per review.
diff --git a/core/sqf/src/tm/tminfo.cpp b/core/sqf/src/tm/tminfo.cpp
index 2017893..6947a49 100644
--- a/core/sqf/src/tm/tminfo.cpp
+++ b/core/sqf/src/tm/tminfo.cpp
@@ -106,7 +106,6 @@
    iv_SysRecovMode = TM_DEFAULT_SYSRECOVERY_MODE;
    iv_maxRecoveringTxns = TM_DEFAULT_MAXRECOVERINGTXNS;
    iv_AllRmParticRecov = DEFAULT_ALL_RM_PARTIC_RECOV;
-   iv_earlyCommitReply = TM_DEFAULT_EARLY_COMMIT_REPLY;
 
    memset(iv_open_tms, 0, sizeof(Tm_phandle_info) * MAX_NODES);
 
@@ -830,17 +829,6 @@
          trace_printf("TM will use a single TLOG for all audit.\n");
     }
 
-    iv_earlyCommitReply = TM_DEFAULT_EARLY_COMMIT_REPLY;
-    ms_getenv_bool ("DTM_EARLYCOMMITREPLY", &iv_earlyCommitReply);
-
-    if (iv_trace_level)
-    {
-       if (iv_earlyCommitReply)
-         trace_printf("TM will reply early to HBase commits.\n");
-       else
-         trace_printf("TM will wait for HBase commits to complete before replying.\n");
-    }
-
     int lv_maxRecoveringTxns = 0;
     ms_getenv_int ("DTM_MAXRECOVERINGTXNS", &lv_maxRecoveringTxns);
 
diff --git a/core/sqf/src/tm/tminfo.h b/core/sqf/src/tm/tminfo.h
index 9a06378..7db8609 100644
--- a/core/sqf/src/tm/tminfo.h
+++ b/core/sqf/src/tm/tminfo.h
@@ -159,7 +159,6 @@
        bool             iv_allTMsOpen;
        int32            iv_sync_otag;
        bool             iv_TSE_xa_start;
-       bool             iv_earlyCommitReply;
        // Audit and control points
        bool             iv_write_cp;
        bool             iv_initiate_cp;
@@ -519,8 +518,6 @@
        void tm_up();
        void wake_TMUP_waiters(short pv_error);
        bool TSE_xa_start() {return iv_TSE_xa_start;}
-       bool earlyCommitReply() {return iv_earlyCommitReply;}
-       void earlyCommitReply(bool pv_set) {iv_earlyCommitReply=pv_set;}
        
        bool tmTrace(int level) {if (iv_trace_level >= level) return true; return false;}
        int32    iv_trace_level;
diff --git a/core/sqf/src/tm/tmtx.cpp b/core/sqf/src/tm/tmtx.cpp
index bba75a2..28d341b 100644
--- a/core/sqf/src/tm/tmtx.cpp
+++ b/core/sqf/src/tm/tmtx.cpp
@@ -298,7 +298,7 @@
          case XA_OK:
          {
               iv_tx_state = TM_TX_STATE_FORGETTING;
-              if (gv_tm_info.earlyCommitReply() && pp_msg->replyPending())
+              if (pp_msg->replyPending())
                  // For HBase branches we need to reply here if there were no other branches.
                  // This is the early reply for commit.  However, we still need to wait for the 
                  // HBase library to complete commit processing before we can forget the transaction.
diff --git a/core/sql/cli/Context.cpp b/core/sql/cli/Context.cpp
index 5d4fc71..e004aab 100644
--- a/core/sql/cli/Context.cpp
+++ b/core/sql/cli/Context.cpp
@@ -1117,12 +1117,12 @@
   return SUCCESS;
 }
 
-short ContextCli::commitTransaction(NABoolean waited)
+short ContextCli::commitTransaction()
 {
   releaseAllTransactionalRequests();
 
   // now do the actual commit
-  return transaction_->commitTransaction(waited);
+  return transaction_->commitTransaction();
 }
 
 short ContextCli::releaseAllTransactionalRequests()
diff --git a/core/sql/cli/Context.h b/core/sql/cli/Context.h
index e18c3d5..fb037dd 100644
--- a/core/sql/cli/Context.h
+++ b/core/sql/cli/Context.h
@@ -665,7 +665,7 @@
   void addToOpenStatementList(SQLSTMT_ID *statement_id, Statement *statement);
   void removeFromOpenStatementList(SQLSTMT_ID * statement_id);
 
-  short commitTransaction(NABoolean waited);
+  short commitTransaction();
   short releaseAllTransactionalRequests();
 
   void closeAllCursors(enum CloseCursorType, 
diff --git a/core/sql/cli/Statement.cpp b/core/sql/cli/Statement.cpp
index 4163292..9c27b3b 100644
--- a/core/sql/cli/Statement.cpp
+++ b/core/sql/cli/Statement.cpp
@@ -4892,10 +4892,7 @@
 	  StmtDebug2("  About to COMMIT, stmt %p, tx %s...", this,
 		     TransIdToText(statementGlobals_->getTransid()));
 	  // do waited commit for DDL queries
-	  NABoolean waited = FALSE;
-	  //if (root_tdb->ddlQuery())
-	  //	    waited = TRUE;
-	  short taRetcode = context_->commitTransaction(waited);
+	  short taRetcode = context_->commitTransaction();
 	  
           StmtDebug1("  Return code is %d", (Lng32) taRetcode);
       
diff --git a/core/sql/common/ComTransInfo.h b/core/sql/common/ComTransInfo.h
index 36af463..28813f9 100644
--- a/core/sql/common/ComTransInfo.h
+++ b/core/sql/common/ComTransInfo.h
@@ -47,7 +47,7 @@
 
 enum TransStmtType
 {
-  BEGIN_, COMMIT_, COMMIT_WAITED_, ROLLBACK_, ROLLBACK_WAITED_, 
+  BEGIN_, COMMIT_, ROLLBACK_, ROLLBACK_WAITED_, 
   SET_TRANSACTION_
 };
 
diff --git a/core/sql/executor/ex_transaction.cpp b/core/sql/executor/ex_transaction.cpp
index 5e09995..fcb5141 100644
--- a/core/sql/executor/ex_transaction.cpp
+++ b/core/sql/executor/ex_transaction.cpp
@@ -222,41 +222,6 @@
   return 0;
 }
 
-
-short ExTransaction::waitForCommitCompletion(Int64 transid)
-{
-  //  if (transMode_->rollbackMode() == TransMode::ROLLBACK_MODE_NOWAITED_)
-  //    return 0;
-
-  short status;
-  short rc = 0;
-
-  if (transid)
-    rc = STATUSTRANSACTION(&status, transid); // using param transid
-  else
-    rc = STATUSTRANSACTION(&status);  // using current transid
-  if ((rc == 0) && (status != 3))
-    {
-      // check for return status in a loop until the transaction
-      // is aborted.
-      Lng32 delayTime = 1; // units of 1/100th of a seconds.
-      NABoolean done = FALSE;
-      while (! done)
-	{
-	  DELAY(delayTime);
-	  delayTime *= 2;
-	  if (transid)
-	    rc = STATUSTRANSACTION(&status, transid); // using param transid.
-	  else
-	    rc = STATUSTRANSACTION(&status); // using current transid
-	  if (! ((rc == 0) && (status != 3)))
-	    done = TRUE;
-	}
-    }
-
-  return 0;
-}
-
 static void setSpecialAIValues(Lng32 &aivalue)
 {
   // on Linux we get these definitions from tm.h
@@ -631,7 +596,7 @@
   resetXnState();
 }
 
-short ExTransaction::commitTransaction(NABoolean waited)
+short ExTransaction::commitTransaction()
 {
   if (! xnInProgress())
     {
@@ -688,13 +653,6 @@
   //is deallocated appropriately.
   DEALLOCATE_ERR(errStr);
  
-  // In Trafodion, TM is blocking. But, TM can return early based on the env variable DTM_EARLYCOMMITREPLY 
-  // The same environment variable is used here 
-  static NABoolean earlyReply = ((getenv("DTM_EARLYCOMMITREPLY") != NULL) && 
-                    (atoi(getenv("DTM_EARLYCOMMITREPLY")) != 0)); 
-  if (earlyReply)
-    waitForCommitCompletion(transid_);
-
   resetXnState();
 
   return rc;
@@ -1193,7 +1151,7 @@
           castToExMasterStmtGlobals()->getStatement()->
           getContext()->closeAllCursors(ContextCli::CLOSE_ALL, ContextCli::CLOSE_CURR_XN);
 
-        rc = ta->commitTransaction(FALSE);
+        rc = ta->commitTransaction();
         if (rc != 0)
           handleErrors(pentry_down, ta->getDiagsArea());
 
@@ -1223,51 +1181,6 @@
       }
       break;
       
-      case COMMIT_WAITED_: {
-        if (ta->userEndedExeXn()) {
-          ta->cleanupTransaction();
-          handleErrors(pentry_down, NULL, 
-             (ExeErrorCode)(-CLI_USER_ENDED_XN_CLEANUP));
-
-          break;
-        }
-
-        // close all open cursors that are part of this xn-- ANSI requirement.
-        // get current context and close all statements.
-        getGlobals()->castToExExeStmtGlobals()->
-          castToExMasterStmtGlobals()->getStatement()->
-          getContext()->closeAllCursors(ContextCli::CLOSE_ALL, ContextCli::CLOSE_CURR_XN);
-
-        rc = ta->commitTransaction(TRUE);
-        if (rc != 0)
-          handleErrors(pentry_down, ta->getDiagsArea());
-	      	  
-        if (cliGlobals->currContext()->ddlStmtsExecuted())
-          {
-            ComDiagsArea * diagsArea = NULL;
-            ExSqlComp::ReturnStatus cmpStatus = 
-              cliGlobals->currContext()->sendXnMsgToArkcmp
-              (NULL, 0,
-               EXSQLCOMP::DDL_NATABLE_INVALIDATE,
-               diagsArea);
-            if (cmpStatus == ExSqlComp::ERROR)
-              {
-                cliGlobals->currContext()->ddlStmtsExecuted() = FALSE;
-
-                handleErrors(pentry_down, NULL, 
-                             (ExeErrorCode)(-EXE_CANT_COMMIT_OR_ROLLBACK));
- 
-                return -1;
-              }
-          }
-        
-        cliGlobals->currContext()->ddlStmtsExecuted() = FALSE;
-   
-        // if user had specified AUTO COMMIT, turn it back on.
-        ta->enableAutoCommit();
-      }
-      break;
-
       case ROLLBACK_:  {
         if (ta->userEndedExeXn()) {
           ta->cleanupTransaction();
diff --git a/core/sql/executor/ex_transaction.h b/core/sql/executor/ex_transaction.h
index 26f3795..1a6b049 100644
--- a/core/sql/executor/ex_transaction.h
+++ b/core/sql/executor/ex_transaction.h
@@ -84,8 +84,7 @@
   short waitForRollbackCompletion(Int64 transid);
 
   void cleanupTransaction();
-  short commitTransaction(NABoolean waited = FALSE);
-  short waitForCommitCompletion(Int64 transid);
+  short commitTransaction();
 
   short inheritTransaction();
   short validateTransaction();
diff --git a/core/sql/parser/sqlparser.y b/core/sql/parser/sqlparser.y
index 1d5ca35..e56b4ce 100755
--- a/core/sql/parser/sqlparser.y
+++ b/core/sql/parser/sqlparser.y
@@ -21283,22 +21283,6 @@
               {
 		$$ = new (PARSERHEAP()) RelTransaction(COMMIT_);
               }
-      | TOK_COMMIT TOK_NO TOK_WAITED
-              {
-		$$ = new (PARSERHEAP()) RelTransaction(COMMIT_);
-              }
-      | TOK_COMMIT TOK_WORK TOK_NO TOK_WAITED
-              {
-		$$ = new (PARSERHEAP()) RelTransaction(COMMIT_);
-              }
-      | TOK_COMMIT TOK_WAITED
-              {
-		$$ = new (PARSERHEAP()) RelTransaction(COMMIT_WAITED_);
-              }
-      | TOK_COMMIT TOK_WORK TOK_WAITED
-              {
-		$$ = new (PARSERHEAP()) RelTransaction(COMMIT_WAITED_);
-              }
       | TOK_ET
               {
 		$$ = new (PARSERHEAP()) RelTransaction(COMMIT_);