Changeset: 3f616863986f for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3f616863986f
Added Files:
sql/test/wlcr/Tests/wlc50.py
sql/test/wlcr/Tests/wlc50.stable.err
sql/test/wlcr/Tests/wlc50.stable.out
sql/test/wlcr/Tests/wlr50.py
sql/test/wlcr/Tests/wlr50.stable.err
sql/test/wlcr/Tests/wlr50.stable.out
Modified Files:
monetdb5/modules/mal/wlcr.c
monetdb5/modules/mal/wlcr.mal
monetdb5/optimizer/opt_wlcr.c
sql/test/wlcr/Tests/All
sql/test/wlcr/Tests/wlc40.py
sql/test/wlcr/Tests/wlc40.stable.out
sql/test/wlcr/Tests/wlr40.stable.out
Branch: wlcr
Log Message:
And propagate the deletions to the replica
diffs (truncated from 392 to 300 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
@@ -583,7 +583,7 @@ WLCappend(Client cntxt, MalBlkPtr mb, Ma
str
WLCdelete(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
{ InstrPtr p;
- int tpe, varid;
+ int tpe;
(void) stk;
(void) mb;
@@ -591,18 +591,19 @@ WLCdelete(Client cntxt, MalBlkPtr mb, Ma
p = newStmt(cntxt->wlcr, "wlr","delete");
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 = pushStr(cntxt->wlcr, p, getVarConstant(mb, getArg(pci,3)).val.sval);
- tpe= getArgType(mb,pci,4);
+ tpe= getArgType(mb,pci,3);
if (isaBatType(tpe) ){
- WLCdatashipping(cntxt, mb, p, stk->stk[getArg(pci,4)].val.bval);
- } else {
+ WLCdatashipping(cntxt, mb, p, stk->stk[getArg(pci,3)].val.bval);
+ } else
+ throw(MAL,"wlcr.delete","BAT expected");
+/*
ValRecord cst;
if (VALcopy(&cst, getArgReference(stk,pci,4)) != NULL){
varid = defConstant(cntxt->wlcr, tpe, &cst);
p = pushArgument(cntxt->wlcr, p, varid);
}
- }
+*/
if( cntxt->wlcr_kind < WLCR_UPDATE)
cntxt->wlcr_kind = WLCR_UPDATE;
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
@@ -51,7 +51,7 @@ address WLCupdate
comment "Keep the update in the workload-capture-replay list";
pattern delete(sname:str, tname:str, b:any):int
-address WLCreset
+address WLCdelete
comment "Keep the deletions in the workload-capture-replay list";
pattern clear_table(sname:str, tname:str):int
diff --git a/monetdb5/optimizer/opt_wlcr.c b/monetdb5/optimizer/opt_wlcr.c
--- a/monetdb5/optimizer/opt_wlcr.c
+++ b/monetdb5/optimizer/opt_wlcr.c
@@ -48,6 +48,7 @@ OPTwlcrImplementation(Client cntxt, MalB
getArg(q,0) = newTmpVariable(mb,TYPE_any);
q->argc--; // no need for the userid
pushInstruction(mb,q);
+ updates++;
} else
/* the catalog operations are needed to determine the job kind
later on */
if( getModuleId(p) == sqlcatalogRef &&
@@ -64,12 +65,14 @@ OPTwlcrImplementation(Client cntxt, MalB
getArg(q,0) = newTmpVariable(mb,TYPE_any);
delArgument(q, 3);
pushInstruction(mb,q);
+ updates++;
} else
if( getModuleId(p) == sqlcatalogRef){
q= copyInstruction(p);
setModuleId(q, wlcrRef);
getArg(q,0) = newTmpVariable(mb,TYPE_any);
pushInstruction(mb,q);
+ updates++;
} else
if( getModuleId(p) == sqlRef &&
(getFunctionId(p) == clear_tableRef ||
@@ -78,6 +81,7 @@ OPTwlcrImplementation(Client cntxt, MalB
setModuleId(q, wlcrRef);
getArg(q,0) = newTmpVariable(mb,TYPE_any);
pushInstruction(mb,q);
+ updates++;
} else
if( getModuleId(p) == sqlRef &&
( getFunctionId(p) == appendRef ||
@@ -89,6 +93,7 @@ OPTwlcrImplementation(Client cntxt, MalB
for( j=0; j< p->retc; j++)
getArg(q,j) =
newTmpVariable(mb,TYPE_any);
pushInstruction(mb,q);
+ updates++;
}
}
for(; i<slimit; i++)
diff --git a/sql/test/wlcr/Tests/All b/sql/test/wlcr/Tests/All
--- a/sql/test/wlcr/Tests/All
+++ b/sql/test/wlcr/Tests/All
@@ -20,6 +20,10 @@ wlc30
# roll forward to replica
wlr30
-#clear the complete table
+#delete some tupples
wlc40
wlr40
+
+#clear the complete table
+wlc50
+wlr50
diff --git a/sql/test/wlcr/Tests/wlc40.py b/sql/test/wlcr/Tests/wlc40.py
--- a/sql/test/wlcr/Tests/wlc40.py
+++ b/sql/test/wlcr/Tests/wlc40.py
@@ -18,7 +18,8 @@ s = process.server(dbname = dbname, stdi
c = process.client('sql', dbname = dbname, stdin = process.PIPE, stdout =
process.PIPE, stderr = process.PIPE)
cout, cerr = c.communicate('''\
-delete from tmp;
+select * from tmp;
+delete from tmp where i < 4;
select * from tmp;
''')
diff --git a/sql/test/wlcr/Tests/wlc40.stable.out
b/sql/test/wlcr/Tests/wlc40.stable.out
--- a/sql/test/wlcr/Tests/wlc40.stable.out
+++ b/sql/test/wlcr/Tests/wlc40.stable.out
@@ -17,13 +17,27 @@ stdout of test 'wlc40` in directory 'sql
# Listening for UNIX domain connection requests on
mapi:monetdb:///var/tmp/mtest-24794/.s.monetdb.34000
# MonetDB/GIS module loaded
# MonetDB/SQL module loaded
-#delete from tmp;
-[ 6 ]
#select * from tmp;
% sys.tmp, sys.tmp # table_name
% i, s # name
% int, clob # type
-% 1, 0 # length
+% 1, 4 # length
+[ 3, "blah" ]
+[ 2, "blah" ]
+[ 3, "blah" ]
+[ 4, "blah" ]
+[ 5, "blah" ]
+[ 6, "blah" ]
+#delete from tmp where i < 4;
+[ 3 ]
+#select * from tmp;
+% sys.tmp, sys.tmp # table_name
+% i, s # name
+% int, clob # type
+% 1, 4 # length
+[ 4, "blah" ]
+[ 5, "blah" ]
+[ 6, "blah" ]
# 13:02:55 >
# 13:02:55 > "Done."
diff --git a/sql/test/wlcr/Tests/wlc50.py b/sql/test/wlcr/Tests/wlc50.py
new file mode 100644
--- /dev/null
+++ b/sql/test/wlcr/Tests/wlc50.py
@@ -0,0 +1,30 @@
+try:
+ from MonetDBtesting import process
+except ImportError:
+ import process
+import os, sys
+
+dbfarm = os.getenv('GDK_DBFARM')
+tstdb = os.getenv('TSTDB')
+
+if not tstdb or not dbfarm:
+ print 'No TSTDB or GDK_DBFARM in environment'
+ sys.exit(1)
+
+dbname = tstdb
+
+s = process.server(dbname = dbname, stdin = process.PIPE, stdout =
process.PIPE, stderr = process.PIPE)
+
+c = process.client('sql', dbname = dbname, stdin = process.PIPE, stdout =
process.PIPE, stderr = process.PIPE)
+
+cout, cerr = c.communicate('''\
+delete from tmp;
+select * from tmp;
+''')
+
+sout, serr = s.communicate()
+
+sys.stdout.write(sout)
+sys.stdout.write(cout)
+sys.stderr.write(serr)
+sys.stderr.write(cerr)
diff --git a/sql/test/wlcr/Tests/wlc50.stable.err
b/sql/test/wlcr/Tests/wlc50.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/wlcr/Tests/wlc50.stable.err
@@ -0,0 +1,29 @@
+stderr of test 'wlc50` in directory 'sql/test/wlcr` itself:
+
+
+# 20:24:39 >
+# 20:24:39 > "/usr/bin/python2" "wlc50.py" "wlc50"
+# 20:24:39 >
+
+# builtin opt gdk_dbpath =
/export/scratch1/mk/wlcr//Linux/var/monetdb5/dbfarm/demo
+# builtin opt gdk_debug = 0
+# builtin opt gdk_vmtrim = no
+# builtin opt monet_prompt = >
+# builtin opt monet_daemon = no
+# builtin opt mapi_port = 50000
+# builtin opt mapi_open = false
+# builtin opt mapi_autosense = false
+# builtin opt sql_optimizer = default_pipe
+# builtin opt sql_debug = 0
+# cmdline opt gdk_nr_threads = 0
+# cmdline opt mapi_open = true
+# cmdline opt mapi_port = 31822
+# cmdline opt mapi_usock = /var/tmp/mtest-21852/.s.monetdb.31822
+# cmdline opt monet_prompt =
+# cmdline opt gdk_dbpath =
/export/scratch1/mk/wlcr//Linux/var/MonetDB/mTests_sql_test_wlcr
+# cmdline opt gdk_debug = 536870922
+
+# 20:24:40 >
+# 20:24:40 > "Done."
+# 20:24:40 >
+
diff --git a/sql/test/wlcr/Tests/wlc50.stable.out
b/sql/test/wlcr/Tests/wlc50.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/wlcr/Tests/wlc50.stable.out
@@ -0,0 +1,31 @@
+stdout of test 'wlc50` in directory 'sql/test/wlcr` itself:
+
+
+# 20:24:39 >
+# 20:24:39 > "/usr/bin/python2" "wlc50.py" "wlc50"
+# 20:24:39 >
+
+# MonetDB 5 server v11.26.0
+# This is an unreleased version
+# Serving database 'mTests_sql_test_wlcr', using 8 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 128bit integers
+# Found 15.589 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2017 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://vienna.da.cwi.nl:31822/
+# Listening for UNIX domain connection requests on
mapi:monetdb:///var/tmp/mtest-21852/.s.monetdb.31822
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+#delete from tmp;
+[ 3 ]
+#select * from tmp;
+% sys.tmp, sys.tmp # table_name
+% i, s # name
+% int, clob # type
+% 1, 0 # length
+
+# 20:24:40 >
+# 20:24:40 > "Done."
+# 20:24:40 >
+
diff --git a/sql/test/wlcr/Tests/wlr40.stable.out
b/sql/test/wlcr/Tests/wlr40.stable.out
--- a/sql/test/wlcr/Tests/wlr40.stable.out
+++ b/sql/test/wlcr/Tests/wlr40.stable.out
@@ -24,7 +24,10 @@ stdout of test 'wlr40` in directory 'sql
% sys.tmp, sys.tmp # table_name
% i, s # name
% int, clob # type
-% 1, 0 # length
+% 1, 4 # length
+[ 4, "blah" ]
+[ 5, "blah" ]
+[ 6, "blah" ]
# 13:02:55 >
# 13:02:55 > "Done."
diff --git a/sql/test/wlcr/Tests/wlr50.py b/sql/test/wlcr/Tests/wlr50.py
new file mode 100644
--- /dev/null
+++ b/sql/test/wlcr/Tests/wlr50.py
@@ -0,0 +1,43 @@
+try:
+ from MonetDBtesting import process
+except ImportError:
+ import process
+import os, sys, socket
+
+dbfarm = os.getenv('GDK_DBFARM')
+tstdb = os.getenv('TSTDB')
+
+if not tstdb or not dbfarm:
+ print 'No TSTDB or GDK_DBFARM in environment'
+ sys.exit(1)
+
+def freeport():
+ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ sock.bind(('', 0))
+ port = sock.getsockname()[1]
+ sock.close()
+ return port
+
+cloneport = freeport()
+
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list