Changeset: 8239c74f416d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8239c74f416d
Modified Files:
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
monetdb5/modules/kernel/bat5.c
Branch: default
Log Message:
Make getVHeapSize generic for varsized types and add heap lock
diffs (51 lines):
diff --git a/clients/Tests/MAL-signatures.stable.out
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -637,7 +637,7 @@
[ "bat", "getRole", "command bat.getRole(X_0:bat[:any_1]):str ",
"BKCgetRole;", "Returns the rolename of the head column of a BAT." ]
[ "bat", "getSequenceBase", "command
bat.getSequenceBase(X_0:bat[:any_1]):oid ", "BKCgetSequenceBase;", "Get the
sequence base for the void column of a BAT." ]
[ "bat", "getSize", "command bat.getSize(X_0:bat[:any_1]):lng ",
"BKCgetSize;", "Calculate the actual size of the BAT descriptor, heaps, hashes
and imprint indices in bytes\nrounded to the memory page size (see
bbp.getPageSize())." ]
-[ "bat", "getVHeapSize", "command bat.getVHeapSize(X_0:bat[:any_1]):lng
", "BKCgetVHeapSize;", "Calculate the vheap size for string bats"
]
+[ "bat", "getVHeapSize", "command bat.getVHeapSize(X_0:bat[:any_1]):lng
", "BKCgetVHeapSize;", "Calculate the vheap size for varsized bats"
]
[ "bat", "getorderidx", "pattern
bat.getorderidx(X_0:bat[:any_1]):bat[:oid] ", "OIDXgetorderidx;", "Return
the order index if it exists" ]
[ "bat", "hasorderidx", "pattern bat.hasorderidx(X_0:bat[:any_1]):bit
", "OIDXhasorderidx;", "Return true if order index exists" ]
[ "bat", "imprints", "command bat.imprints(X_0:bat[:bte]):void ",
"CMDBATimprints;", "" ]
diff --git a/clients/Tests/MAL-signatures.stable.out.int128
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -750,7 +750,7 @@
[ "bat", "getRole", "command bat.getRole(X_0:bat[:any_1]):str ",
"BKCgetRole;", "Returns the rolename of the head column of a BAT." ]
[ "bat", "getSequenceBase", "command
bat.getSequenceBase(X_0:bat[:any_1]):oid ", "BKCgetSequenceBase;", "Get the
sequence base for the void column of a BAT." ]
[ "bat", "getSize", "command bat.getSize(X_0:bat[:any_1]):lng ",
"BKCgetSize;", "Calculate the actual size of the BAT descriptor, heaps, hashes
and imprint indices in bytes\nrounded to the memory page size (see
bbp.getPageSize())." ]
-[ "bat", "getVHeapSize", "command bat.getVHeapSize(X_0:bat[:any_1]):lng
", "BKCgetVHeapSize;", "Calculate the vheap size for string bats"
]
+[ "bat", "getVHeapSize", "command bat.getVHeapSize(X_0:bat[:any_1]):lng
", "BKCgetVHeapSize;", "Calculate the vheap size for varsized bats"
]
[ "bat", "getorderidx", "pattern
bat.getorderidx(X_0:bat[:any_1]):bat[:oid] ", "OIDXgetorderidx;", "Return
the order index if it exists" ]
[ "bat", "hasorderidx", "pattern bat.hasorderidx(X_0:bat[:any_1]):bit
", "OIDXhasorderidx;", "Return true if order index exists" ]
[ "bat", "imprints", "command bat.imprints(X_0:bat[:bte]):void ",
"CMDBATimprints;", "" ]
diff --git a/monetdb5/modules/kernel/bat5.c b/monetdb5/modules/kernel/bat5.c
--- a/monetdb5/modules/kernel/bat5.c
+++ b/monetdb5/modules/kernel/bat5.c
@@ -618,9 +618,11 @@ BKCgetVHeapSize(lng *tot, const bat *bid
if ((b = BATdescriptor(*bid)) == NULL) {
throw(MAL, "bat.getVHeapSize", SQLSTATE(HY002)
RUNTIME_OBJECT_MISSING);
}
- int _tpe= ATOMstorage((b)->ttype);
- if (_tpe >= TYPE_str) {
- size += b->tvheap->size;
+ if (ATOMvarsized(b->ttype)) {
+ MT_lock_set(&b->theaplock);
+ if (b->tvheap)
+ size += b->tvheap->size;
+ MT_lock_unset(&b->theaplock);
}
*tot = size;
@@ -1251,7 +1253,7 @@ mel_func bat5_init_funcs[] = {
command("bat", "densebat", BKCdensebat, false, "Creates a new [void,void] BAT
of size 'sz'.", args(1,2, batarg("",oid),arg("sz",lng))),
command("bat", "info", BKCinfo, false, "Produce a table containing
information about a BAT in [attribute,value] format. \nIt contains all
properties of the BAT record. ", args(2,3,
batarg("",str),batarg("",str),batargany("b",1))),
command("bat", "getSize", BKCgetSize, false, "Calculate the actual size of
the BAT descriptor, heaps, hashes and imprint indices in bytes\nrounded to the
memory page size (see bbp.getPageSize()).", args(1,2,
arg("",lng),batargany("b",1))),
- command("bat", "getVHeapSize", BKCgetVHeapSize, false, "Calculate the vheap
size for string bats", args(1,2, arg("",lng),batargany("b",1))),
+ command("bat", "getVHeapSize", BKCgetVHeapSize, false, "Calculate the vheap
size for varsized bats", args(1,2, arg("",lng),batargany("b",1))),
command("bat", "getCapacity", BKCgetCapacity, false, "Returns the current
allocation size (in max number of elements) of a BAT.", args(1,2,
arg("",lng),batargany("b",1))),
command("bat", "getColumnType", BKCgetColumnType, false, "Returns the type of
the tail column of a BAT, as an integer type number.", args(1,2,
arg("",str),batargany("b",1))),
command("bat", "getRole", BKCgetRole, false, "Returns the rolename of the
head column of a BAT.", args(1,2, arg("",str),batargany("bid",1))),
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list