Changeset: d9a5cd06a6a5 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d9a5cd06a6a5
Modified Files:
monetdb5/modules/mal/wlcr.c
monetdb5/modules/mal/wlcr.mal
sql/backends/monet5/sql_wlcr.c
sql/backends/monet5/sql_wlcr.mal
sql/test/wlcr/Tests/wlr01.py
Branch: wlcr
Log Message:
Keep the execution time near the query
This gives a better control on its re-execution in the clone
diffs (103 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
@@ -32,9 +32,11 @@
* It contains the following key=value pairs:
* snapshot=<path to a binary snapshot>
* logs=<path to the wlcr log directory>
- * start=<first batch file to be applied>
- * last=<last batch file to be applied>
+ * firstbatch=<first batch file to be applied>
+ * batches=<last batch file to be applied>
* drift=<maximal delay before transactions are seen globally, in
seconds>
+ * threshold=<min response time for queries to be kept>
+ * rollbock=<flag to indicate keeping the aborted transactions as
well>
*
* Every replica should start off with a copy of binary snapshot identified by
'snapshot'
* by default stored in .../dbfarm/dbname/master/bat. An alternative path can
be given
@@ -90,8 +92,8 @@
*
* The alternative is to also replay the queries as well.
* CALL replaythreshold(threshold)
- * In this mode all pure queries are executed under the credentials of the
query owner
- * for which the reported threshold exceeds the argument[TODO].
+ * In this mode all pure queries are executed for which the reported threshold
exceeds the argument.
+ * Enabling the query log collects the execution times for these queries.
* It excludes catalog and update queries, which are always executed.
*
* Any failure encountered during a log replay terminates the process,
@@ -458,6 +460,7 @@ WLCquery(Client cntxt, MalBlkPtr mb, Mal
p = pushStr(cntxt->wlcr, p, getVarConstant(mb, getArg(pci,1)).val.sval);
p = pushStr(cntxt->wlcr, p, getVarConstant(mb, getArg(pci,2)).val.sval);
p->ticks = GDKms();
+ p = pushInt(cntxt->wlcr, p, p->ticks);
return MAL_SUCCEED;
}
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
@@ -42,9 +42,9 @@ pattern exec()
address WLCexec
comment "Mark the end of the work unit";
-pattern query(q:str,pipe:str)
+pattern query(q:str, pipe:str)
address WLCquery
-comment "Initialize the workload-capture-replay ";
+comment "Keep the queries for replay";
pattern append(sname:str, tname:str, cname:str, ins:any):int
address WLCappend
diff --git a/sql/backends/monet5/sql_wlcr.c b/sql/backends/monet5/sql_wlcr.c
--- a/sql/backends/monet5/sql_wlcr.c
+++ b/sql/backends/monet5/sql_wlcr.c
@@ -26,6 +26,7 @@
#include "opt_prelude.h"
#include "mal_parser.h"
#include "mal_client.h"
+#include "querylog.h"
#define WLCR_REPLAY 1
#define WLCR_REPLICATE 2
@@ -360,7 +361,7 @@ WLRjob(Client cntxt, MalBlkPtr mb, MalSt
if( strcmp(kind,"update") == 0)
cntxt->wlcr_kind = WLCR_UPDATE;
if( strcmp(kind,"query") == 0){
- if(wlcr_threshold < 0 || duration < wlcr_threshold)
+ if(wlcr_threshold < 0 || duration < wlcr_threshold || duration
< wlr_threshold )
cntxt->wlcr_kind = WLCR_IGNORE;
else
cntxt->wlcr_kind = WLCR_QUERY;
@@ -389,7 +390,7 @@ WLRquery(Client cntxt, MalBlkPtr mb, Mal
(void) mb;
// execute the query in replay mode
- if( cntxt->wlcr_kind == WLCR_CATALOG || cntxt->wlcr_kind == WLCR_QUERY
){
+ if( cntxt->wlcr_kind == WLCR_CATALOG || cntxt->wlcr_kind == WLCR_QUERY
){
// we need to get rid of the escaped quote.
x = qtxt= (char*) GDKmalloc(strlen(qry) +1);
for(y = qry; *y; y++){
diff --git a/sql/backends/monet5/sql_wlcr.mal b/sql/backends/monet5/sql_wlcr.mal
--- a/sql/backends/monet5/sql_wlcr.mal
+++ b/sql/backends/monet5/sql_wlcr.mal
@@ -27,7 +27,7 @@ pattern exec()
address WLRexec
comment "Mark the end of the work unit";
-pattern query(q:str,pipe:str)
+pattern query(q:str,pipe:str,duration:int)
address WLRquery
comment "The actual query applied";
diff --git a/sql/test/wlcr/Tests/wlr01.py b/sql/test/wlcr/Tests/wlr01.py
--- a/sql/test/wlcr/Tests/wlr01.py
+++ b/sql/test/wlcr/Tests/wlr01.py
@@ -29,6 +29,7 @@ slave = process.server(dbname = dbnamecl
c = process.client('sql', dbname = dbnameclone, port = cloneport, stdin =
process.PIPE, stdout = process.PIPE, stderr = process.PIPE)
cout, cerr = c.communicate('''\
+call replaythreshold(100);
call replicate('%s');
select * from tmp;
''' % dbname)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list