Changeset: 174efdb6ed7d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=174efdb6ed7d
Modified Files:
        monetdb5/modules/mal/wlcr.c
        monetdb5/modules/mal/wlcr.h
        monetdb5/modules/mal/wlcr.mal
        sql/scripts/60_wlcr.sql
Branch: wlcr
Log Message:

Controll logging of aborted transactions


diffs (113 lines):

diff --git a/monetdb5/modules/mal/wlcr.c b/monetdb5/modules/mal/wlcr.c
--- a/monetdb5/modules/mal/wlcr.c
+++ b/monetdb5/modules/mal/wlcr.c
@@ -55,6 +55,11 @@
  * The threshold setting is saved and affects all future master log records.
  * The default for a production system version should be set to -1
  *
+ * The aborted transactions can also be gathered using the call
+ * CALL logrollback(1);
+ * Such queries may be helpful in the analysis of failures.
+ * They will end up in the querlog for inspection.
+ *
  * A transaction log is owned by the master. He decides when the log may be 
globally
  * used. There are several triggers for this. A new transaction log is created 
when
  * the system has been collecting logs for some time (drift).
@@ -122,6 +127,7 @@ int wlcr_firstbatch = 0;    // first log fi
 int wlcr_batches = 0;          // identifier of next batch
 int wlcr_drift = 10;   // maximal period covered by a single log file in 
seconds
 int wlcr_tid = 0;                      // transaction id of next to be 
processed
+int wlcr_rollback= 0;          // also log the aborted queries.
 
 /* The database snapshots are binary copies of the dbfarm/database/bat
  * New snapshots are created currently using the 'monetdb snapshot <db>' 
command
@@ -159,6 +165,8 @@ str WLCgetConfig(void){
                        wlcr_drift = atoi(path+ 6);
                if( strncmp("threshold=", path, 10) == 0)
                        wlcr_threshold = atoi(path+ 10);
+               if( strncmp("rollback=", path, 9) == 0)
+                       wlcr_threshold = atoi(path+ 9);
        }
        fclose(fd);
        return MAL_SUCCEED;
@@ -187,6 +195,7 @@ str WLCsetConfig(void){
        fprintf(fd,"batches=%d\n", wlcr_batches );
        fprintf(fd,"drift=%d\n", wlcr_drift );
        fprintf(fd,"threshold=%d\n", wlcr_threshold );
+       fprintf(fd,"rollback=%d\n", wlcr_rollback );
        fclose(fd);
        return MAL_SUCCEED;
 }
@@ -338,6 +347,15 @@ WLClogthreshold(Client cntxt, MalBlkPtr 
 }
 
 str 
+WLClogrollback(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+{
+       (void) mb;
+       (void) cntxt;
+       wlcr_rollback = * getArgReference_int(stk,pci,1);
+       return MAL_SUCCEED;
+}
+
+str 
 WLCdrift(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
 {
        (void) mb;
@@ -718,7 +736,9 @@ WLCwrite(Client cntxt, str kind)
                else {
                        // filter out queries that run too shortly
                        p = getInstrPtr(cntxt->wlcr,0);
-                       if( cntxt->wlcr_kind != WLCR_QUERY ||  wlcr_threshold 
== 0 || wlcr_threshold < GDKms() - p->ticks ) {
+                       if ( ( cntxt->wlcr_kind != WLCR_QUERY ||  
wlcr_threshold == 0 || wlcr_threshold < GDKms() - p->ticks ) &&
+                               (strcmp(kind,"rollback") != 0 || wlcr_rollback)
+                       ){
                                newStmt(cntxt->wlcr,"wlr","exec");
                                wlcr_tid++;
                                MT_lock_set(&wlcr_lock);
diff --git a/monetdb5/modules/mal/wlcr.h b/monetdb5/modules/mal/wlcr.h
--- a/monetdb5/modules/mal/wlcr.h
+++ b/monetdb5/modules/mal/wlcr.h
@@ -26,6 +26,7 @@ mal_export int wlcr_threshold;
 mal_export int wlcr_batches;
 mal_export int wlcr_drift;
 mal_export str wlcr_dbname;
+mal_export int wlcr_rollback;
 
 mal_export str WLCinit(Client cntxt);
 mal_export str WLCexit(void);
@@ -35,6 +36,7 @@ mal_export str WLCinitCmd(Client cntxt, 
 mal_export str WLCmaster(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci);
 mal_export str WLCstopmaster(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
 mal_export str WLClogthreshold(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
+mal_export str WLClogrollback(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
 mal_export str WLCdrift(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci);
 mal_export str WLCjob(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 mal_export str WLCexec(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci);
diff --git a/monetdb5/modules/mal/wlcr.mal b/monetdb5/modules/mal/wlcr.mal
--- a/monetdb5/modules/mal/wlcr.mal
+++ b/monetdb5/modules/mal/wlcr.mal
@@ -30,6 +30,10 @@ pattern logthreshold(limit:int)
 address WLClogthreshold
 comment "Activate the workload-capture-replay. Only queries surpassing the 
threshold (in milliseconds) are kept.";
 
+pattern logrollback(flag:int)
+address WLClogrollback
+comment "Activate the workload-capture-replay. Also keep the aborted 
transactions is flag !=0";
+
 pattern job(user:str, tid:int, started:str, action:str, kind:str, runtime:int)
 address WLCjob
 comment "Mark the beginning of the work unit which can be a compound 
transaction";
diff --git a/sql/scripts/60_wlcr.sql b/sql/scripts/60_wlcr.sql
--- a/sql/scripts/60_wlcr.sql
+++ b/sql/scripts/60_wlcr.sql
@@ -10,6 +10,9 @@
 create procedure logthreshold(duration int)
 external name wlcr.logthreshold;
 
+create procedure logrollback(flag int)
+external name wlcr.logrollback;
+
 create procedure drift(duration int)
 external name wlcr.drift;
 
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to