trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject [1/2] incubator-trafodion git commit: [TRAFODION-2469] TM clients like dtmci don't exit cleanly
Date Thu, 02 Feb 2017 18:41:10 GMT
Repository: incubator-trafodion
Updated Branches:
  refs/heads/master 905620c9e -> ee8b16d79


[TRAFODION-2469] TM clients like dtmci don't exit cleanly

Created a new API TMCLIENTEXIT in TM library to clean up
opens. dtmci now calls this API before exiting


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/8785bb59
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/8785bb59
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/8785bb59

Branch: refs/heads/master
Commit: 8785bb59c7b205f7d205aaccdf6cb3ad78dd819e
Parents: 81c2479
Author: selvaganesang <selva.govindarajan@esgyn.com>
Authored: Wed Feb 1 22:12:05 2017 +0000
Committer: selvaganesang <selva.govindarajan@esgyn.com>
Committed: Wed Feb 1 22:12:05 2017 +0000

----------------------------------------------------------------------
 core/sqf/export/include/dtm/tm.h |  2 +-
 core/sqf/src/tm/tmlib.cpp        | 23 +++++++++++++++++++++++
 core/sqf/src/tm/tmlib.h          |  1 +
 core/sqf/src/tm/tools/dtmci.cpp  |  1 +
 4 files changed, 26 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8785bb59/core/sqf/export/include/dtm/tm.h
----------------------------------------------------------------------
diff --git a/core/sqf/export/include/dtm/tm.h b/core/sqf/export/include/dtm/tm.h
index 8279322..0c042f7 100644
--- a/core/sqf/export/include/dtm/tm.h
+++ b/core/sqf/export/include/dtm/tm.h
@@ -315,6 +315,7 @@ extern "C" short JOINTRANSACTION(int64 transid);
 extern "C" short TMF_GETTXHANDLE_(short *handle);
 extern "C" short TMF_SETTXHANDLE_(short *handle);
 extern "C" short TMWAIT();
+extern "C" short TMCLIENTEXIT();
 
 // Extended API
 extern "C" short GETTRANSID_EXT (TM_Transid_Type *transid);
@@ -344,7 +345,6 @@ extern "C" short DTM_GETTRANSINFO_EXT(TM_Transid_Type pv_transid, int32
*pp_seq_
 extern "C" short DTM_GETTRANSIDSTR(int64 pv_transid, char *pp_transidstr);
 extern "C" short DTM_GETTRANSIDSTR_EXT(TM_Transid_Type pv_transid, char *pp_transidstr);
 
-
 // Internal use only!!
 extern "C" short DTM_QUIESCE(int32 pv_node); //Use for testing only
 extern "C" short DTM_UNQUIESCE(int32 pv_node); //Use for testing only

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8785bb59/core/sqf/src/tm/tmlib.cpp
----------------------------------------------------------------------
diff --git a/core/sqf/src/tm/tmlib.cpp b/core/sqf/src/tm/tmlib.cpp
index 779acc5..4df9b14 100644
--- a/core/sqf/src/tm/tmlib.cpp
+++ b/core/sqf/src/tm/tmlib.cpp
@@ -2491,6 +2491,18 @@ int16 TMWAIT()
         return lv_rsp.iv_msg_hdr.miv_err.error;
 }
 
+//------------------------------------------------------------------------
+// TMCLIENTEXIT
+//
+// Purpose  : To close all the TM opens from the clients before exiting 
+// Params   : none.
+// ---------------------------------------------------------------------
+int16 TMCLIENTEXIT()
+{
+   int16 lv_error = FEOK;
+   lv_error = gv_tmlib.close_tm();
+   return lv_error;
+}
 
 
 // -------------------------------------------------------------------
@@ -3274,6 +3286,17 @@ short TMLIB::abortTransactionLocal(long transactionID)
   return jresult;
 } //abortTransactionLocal
 
+bool TMLIB::close_tm() 
+{
+   TPT_DECL       (lv_phandle);
+   if (!gv_tmlib.is_initialized())
+      return true;
+   for (int i = 0; i < iv_node_count; i++) {
+      if (phandle_get(&lv_phandle, i) == true)
+         msg_mon_close_process(&lv_phandle);
+   }
+   return true;
+}
 
 //----------------------------------------------------------------------------
 // DTM_LOCALTRANSACTION

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8785bb59/core/sqf/src/tm/tmlib.h
----------------------------------------------------------------------
diff --git a/core/sqf/src/tm/tmlib.h b/core/sqf/src/tm/tmlib.h
index d80f0b0..b1f2969 100644
--- a/core/sqf/src/tm/tmlib.h
+++ b/core/sqf/src/tm/tmlib.h
@@ -141,6 +141,7 @@ class TMLIB : public JavaObjectInterfaceTM
         short abortTransactionLocal(long transactionID);
         short endTransactionLocal(long transactionID);
         void cleanupTransactionLocal(long transactionID);
+        bool close_tm();
 };
 
 // helper methods, C style 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8785bb59/core/sqf/src/tm/tools/dtmci.cpp
----------------------------------------------------------------------
diff --git a/core/sqf/src/tm/tools/dtmci.cpp b/core/sqf/src/tm/tools/dtmci.cpp
index c65259c..1021672 100644
--- a/core/sqf/src/tm/tools/dtmci.cpp
+++ b/core/sqf/src/tm/tools/dtmci.cpp
@@ -1830,6 +1830,7 @@ int main(int argc, char *argv[])
     } // while
     if(lv_shellExec)
         fclose(lp_in);
+    TMCLIENTEXIT();
     msg_mon_process_shutdown();
 
     return 0;


Mime
View raw message