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/02/04 22:33:10 UTC
[1/2] incubator-trafodion git commit: Fix for JIRA [TRAFODION-1713]
IDs returned from IDTMSRV process should be periodically re-calibrated so
that they are a better approximation of a logical time
Repository: incubator-trafodion
Updated Branches:
refs/heads/master d0951c3d8 -> 96ce1f35e
Fix for JIRA [TRAFODION-1713]
IDs returned from IDTMSRV process should be periodically re-calibrated
so that they are a better approximation of a logical time
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/bc46f3df
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/bc46f3df
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/bc46f3df
Branch: refs/heads/master
Commit: bc46f3df818651a6dae180689bb298551399be0d
Parents: a8743f2
Author: Sean Broeder <sb...@edev03.esgyn.local>
Authored: Tue Feb 2 21:13:18 2016 +0000
Committer: Sean Broeder <sb...@edev03.esgyn.local>
Committed: Tue Feb 2 21:13:18 2016 +0000
----------------------------------------------------------------------
core/sqf/sql/scripts/genms | 1 +
core/sqf/src/tm/idtmsrv.cpp | 48 +++++++++++++++++++++++++++++++++++++++-
2 files changed, 48 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/bc46f3df/core/sqf/sql/scripts/genms
----------------------------------------------------------------------
diff --git a/core/sqf/sql/scripts/genms b/core/sqf/sql/scripts/genms
index 13839db..8357a88 100755
--- a/core/sqf/sql/scripts/genms
+++ b/core/sqf/sql/scripts/genms
@@ -33,6 +33,7 @@ echo "#TM_TLOG_MAX_VERSIONS less than 3 will be ignored"
echo "TM_TLOG_MAX_VERSIONS=5"
echo "TM_ENABLE_DDL_TRANS=0"
echo "TM_USE_SSCC=0"
+echo "TM_IDTMSRV_REFRESH_DELAY_SECONDS=3"
echo "TSE_CONVERT_NOUNDO_TRANS=1"
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/bc46f3df/core/sqf/src/tm/idtmsrv.cpp
----------------------------------------------------------------------
diff --git a/core/sqf/src/tm/idtmsrv.cpp b/core/sqf/src/tm/idtmsrv.cpp
index a53ab90..f6fdef4 100644
--- a/core/sqf/src/tm/idtmsrv.cpp
+++ b/core/sqf/src/tm/idtmsrv.cpp
@@ -37,9 +37,12 @@
#include "seabed/ms.h"
#include "seabed/pctl.h"
#include "seabed/pevents.h"
-
+#include "seabed/timer.h"
+#include "seabed/thread.h"
#include "idtmsrv.h"
+short gv_tleid;
+short gv_time_refresh_delay; // time in tics (10ms)
char ga_name[BUFSIZ];
char *gp_shm;
unsigned long *gp_shml;
@@ -53,6 +56,37 @@ void do_reply(BMS_SRE *pp_sre, char *pp_reply, int pv_len, short pv_ec);
//
+// Reset the global time counter
+//
+void reset_time_counter() {
+
+ struct timespec lv_new_ts;
+
+ clock_gettime(CLOCK_REALTIME, &lv_new_ts);
+ unsigned long lv_new_tsl = ((unsigned long) lv_new_ts.tv_sec << 20) |
+ ((unsigned long) lv_new_ts.tv_nsec / 1000);
+
+ unsigned long lv_existing_tsl = __sync_add_and_fetch_8(gp_shm, 0);
+ __sync_add_and_fetch_8(gp_shm, lv_new_tsl - lv_existing_tsl);
+
+ if (gv_verbose)
+ printf("srv: reset_time_counter, adjustment=0x%lx, shm=0x%lx\n", lv_new_tsl - lv_existing_tsl, *gp_shml);
+}
+
+//
+// Timer callback
+//
+void timer_callback(int tleid, int toval, short parm1, long parm2) {
+ int ferr;
+
+ if (gv_verbose)
+ printf("timer_callback \n");
+ reset_time_counter();
+ ferr = timer_start_cb(gv_time_refresh_delay, 0, 0, &gv_tleid, &timer_callback);
+ assert(ferr == XZFIL_ERR_OK);
+}
+
+//
// initialize
//
void do_init(int pv_argc, char **ppp_argv) {
@@ -60,6 +94,7 @@ void do_init(int pv_argc, char **ppp_argv) {
int lv_arg;
bool lv_attach;
int lv_ferr;
+ char *lv_delay_s;
lv_attach = false;
for (lv_arg = 1; lv_arg < pv_argc; lv_arg++) {
@@ -77,6 +112,15 @@ void do_init(int pv_argc, char **ppp_argv) {
lv_ferr = msg_init(&pv_argc, &ppp_argv);
assert(lv_ferr == XZFIL_ERR_OK);
+ gv_time_refresh_delay = 200; // 2 seconds
+ lv_delay_s = getenv("TM_IDTMSRV_REFRESH_DELAY_SECONDS");
+ if (lv_delay_s != NULL) {
+ gv_time_refresh_delay = 100 * (atoi(lv_delay_s));
+ }
+ if (gv_verbose){
+ printf("TM_IDTMSRV_REFRESH_DELAY_SECONDS is %s. Setting gv_time_refresh_delay to %d \n", lv_delay_s, gv_time_refresh_delay);
+ }
+
if (gv_shook)
msg_debug_hook("s", "s");
}
@@ -296,6 +340,8 @@ int main(int pv_argc, char *pa_argv[]) {
assert(lv_ferr == XZFIL_ERR_OK);
do_shm();
+ lv_ferr = timer_start_cb(gv_time_refresh_delay, 0, 0, &gv_tleid, &timer_callback);
+ assert(lv_ferr == XZFIL_ERR_OK);
lv_done = false;
while (!lv_done) {
[2/2] incubator-trafodion git commit: Merge [TRAFODION-1713] PR 304
Re-calibrate trans IDs to approx local time
Posted by db...@apache.org.
Merge [TRAFODION-1713] PR 304 Re-calibrate trans IDs to approx local time
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/96ce1f35
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/96ce1f35
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/96ce1f35
Branch: refs/heads/master
Commit: 96ce1f35efed56eea96c6b7227918f408643681c
Parents: d0951c3 bc46f3d
Author: Dave Birdsall <db...@apache.org>
Authored: Thu Feb 4 21:32:16 2016 +0000
Committer: Dave Birdsall <db...@apache.org>
Committed: Thu Feb 4 21:32:16 2016 +0000
----------------------------------------------------------------------
core/sqf/sql/scripts/genms | 1 +
core/sqf/src/tm/idtmsrv.cpp | 48 +++++++++++++++++++++++++++++++++++++++-
2 files changed, 48 insertions(+), 1 deletion(-)
----------------------------------------------------------------------