You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by db...@apache.org on 2016/07/25 16:34:21 UTC
[2/4] incubator-trafodion git commit: [TRAFODION-1988] Better java
exception handling in the java/JNI layer of Trafodion - Part3
[TRAFODION-1988] Better java exception handling in the java/JNI
layer of Trafodion - Part3
Changes as per the review comments. Removed and cleanup the redundant
logging programs that was preventing the log4cxx to work properly.
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/59cd8319
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/59cd8319
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/59cd8319
Branch: refs/heads/master
Commit: 59cd8319eca75486171dc7fc6f6c883dbace0fba
Parents: 8bd9150
Author: selvaganesang <se...@esgyn.com>
Authored: Fri Jul 22 02:24:00 2016 +0000
Committer: selvaganesang <se...@esgyn.com>
Committed: Fri Jul 22 02:24:00 2016 +0000
----------------------------------------------------------------------
core/sqf/src/seatrans/tm/hbasetmlib2/Makefile | 2 +-
.../sqf/src/seatrans/tm/hbasetmlib2/hbasetm.cpp | 52 ++--
.../src/seatrans/tm/hbasetmlib2/hbasetmglob.h | 2 +-
.../seatrans/tm/hbasetmlib2/hbasetmlogging.h | 33 ---
.../sqf/src/seatrans/tm/hbasetmlib2/testrun.cpp | 4 +-
core/sqf/src/tm/Makefile | 8 +-
core/sqf/src/tm/tmlogging.cpp | 12 +-
core/sqf/src/tm/tmlogging.h | 5 +-
core/sqf/src/tm/tmlogginglib.cpp | 55 ----
core/sqf/src/tm/xarmlogging.cpp | 261 -------------------
10 files changed, 49 insertions(+), 385 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/59cd8319/core/sqf/src/seatrans/tm/hbasetmlib2/Makefile
----------------------------------------------------------------------
diff --git a/core/sqf/src/seatrans/tm/hbasetmlib2/Makefile b/core/sqf/src/seatrans/tm/hbasetmlib2/Makefile
index d4b220a..9dd0cd7 100644
--- a/core/sqf/src/seatrans/tm/hbasetmlib2/Makefile
+++ b/core/sqf/src/seatrans/tm/hbasetmlib2/Makefile
@@ -84,7 +84,7 @@ $(OUTDIR)/idtm.o: idtm.cpp
test: testrun
testrun: testrun.cpp $(LIBEXPDIR)/libshbasetmlib.so
- $(CXX) -g -o $@ -Wall $(LIBSTESTRUN) $(LIBJVM) $(LIBTMB) $(INCLUDES) testrun.cpp
+ $(CXX) -g -o $@ -Wall $(LIBSTESTRUN) $(LIBJVM) $(LIBTMB) -lstmlib $(INCLUDES) testrun.cpp
setup:
@echo "OUTDIR =" $(OUTDIR)
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/59cd8319/core/sqf/src/seatrans/tm/hbasetmlib2/hbasetm.cpp
----------------------------------------------------------------------
diff --git a/core/sqf/src/seatrans/tm/hbasetmlib2/hbasetm.cpp b/core/sqf/src/seatrans/tm/hbasetmlib2/hbasetm.cpp
index e21ab1f..4f3039d 100644
--- a/core/sqf/src/seatrans/tm/hbasetmlib2/hbasetm.cpp
+++ b/core/sqf/src/seatrans/tm/hbasetmlib2/hbasetm.cpp
@@ -269,7 +269,7 @@ short CHbaseTM::initConnection(short pv_nid)
jshort jdtmid = pv_nid;
jboolean jresult = _tlp_jenv->CallBooleanMethod(javaObj_, JavaMethods_[JM_INIT1].methodID, jdtmid);
if (getExceptionDetails(NULL)) {
- tm_log_write(DTM_SEA_SOFT_FAULT, SQ_LOG_CRIT, (char *) _tlp_error_msg->c_str());
+ tm_log_write(DTM_SEA_SOFT_FAULT, SQ_LOG_CRIT, (char *) _tlp_error_msg->c_str(), -1LL);
return RET_EXCEPTION;
}
if (jresult == false)
@@ -291,7 +291,7 @@ short CHbaseTM::addControlPoint(){
jlong jresult = _tlp_jenv->CallLongMethod(javaObj_, JavaMethods_[JM_CNTPOINT].methodID);
if (getExceptionDetails(NULL)) {
- tm_log_write(DTM_SEA_SOFT_FAULT, SQ_LOG_CRIT, (char *)_tlp_error_msg->c_str());
+ tm_log_write(DTM_SEA_SOFT_FAULT, SQ_LOG_CRIT, (char *)_tlp_error_msg->c_str(), -1LL);
return RET_EXCEPTION;
}
if (jresult == 0L) {
@@ -312,7 +312,7 @@ short CHbaseTM::beginTransaction(int64 *pp_transid) {
jlong jresult = _tlp_jenv->CallLongMethod(javaObj_, JavaMethods_[JM_BEGIN].methodID, jlv_transid);
if (getExceptionDetails(NULL)) {
- tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str());
+ tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str(), *pp_transid);
return RET_EXCEPTION;
}
*pp_transid = (long)jresult;
@@ -332,7 +332,7 @@ short CHbaseTM::abortTransaction(int64 pv_transid) {
jshort jresult = _tlp_jenv->CallShortMethod(javaObj_, JavaMethods_[JM_ABORT].methodID, jlv_transid);
if (getExceptionDetails(NULL)) {
- tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str());
+ tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str(), pv_transid);
return RET_EXCEPTION;
}
// RET_NOTX means the transaction wasn't found by the HBase client code (trx). This is ok here, it
@@ -358,7 +358,7 @@ short CHbaseTM::prepareCommit(int64 pv_transid) {
jshort jresult = _tlp_jenv->CallShortMethod(javaObj_, JavaMethods_[JM_PRECOMMIT].methodID, jlv_transid);
if (getExceptionDetails(NULL)) {
- tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str());
+ tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str(), pv_transid);
return RET_EXCEPTION;
}
@@ -385,7 +385,7 @@ short CHbaseTM::doCommit(int64 pv_transid) {
jshort jresult = _tlp_jenv->CallShortMethod(javaObj_, JavaMethods_[JM_DOCOMMIT].methodID, jlv_transid);
if (getExceptionDetails(NULL)) {
- tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str());
+ tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str(), pv_transid);
return RET_EXCEPTION;
}
@@ -416,7 +416,7 @@ short CHbaseTM::tryCommit(int64 pv_transid) {
jshort jresult = _tlp_jenv->CallShortMethod(javaObj_, JavaMethods_[JM_TRYCOMMIT].methodID, jlv_transid);
if (getExceptionDetails(NULL)) {
- tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str());
+ tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str(), pv_transid);
return RET_EXCEPTION;
}
@@ -443,7 +443,7 @@ short CHbaseTM::completeRequest(int64 pv_transid) {
jshort jresult = _tlp_jenv->CallShortMethod(javaObj_, JavaMethods_[JM_COMPLETEREQUEST].methodID, jlv_transid);
if (getExceptionDetails(NULL)) {
- tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str());
+ tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str(), pv_transid);
return RET_EXCEPTION;
}
@@ -652,7 +652,7 @@ int CHbaseTM::registerRegion(int64 pv_transid,
pv_startcode,
jba_regionInfo);
if (getExceptionDetails(NULL)) {
- tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str());
+ tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str(), pv_transid);
return RET_EXCEPTION;
}
_tlp_jenv->DeleteLocalRef(jba_hostname);
@@ -733,7 +733,7 @@ int CHbaseTM::participatingRegions(int64 pv_transid)
lv_participating = _tlp_jenv->CallIntMethod(javaObj_, JavaMethods_[JM_PARREGION].methodID, lv_transid_j);
if (getExceptionDetails(NULL)) {
- tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str());
+ tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str(), pv_transid);
lv_participatingCount = -1;
}
lv_participatingCount = lv_participating;
@@ -772,7 +772,7 @@ short CHbaseTM::stall(int where){
cout << "CHbaseTM::stall called with: " << jiv_where << "\n";
_tlp_jenv->CallShortMethod(javaObj_, JavaMethods_[JM_STALL].methodID, jiv_where);
if (getExceptionDetails(NULL)) {
- tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str());
+ tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str(), -1LL);
return RET_EXCEPTION;
}
return RET_OK;
@@ -791,7 +791,7 @@ short CHbaseTM::nodeDown(int32 nid){
cout << "CHbaseTM::nodeDown called with nodeId " << jiv_nid << "\n";
_tlp_jenv->CallShortMethod(javaObj_, JavaMethods_[JM_NODEDOWN].methodID, jiv_nid);
if (getExceptionDetails(NULL)) {
- tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str());
+ tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str(), -1LL);
return RET_EXCEPTION;
}
return RET_OK;
@@ -811,7 +811,7 @@ short CHbaseTM::nodeUp(int32 nid){
cout << "CHbaseTM::nodeUp called with: " << jiv_nid << "\n";
_tlp_jenv->CallShortMethod(javaObj_, JavaMethods_[JM_NODEUP].methodID, jiv_nid);
if (getExceptionDetails(NULL)) {
- tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str());
+ tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str(), -1LL);
return RET_EXCEPTION;
}
return RET_OK;
@@ -860,7 +860,7 @@ int CHbaseTM::createTable(int64 pv_transid,
jba_tbldesc,
j_keys);
if (getExceptionDetails(NULL)) {
- tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str());
+ tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str(), pv_transid);
return RET_EXCEPTION;
}
@@ -913,7 +913,7 @@ int CHbaseTM::alterTable(int64 pv_transid,
jba_tblname,
j_tblopts);
if (getExceptionDetails(NULL)) {
- tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str());
+ tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str(), pv_transid);
return RET_EXCEPTION;
}
@@ -960,7 +960,7 @@ int CHbaseTM::regTruncateOnAbort(int64 pv_transid,
jlv_transid,
jba_tblname);
if (getExceptionDetails(NULL)) {
- tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str());
+ tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str(), pv_transid);
return RET_EXCEPTION;
}
_tlp_jenv->DeleteLocalRef(jba_tblname);
@@ -1005,7 +1005,7 @@ int CHbaseTM::dropTable(int64 pv_transid,
jlv_transid,
jba_tblname);
if (getExceptionDetails(NULL)) {
- tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str());
+ tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str(), pv_transid);
return RET_EXCEPTION;
}
@@ -1108,7 +1108,7 @@ HashMapArray* CHbaseTM::requestRegionInfo(){
}
jobject jHashMapArray = _tlp_jenv->CallObjectMethod(javaObj_, JavaMethods_[JM_RQREGINFO].methodID);
if (getExceptionDetails(NULL)) {
- tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str());
+ tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str(), -1LL);
return NULL;
}
@@ -1173,7 +1173,7 @@ char* HashMapArray::get(int tid)
{
jstring js_val = (jstring)(_tlp_jenv->CallObjectMethod(javaObj_, JavaMethods_[JM_GET].methodID, tid));
if (getExceptionDetails(NULL)) {
- tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str());
+ tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str(), -1LL);
return NULL;
}
if(js_val == NULL){
@@ -1190,7 +1190,7 @@ char* HashMapArray::getTableName(int tid)
{
jstring js_val = (jstring)(_tlp_jenv->CallObjectMethod(javaObj_, JavaMethods_[JM_GET_TNAME].methodID, tid));
if (getExceptionDetails(NULL)) {
- tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str());
+ tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str(), -1LL);
return NULL;
}
if(js_val == NULL){
@@ -1207,7 +1207,7 @@ char* HashMapArray::getEncodedRegionName(int tid)
{
jstring js_val = (jstring)(_tlp_jenv->CallObjectMethod(javaObj_, JavaMethods_[JM_GET_ENCREGNAME].methodID, tid));
if (getExceptionDetails(NULL)) {
- tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str());
+ tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str(), -1LL);
return NULL;
}
if(js_val == NULL){
@@ -1224,7 +1224,7 @@ char* HashMapArray::getRegionName(int tid)
{
jstring js_val = (jstring)(_tlp_jenv->CallObjectMethod(javaObj_, JavaMethods_[JM_GET_REGNAME].methodID, tid));
if (getExceptionDetails(NULL)) {
- tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str());
+ tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str(), -1LL);
return NULL;
}
@@ -1242,7 +1242,7 @@ char* HashMapArray::getRegionOfflineStatus(int tid)
{
jstring js_val = (jstring)(_tlp_jenv->CallObjectMethod(javaObj_, JavaMethods_[JM_GET_OFFLINE].methodID, tid));
if (getExceptionDetails(NULL)) {
- tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str());
+ tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str(), -1LL);
return NULL;
}
if(js_val == NULL){
@@ -1259,7 +1259,7 @@ char* HashMapArray::getRegionId(int tid)
{
jstring js_val = (jstring)(_tlp_jenv->CallObjectMethod(javaObj_, JavaMethods_[JM_GET_REGID].methodID, tid));
if (getExceptionDetails(NULL)) {
- tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str());
+ tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str(), -1LL);
return NULL;
}
if(js_val == NULL){
@@ -1276,7 +1276,7 @@ char* HashMapArray::getHostName(int tid)
{
jstring js_val = (jstring)(_tlp_jenv->CallObjectMethod(javaObj_, JavaMethods_[JM_GET_HOSTNAME].methodID, tid));
if (getExceptionDetails(NULL)) {
- tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str());
+ tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str(), -1LL);
return NULL;
}
if(js_val == NULL){
@@ -1293,7 +1293,7 @@ char* HashMapArray::getPort(int tid)
{
jstring js_val = (jstring)(_tlp_jenv->CallObjectMethod(javaObj_, JavaMethods_[JM_GET_PORT].methodID, tid));
if (getExceptionDetails(NULL)) {
- tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str());
+ tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)_tlp_error_msg->c_str(), -1LL);
return NULL;
}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/59cd8319/core/sqf/src/seatrans/tm/hbasetmlib2/hbasetmglob.h
----------------------------------------------------------------------
diff --git a/core/sqf/src/seatrans/tm/hbasetmlib2/hbasetmglob.h b/core/sqf/src/seatrans/tm/hbasetmlib2/hbasetmglob.h
index 9dcf89b..26dda8e 100644
--- a/core/sqf/src/seatrans/tm/hbasetmlib2/hbasetmglob.h
+++ b/core/sqf/src/seatrans/tm/hbasetmlib2/hbasetmglob.h
@@ -61,5 +61,5 @@ enum HBASETM_TraceMask
//extern timeval gv_startTime;
extern HBASETM_TraceMask gv_HBASETM_traceMask; // HBase TM tracing Mask. 0 = no tracing (default)
-//extern int tm_log_write(int, int, char*);
+
#endif //HBASETMGLOB_H_
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/59cd8319/core/sqf/src/seatrans/tm/hbasetmlib2/hbasetmlogging.h
----------------------------------------------------------------------
diff --git a/core/sqf/src/seatrans/tm/hbasetmlib2/hbasetmlogging.h b/core/sqf/src/seatrans/tm/hbasetmlib2/hbasetmlogging.h
deleted file mode 100644
index 1149811..0000000
--- a/core/sqf/src/seatrans/tm/hbasetmlib2/hbasetmlogging.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// @@@ 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 __HBASETMLOGGING_H
-#define __HBASETMLOGGING_H
-
-// Empty shell for now.
-
-int tm_log_write(int pv_event_type, posix_sqlog_severity_t pv_severity, char *pp_string) {return 0;}
-
-
-#endif
-
-
-
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/59cd8319/core/sqf/src/seatrans/tm/hbasetmlib2/testrun.cpp
----------------------------------------------------------------------
diff --git a/core/sqf/src/seatrans/tm/hbasetmlib2/testrun.cpp b/core/sqf/src/seatrans/tm/hbasetmlib2/testrun.cpp
index 38a11e1..2b3e6bd 100644
--- a/core/sqf/src/seatrans/tm/hbasetmlib2/testrun.cpp
+++ b/core/sqf/src/seatrans/tm/hbasetmlib2/testrun.cpp
@@ -24,7 +24,9 @@
#include <sys/time.h>
#include "hbasetm.h"
-#include "hbasetmlogging.h"
+
+// To avoid pulling in other .so
+int tm_log_write(int pv_event_type, posix_sqlog_severity_t pv_severity, char *pp_string) {return 0;}
// Define here because we don't have the TM.
timeval gv_startTime;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/59cd8319/core/sqf/src/tm/Makefile
----------------------------------------------------------------------
diff --git a/core/sqf/src/tm/Makefile b/core/sqf/src/tm/Makefile
index 734653f..e12004f 100644
--- a/core/sqf/src/tm/Makefile
+++ b/core/sqf/src/tm/Makefile
@@ -51,13 +51,14 @@ LIBSTMOBJS = $(OUTDIR)/tmtransid.o \
$(OUTDIR)/tmtransaction.o \
$(OUTDIR)/tmlibtxn.o \
$(OUTDIR)/tmlib.o \
- $(OUTDIR)/tmlogginglib.o \
+ $(OUTDIR)/tmlogging.o \
$(OUTDIR)/tmmap.o \
$(OUTDIR)/tmmutex.o \
$(OUTDIR)/tmregisterregion.o \
$(OUTDIR)/tmddlrequests.o\
- $(OUTDIR)/javaobjectinterfacetm.o \
- $(OUTDIR)/versstmlib.o
+ $(OUTDIR)/javaobjectinterfacetm.o \
+ $(OUTDIR)/versstmlib.o \
+ $(OUTDIR)/CommonLogger.o
LIBSXATMOBJS = $(OUTDIR)/tmmap.o \
$(OUTDIR)/tmmmap.o \
$(OUTDIR)/tmmutex.o \
@@ -83,7 +84,6 @@ LIBXARMOBJS = $(OUTDIR)/tmmap.o \
$(OUTDIR)/xatmmsg.o \
$(OUTDIR)/xarmapi.o \
$(OUTDIR)/xatmapi.o \
- $(OUTDIR)/xarmlogging.o \
$(OUTDIR)/tmregistry.o \
$(OUTDIR)/tmtimer.o \
$(OUTDIR)/verssxarmlib.o
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/59cd8319/core/sqf/src/tm/tmlogging.cpp
----------------------------------------------------------------------
diff --git a/core/sqf/src/tm/tmlogging.cpp b/core/sqf/src/tm/tmlogging.cpp
index 9892d3e..ebd524c 100644
--- a/core/sqf/src/tm/tmlogging.cpp
+++ b/core/sqf/src/tm/tmlogging.cpp
@@ -45,6 +45,13 @@ int tm_init_logging()
return gv_dual_logging;
}
+int tm_log_write(int pv_event_type, posix_sqlog_severity_t pv_severity, char *pp_string, long transid)
+{
+ int lv_err = 0;
+ lv_err = tm_log_stdout(pv_event_type, pv_severity, pp_string, -1, transid);
+ return lv_err;
+}
+
int tm_log_write(int pv_event_type, posix_sqlog_severity_t pv_severity, char *pp_string)
{
int lv_err = 0;
@@ -142,7 +149,7 @@ int tm_log_event(int event_id,
{
char la_buf[DTM_STRING_BUF_SIZE];
strncpy (la_buf, temp_string, DTM_STRING_BUF_SIZE - 1);
- tm_log_stdout(event_id, severity, la_buf, error_code, rmid, dtmid, seq_num, msgid, xa_error,
+ tm_log_stdout(event_id, severity, la_buf, error_code, -1, rmid, dtmid, seq_num, msgid, xa_error,
pool_size, pool_elems, msg_retries, pool_high, pool_low, pool_max, tx_state,
data, data1, data2, string1, node, msgid2, offset, tm_event_msg, data4);
}
@@ -155,6 +162,7 @@ int tm_log_stdout(int event_id,
posix_sqlog_severity_t severity,
const char *temp_string,
int error_code,
+ int64 transid,
int rmid,
int dtmid,
int seq_num,
@@ -286,7 +294,7 @@ int tm_log_stdout(int event_id,
printf("\n");
// Log4cxx logging
- CommonLogger::log(TM_COMPONENT, ll_severity, "Node Number: %u, PIN: %u , Process Name: %s, Message: %s ", my_nid, my_pid, my_name, temp_string);
+ CommonLogger::log(TM_COMPONENT, ll_severity, "Node Number: %u, PIN: %u , Process Name: %s, TMID: %Ld Message: %s ", my_nid, my_pid, my_name, transid, temp_string);
return error;
}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/59cd8319/core/sqf/src/tm/tmlogging.h
----------------------------------------------------------------------
diff --git a/core/sqf/src/tm/tmlogging.h b/core/sqf/src/tm/tmlogging.h
index b354516..954e5af 100644
--- a/core/sqf/src/tm/tmlogging.h
+++ b/core/sqf/src/tm/tmlogging.h
@@ -33,6 +33,8 @@ int tm_init_logging();
int tm_log_write(int pv_event_type, posix_sqlog_severity_t pv_severity, char *pp_string);
+int tm_log_write(int pv_event_type, posix_sqlog_severity_t pv_severity, char *pp_string, long transid);
+
int tm_alt_log_write(int eventType, posix_sqlog_severity_t severity, char *msg);
int tm_log_event(int event_type,
@@ -65,7 +67,8 @@ int tm_log_stdout
(int event_type,
posix_sqlog_severity_t severity,
const char *temp_string,
- int error_code = -1, // 1
+ int error_code = -1, // 0
+ int64 transid = -1, // 1
int rmid = -1, // 2
int dtmid = -1, // 3
int seq_num = -1, // 4
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/59cd8319/core/sqf/src/tm/tmlogginglib.cpp
----------------------------------------------------------------------
diff --git a/core/sqf/src/tm/tmlogginglib.cpp b/core/sqf/src/tm/tmlogginglib.cpp
deleted file mode 100644
index ff9b37e..0000000
--- a/core/sqf/src/tm/tmlogginglib.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-// @@@ 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 "tminfo.h"
-#include "tmlogging.h"
-
-
-
-int tm_log_write(int pv_event_type, posix_sqlog_severity_t pv_severity, char *pp_string)
-{
- size_t lv_buf_size = DTM_EVENT_BUF_SIZE;
- int lv_err;
- char lp_event_buf[DTM_EVENT_BUF_SIZE];
- char *lp_pbuf = lp_event_buf;
-
- // init log buffer
- lv_err = evl_sqlog_init(lp_pbuf, lv_buf_size);
- if (lv_err)
- return lv_err;
-
- // add our string
- lv_err = evl_sqlog_add_token(lp_pbuf, TY_STRING, pp_string);
-
- if (!lv_err)
- {
- // ok to log buffer.
- // we need to translate category to sql_evl severity
- // facility is common for sql.
-
- lv_err = evl_sqlog_write((posix_sqlog_facility_t)SQ_LOG_SEAQUEST, pv_event_type,
- pv_severity, lp_event_buf);
- }
-
- return lv_err;
-}
-
-
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/59cd8319/core/sqf/src/tm/xarmlogging.cpp
----------------------------------------------------------------------
diff --git a/core/sqf/src/tm/xarmlogging.cpp b/core/sqf/src/tm/xarmlogging.cpp
deleted file mode 100644
index c76aadc..0000000
--- a/core/sqf/src/tm/xarmlogging.cpp
+++ /dev/null
@@ -1,261 +0,0 @@
-//------------------------------------------------------------------
-//
-// @@@ 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 <sys/time.h>
-#include "common/evl_sqlog_eventnum.h"
-
-#include "tminfo.h"
-#include "tmlogging.h"
-#include "seabed/logalt.h"
-
-int gv_dual_logging =1; // Write to both SeaLog and stdout by default
-
-int tm_init_logging()
-{
- ms_getenv_int ("TM_DUAL_LOGGING", &gv_dual_logging);
- return gv_dual_logging;
-}
-
-int tm_log_write(int pv_event_type, posix_sqlog_severity_t pv_severity, char *pp_string)
-{
- int lv_err = 0;
- return lv_err;
-}
-
-int tm_alt_log_write(int eventType, posix_sqlog_severity_t severity, char *msg) {
- static int logFileType = SBX_LOG_TYPE_LOGFILE;
- static char startTimeFmt[20] = "";
-
- char logFileDir[PATH_MAX];
- char *logFileDirPtr;
- char logFilePrefix[25];
- char *rootDir;
-
- struct timeval startTime;
- struct tm * ltime;
-
- if ((logFileType&SBX_LOG_TYPE_LOGFILE_PERSIST) != SBX_LOG_TYPE_LOGFILE_PERSIST)
- {
- // getting date time for log file name
- gettimeofday(&startTime, NULL);
- ltime = localtime(&startTime.tv_sec);
- sprintf(startTimeFmt, "%02d%02d%02d.%02d.%02d.%02d", ltime->tm_mon+1, ltime->tm_mday, ltime->tm_year-100, ltime->tm_hour, ltime->tm_min, ltime->tm_sec);
- }
-
- // directory to write log file
- rootDir = getenv("MY_SQROOT");
- if (rootDir == NULL)
- {
- logFileDirPtr = NULL;
- }
- else
- {
- sprintf(logFileDir, "%s/logs", rootDir);
- logFileDirPtr = logFileDir;
- }
-
- // log file prefix will be tm.<date>.hh.mm.ss
- sprintf(logFilePrefix, "tm.%s", (char *)&startTimeFmt);
-
- SBX_log_write(logFileType, // log_type
- logFileDirPtr, // log_file_dir
- logFilePrefix, // log_file_prefix
- SQEVL_DTM, // component id
- eventType, // event id
- SQ_LOG_SEAQUEST, // facility
- severity, // severity
- "TM", // name
- NULL, // msg_prefix
- msg, // msg
- NULL, // snmptrap_cmd
- NULL, // msg_snmptrap
- NULL, // msg_ret
- 0); // msg_ret size
-
- // write to the same file in future without opening and closing it.
- if (logFileType == SBX_LOG_TYPE_LOGFILE)
- {
- logFileType |= SBX_LOG_TYPE_LOGFILE_PERSIST;
- }
- return 0;
-}
-
-int tm_log_event(int event_id,
- posix_sqlog_severity_t severity,
- const char *temp_string,
- int error_code,
- int rmid,
- int dtmid,
- int seq_num,
- int msgid,
- int xa_error,
- int pool_size,
- int pool_elems,
- int msg_retries,
- int pool_high,
- int pool_low,
- int pool_max,
- int tx_state,
- int data,
- int data1,
- int64 data2,
- const char *string1,
- int node,
- int msgid2,
- int offset,
- int tm_event_msg,
- uint data4)
-
-{
- int rc = 0;
- if (gv_dual_logging)
- {
- char la_buf[DTM_STRING_BUF_SIZE];
- strncpy (la_buf, temp_string, DTM_STRING_BUF_SIZE - 1);
- tm_log_stdout(event_id, severity, la_buf, error_code, rmid, dtmid, seq_num, msgid, xa_error,
- pool_size, pool_elems, msg_retries, pool_high, pool_low, pool_max, tx_state,
- data, data1, data2, string1, node, msgid2, offset, tm_event_msg, data4);
- }
- return rc;
-}
-
-
-int tm_log_stdout(int event_id,
- posix_sqlog_severity_t severity,
- const char *temp_string,
- int error_code,
- int rmid,
- int dtmid,
- int seq_num,
- int msgid,
- int xa_error,
- int pool_size,
- int pool_elems,
- int msg_retries,
- int pool_high,
- int pool_low,
- int pool_max,
- int tx_state,
- int data,
- int data1,
- int64 data2,
- const char *string1,
- int node,
- int msgid2,
- int offset,
- int tm_event_msg,
- uint data4)
-
-{
- time_t current_time;
- char timestamp[50];
-
- char my_name[MS_MON_MAX_PROCESS_NAME];
- int my_nid,my_pid;
- int error;
-
- current_time = time(NULL);
- ctime_r(¤t_time,timestamp);
- timestamp[strlen(timestamp)-1] = '\0';
-
- printf("%s ", timestamp);
-
- error = msg_mon_get_my_process_name( my_name, sizeof(my_name) );
- if (!error)
- {
- error = msg_mon_get_process_info( my_name, &my_nid, &my_pid );
- if (!error)
- printf("(%s,%u,%u) ",my_name,my_nid,my_pid);
- else
- {
- my_nid = -1;
- my_pid = -1;
- }
- }
- else
- strcpy(my_name, "UNKNOWN");
-
-
- printf("Event %s(%d), Sev ", temp_string, event_id);
- switch (severity)
- {
- case SQ_LOG_EMERG: printf("EMERGENCY"); break;
- case SQ_LOG_ALERT: printf("ALERT"); break;
- case SQ_LOG_CRIT: printf("CRITICAL"); break;
- case SQ_LOG_ERR: printf("ERROR"); break;
- case SQ_LOG_WARNING: printf("WARNING"); break;
- case SQ_LOG_NOTICE: printf("NOTICE"); break;
- case SQ_LOG_INFO: printf("INFO"); break;
- case SQ_LOG_DEBUG: printf("DEBUG"); break;
- default: printf("%d Unknown", severity);
- }
- printf(", ");
-
- if (error_code != -1)
- printf(", Error=%d",error_code);
- if (rmid != -1)
- printf(", rmid=%d",rmid);
- if (dtmid != -1)
- printf(", dtmid=%d",dtmid);
- if (seq_num != -1)
- printf(", seqnum=%d",seq_num);
- if (msgid != -1)
- printf(", msgid=%d",msgid);
- if (xa_error != -1)
- printf(", XAERR=%d",xa_error);
- if (pool_size != -1)
- printf(", pool_size=%d",pool_size);
- if (pool_elems != -1)
- printf(", elements in pool=%d",pool_elems);
- if (msg_retries != -1)
- printf(", msg retries=%d",msg_retries);
- if (pool_high != -1)
- printf(", pool_high_ss=%d",pool_high);
- if (pool_low != -1)
- printf(", pool_low_ss=%d",pool_low);
- if (pool_max != -1)
- printf(", pool_max_size=%d",pool_max);
- if (tx_state != -1)
- printf(", Txn State=%d",tx_state);
- if (data != -1)
- printf(", data=%d",data);
- if (data1 != -1)
- printf(", data1=%d",data1);
- if (data2 != -1)
- printf(", data2=" PFLL,data2);
- if (string1 != NULL)
- printf(", string1=%s",string1);
- if (node != -1)
- printf(", node=%d",node);
- if (msgid2 != -1)
- printf(", msgid2=%d",msgid2);
- if (offset != -1)
- printf(", offset=%d",offset);
- if (tm_event_msg != -1)
- printf(", tm_event_msg=%d",tm_event_msg);
- if (data4 != 0)
- printf(", data4=%u",data4);
- printf("\n");
-
- return error;
-}