Changeset: 10360088aca4 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=10360088aca4
Added Files:
        sql/test/BugTracker-2012/Tests/segfault_incorrect_head.Bug-3028.sql
        
sql/test/BugTracker-2012/Tests/segfault_incorrect_head.Bug-3028.stable.err
        
sql/test/BugTracker-2012/Tests/segfault_incorrect_head.Bug-3028.stable.out
Modified Files:
        monetdb5/modules/kernel/batmtime.mx
        sql/test/BugTracker-2012/Tests/All
Branch: Apr2012
Log Message:

fix crash after MTIME bat map operations
Now correctly return oid heads with oid inputs.


diffs (211 lines):

diff --git a/monetdb5/modules/kernel/batmtime.mx 
b/monetdb5/modules/kernel/batmtime.mx
--- a/monetdb5/modules/kernel/batmtime.mx
+++ b/monetdb5/modules/kernel/batmtime.mx
@@ -161,14 +161,14 @@ str MTIMEbat_@1_@2_@3(int *ret, int *l)
        BATaccessEnd(b, USE_TAIL, MMAP_SEQUENTIAL);
        if (!(bn->batDirty&2)) bn = BATsetaccess(bn, BAT_READ); 
 
-    if (b->htype != bn->htype) {
-        BAT *r = VIEWcreate(b,bn);
+       BATsetcount(bn, BATcount(b));
+       if (b->htype != bn->htype) {
+               BAT *r = VIEWcreate(b,bn);
 
-        BBPreleaseref(bn->batCacheid);
-        bn = r;
-    }
+               BBPreleaseref(bn->batCacheid);
+               bn = r;
+       }
 
-       BATsetcount(bn, BATcount(b));
        bn->tsorted = 0;
        BATkey(BATmirror(bn),FALSE);
        BBPkeepref(*ret= bn->batCacheid);
@@ -220,15 +220,15 @@ str MTIMEbat_@1_@2(int *ret, int *l, int
        BATaccessEnd(b, USE_TAIL, MMAP_SEQUENTIAL);
        if (!(bn->batDirty&2)) bn = BATsetaccess(bn, BAT_READ); 
 
+       BATsetcount(bn, BATcount(b));
 
-    if (b->htype != bn->htype) {
-        BAT *r = VIEWcreate(b,bn);
+       if (b->htype != bn->htype) {
+               BAT *r = VIEWcreate(b,bn);
+       
+               BBPreleaseref(bn->batCacheid);
+               bn = r;
+       }
 
-        BBPreleaseref(bn->batCacheid);
-        bn = r;
-    }
-
-       BATsetcount(bn, BATcount(b));
        bn->tsorted = 0;
        BATkey(BATmirror(bn),FALSE);
        BBPkeepref(*ret= bn->batCacheid);
@@ -320,6 +320,15 @@ str MTIMEbat_@1_@2_cst(int *ret, int *l,
 
        BATaccessEnd(b, USE_TAIL, MMAP_SEQUENTIAL);
 
+       if (!(bn->batDirty&2)) bn = BATsetaccess(bn, BAT_READ);
+
+       if (b->htype != bn->htype) {
+               BAT *r = VIEWcreate(b,bn);
+
+               BBPreleaseref(bn->batCacheid);
+               bn = r;
+       }
+
        bn->tsorted = 0;
        BATkey(BATmirror(bn),FALSE);
        BBPkeepref(*ret= bn->batCacheid);
diff --git a/sql/test/BugTracker-2012/Tests/All 
b/sql/test/BugTracker-2012/Tests/All
--- a/sql/test/BugTracker-2012/Tests/All
+++ b/sql/test/BugTracker-2012/Tests/All
@@ -26,3 +26,4 @@ bart-crash.Bug-3057
 set_operation.Bug-3059
 delete-with-constant-where.Bug-3065
 name_resolution_in_proc.Bug-3074
+segfault_incorrect_head.Bug-3028
diff --git 
a/sql/test/BugTracker-2012/Tests/segfault_incorrect_head.Bug-3028.sql 
b/sql/test/BugTracker-2012/Tests/segfault_incorrect_head.Bug-3028.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2012/Tests/segfault_incorrect_head.Bug-3028.sql
@@ -0,0 +1,25 @@
+CREATE TABLE "sys"."cache_kv1" (
+        "doc_lpn_jpc_tdgc"    VARCHAR(43)
+);
+CREATE TABLE "sys"."cache_kv1_3" (
+        "daytype"              SMALLINT      NOT NULL,
+        "validfrom"            DATE          NOT NULL,
+        "validthru"            DATE          NOT NULL,
+        "doc_lpn_jpc_tdgc"     VARCHAR(43)
+);
+
+insert into cache_kv1 values ('1');
+insert into cache_kv1_3 values (8, '2012-02-01', '2012-04-01', '1');
+insert into cache_kv1_3 values (8, '2012-02-01', '2012-04-01', '2');
+insert into cache_kv1 values ('4');
+insert into cache_kv1_3 values (8, '2012-01-01', '2012-01-02', '1');
+insert into cache_kv1_3 values (1, '2012-01-01', '2012-01-02', '1');
+
+select *
+FROM cache_kv1, cache_kv1_3 WHERE
+cache_kv1.doc_lpn_jpc_tdgc = cache_kv1_3.doc_lpn_jpc_tdgc and
+bit_and(cache_kv1_3.daytype, 8) = 8 and
+'2012-03-20' BETWEEN cache_kv1_3.validfrom AND cache_kv1_3.validthru;
+
+drop table cache_kv1_3;
+drop table cache_kv1;
diff --git 
a/sql/test/BugTracker-2012/Tests/segfault_incorrect_head.Bug-3028.stable.err 
b/sql/test/BugTracker-2012/Tests/segfault_incorrect_head.Bug-3028.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2012/Tests/segfault_incorrect_head.Bug-3028.stable.err
@@ -0,0 +1,37 @@
+stderr of test 'segfault_incorrect_head.Bug-3028` in directory 
'test/BugTracker-2012` itself:
+
+
+# 20:23:33 >  
+# 20:23:33 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"gdk_dbfarm=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB" "--set" 
"mapi_open=true" "--set" "mapi_port=33973" "--set" "monet_prompt=" "--trace" 
"--forcemito" "--set" "mal_listing=2" "--dbname=mTests_test_BugTracker-2012" 
"--set" "mal_listing=0"
+# 20:23:33 >  
+
+# builtin opt  gdk_dbname = demo
+# builtin opt  gdk_dbfarm = 
/home/niels/scratch/rc-clean/Linux-x86_64/var/monetdb5/dbfarm
+# builtin opt  gdk_debug = 0
+# builtin opt  gdk_alloc_map = no
+# builtin opt  gdk_vmtrim = yes
+# 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  gdk_dbfarm = 
/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB
+# cmdline opt  mapi_open = true
+# cmdline opt  mapi_port = 33973
+# cmdline opt  monet_prompt = 
+# cmdline opt  mal_listing = 2
+# cmdline opt  gdk_dbname = mTests_test_BugTracker-2012
+# cmdline opt  mal_listing = 0
+
+# 20:23:33 >  
+# 20:23:33 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=niels" 
"--port=33973"
+# 20:23:33 >  
+
+
+# 20:23:33 >  
+# 20:23:33 >  "Done."
+# 20:23:33 >  
+
diff --git 
a/sql/test/BugTracker-2012/Tests/segfault_incorrect_head.Bug-3028.stable.out 
b/sql/test/BugTracker-2012/Tests/segfault_incorrect_head.Bug-3028.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2012/Tests/segfault_incorrect_head.Bug-3028.stable.out
@@ -0,0 +1,63 @@
+stdout of test 'segfault_incorrect_head.Bug-3028` in directory 
'test/BugTracker-2012` itself:
+
+
+# 20:23:33 >  
+# 20:23:33 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"gdk_dbfarm=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB" "--set" 
"mapi_open=true" "--set" "mapi_port=33973" "--set" "monet_prompt=" "--trace" 
"--forcemito" "--set" "mal_listing=2" "--dbname=mTests_test_BugTracker-2012" 
"--set" "mal_listing=0"
+# 20:23:33 >  
+
+# MonetDB 5 server v11.9.2
+# This is an unreleased version
+# Serving database 'mTests_test_BugTracker-2012', using 4 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically 
linked
+# Found 3.778 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2012 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on 
mapi:monetdb://niels.nesco.mine.nu:33973/
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+
+Ready.
+
+# 20:23:33 >  
+# 20:23:33 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=niels" 
"--port=33973"
+# 20:23:33 >  
+
+#CREATE TABLE "sys"."cache_kv1" (
+#        "doc_lpn_jpc_tdgc"    VARCHAR(43)
+#);
+#CREATE TABLE "sys"."cache_kv1_3" (
+#        "daytype"              SMALLINT      NOT NULL,
+#        "validfrom"            DATE          NOT NULL,
+#        "validthru"            DATE          NOT NULL,
+#        "doc_lpn_jpc_tdgc"     VARCHAR(43)
+#);
+#insert into cache_kv1 values ('1');
+[ 1    ]
+#insert into cache_kv1_3 values (8, '2012-02-01', '2012-04-01', '1');
+[ 1    ]
+#insert into cache_kv1_3 values (8, '2012-02-01', '2012-04-01', '2');
+[ 1    ]
+#insert into cache_kv1 values ('4');
+[ 1    ]
+#insert into cache_kv1_3 values (8, '2012-01-01', '2012-01-02', '1');
+[ 1    ]
+#insert into cache_kv1_3 values (1, '2012-01-01', '2012-01-02', '1');
+[ 1    ]
+#select *
+#FROM cache_kv1, cache_kv1_3 WHERE
+#cache_kv1.doc_lpn_jpc_tdgc = cache_kv1_3.doc_lpn_jpc_tdgc and
+#bit_and(cache_kv1_3.daytype, 8) = 8 and
+#'2012-03-20' BETWEEN cache_kv1_3.validfrom AND cache_kv1_3.validthru;
+% sys.cache_kv1,       sys.cache_kv1_3,        sys.cache_kv1_3,        
sys.cache_kv1_3,        sys.cache_kv1_3 # table_name
+% doc_lpn_jpc_tdgc,    daytype,        validfrom,      validthru,      
doc_lpn_jpc_tdgc # name
+% varchar,     smallint,       date,   date,   varchar # type
+% 1,   1,      10,     10,     1 # length
+[ "1", 8,      2012-02-01,     2012-04-01,     "1"     ]
+#drop table cache_kv1_3;
+#drop table cache_kv1;
+
+# 20:23:33 >  
+# 20:23:33 >  "Done."
+# 20:23:33 >  
+
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to