Changeset: 95d77c1c1b1c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/95d77c1c1b1c
Modified Files:
        gdk/gdk_bat.c
        sql/test/BugTracker-2016/Tests/storagemodel.test
Branch: Jul2021
Log Message:

When setting tkey property on view, maybe also set it on parent.


diffs (237 lines):

diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -1840,18 +1840,21 @@ BATkey(BAT *b, bool flag)
                b->tseqbase = oid_nil;
        } else
                b->tnokey[0] = b->tnokey[1] = 0;
-       if (/* DISABLES CODE */ (0) && flag && VIEWtparent(b)) {
+       gdk_return rc = GDK_SUCCEED;
+       if (flag && VIEWtparent(b)) {
                /* if a view is key, then so is the parent if the two
                 * are aligned */
                BAT *bp = BBP_cache(VIEWtparent(b));
+               MT_lock_set(&bp->theaplock);
                if (BATcount(b) == BATcount(bp) &&
                    ATOMtype(BATttype(b)) == ATOMtype(BATttype(bp)) &&
                    !BATtkey(bp) &&
                    ((BATtvoid(b) && BATtvoid(bp) && b->tseqbase == 
bp->tseqbase) ||
                     BATcount(b) == 0))
-                       return BATkey(bp, true);
+                       rc = BATkey(bp, true);
+               MT_lock_unset(&bp->theaplock);
        }
-       return GDK_SUCCEED;
+       return rc;
 }
 
 void
diff --git a/sql/test/BugTracker-2016/Tests/storagemodel.test 
b/sql/test/BugTracker-2016/Tests/storagemodel.test
--- a/sql/test/BugTracker-2016/Tests/storagemodel.test
+++ b/sql/test/BugTracker-2016/Tests/storagemodel.test
@@ -1,7 +1,7 @@
 statement ok
 create table bug3923(i integer)
 
-query TTTTTITI rowsort
+query TTTTTIII rowsort
 select "schema", "table", "column", "type", "mode", case when typewidth < 14 
then typewidth else 99 end as typewidth, phash, imprints > 0 as imprints from 
storage('sys','_tables')
 ----
 sys
@@ -10,7 +10,7 @@ access
 smallint
 writable
 2
-False
+0
 0
 sys
 _tables
@@ -18,7 +18,7 @@ commit_action
 smallint
 writable
 2
-False
+0
 0
 sys
 _tables
@@ -26,7 +26,7 @@ id
 int
 writable
 4
-False
+0
 0
 sys
 _tables
@@ -34,7 +34,7 @@ name
 varchar
 writable
 99
-False
+0
 0
 sys
 _tables
@@ -42,7 +42,7 @@ query
 varchar
 writable
 99
-False
+0
 0
 sys
 _tables
@@ -50,7 +50,7 @@ schema_id
 int
 writable
 4
-False
+0
 0
 sys
 _tables
@@ -58,7 +58,7 @@ system
 boolean
 writable
 1
-False
+0
 0
 sys
 _tables
@@ -66,7 +66,7 @@ type
 smallint
 writable
 2
-False
+0
 0
 
 statement ok
@@ -78,7 +78,7 @@ update storagemodelinput set "count" =10
 statement ok rowcount 1
 update storagemodelinput set "distinct" =10 where "table" ='bug3923' and 
"column" ='i'
 
-query TTTTIIIIIITTT rowsort
+query TTTTIIIIIIIII rowsort
 select * from storagemodel where "table" = 'bug3923'
 ----
 sys
@@ -91,9 +91,9 @@ 8312
 0
 2000
 0
-True
-NULL
-True
+1
+1
+1
 
 statement ok
 drop table bug3923
@@ -107,7 +107,7 @@ set schema bug3923schema
 statement ok
 create table bug3923(i integer)
 
-query TTTTTITI rowsort
+query TTTTTIII rowsort
 select "schema", "table", "column", "type", "mode", case when typewidth < 14 
then typewidth else 99 end as typewidth, phash, imprints > 0 as imprints from 
sys.storage('sys','_tables')
 ----
 sys
@@ -116,7 +116,7 @@ access
 smallint
 writable
 2
-False
+0
 0
 sys
 _tables
@@ -124,7 +124,7 @@ commit_action
 smallint
 writable
 2
-False
+0
 0
 sys
 _tables
@@ -132,7 +132,7 @@ id
 int
 writable
 4
-False
+0
 0
 sys
 _tables
@@ -140,7 +140,7 @@ name
 varchar
 writable
 99
-False
+0
 0
 sys
 _tables
@@ -148,7 +148,7 @@ query
 varchar
 writable
 99
-False
+0
 0
 sys
 _tables
@@ -156,7 +156,7 @@ schema_id
 int
 writable
 4
-False
+0
 0
 sys
 _tables
@@ -164,7 +164,7 @@ system
 boolean
 writable
 1
-False
+0
 0
 sys
 _tables
@@ -172,7 +172,7 @@ type
 smallint
 writable
 2
-False
+0
 1
 
 statement ok
@@ -184,7 +184,7 @@ update sys.storagemodelinput set "count"
 statement ok rowcount 1
 update sys.storagemodelinput set "distinct" =10 where "table" ='bug3923' and 
"column" ='i'
 
-query TTTTIIIIIITTT rowsort
+query TTTTIIIIIIIII rowsort
 select * from sys.storagemodel where "table" = 'bug3923'
 ----
 bug3923schema
@@ -197,9 +197,9 @@ 8312
 0
 2000
 0
-True
-NULL
-True
+1
+1
+1
 
 statement ok
 drop table bug3923
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to