MonetDB: Jul2021 - Removed islocked assertions: they trigger for...
Changeset: cc4d477cc939 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/cc4d477cc939 Modified Files: gdk/gdk_bbp.c Branch: Jul2021 Log Message: Removed islocked assertions: they trigger for some reason on Windows 7. diffs (63 lines): diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -129,24 +129,11 @@ static bool havehge = false; #define BBPnamecheck(s) (BBPtmpcheck(s) ? strtol((s) + 4, NULL, 8) : 0) -#ifndef NDEBUG -static inline bool -islocked(MT_Lock *l) -{ - if (MT_lock_try(l)) { - MT_lock_unset(l); - return false; - } - return true; -} -#endif - static void BBP_insert(bat i) { bat idx = (bat) (strHash(BBP_logical(i)) & BBP_mask); - assert(islocked()); BBP_next(i) = BBP_hash[idx]; BBP_hash[idx] = i; } @@ -158,7 +145,6 @@ BBP_delete(bat i) const char *s = BBP_logical(i); bat idx = (bat) (strHash(s) & BBP_mask); - assert(islocked()); for (h += idx; (i = *h) != 0; h = _next(i)) { if (strcmp(BBP_logical(i), s) == 0) { *h = BBP_next(i); @@ -400,7 +386,6 @@ BBPextend(int idx, bool buildhash) static gdk_return recover_dir(int farmid, bool direxists) { - assert(islocked()); if (direxists) { /* just try; don't care about these non-vital files */ if (GDKunlink(farmid, BATDIR, "BBP", "bak") != GDK_SUCCEED) @@ -1410,10 +1395,6 @@ BBPdir_first(bool subcommit, lng logno, int n = 0; lng ologno, otransid; -#ifndef NDEBUG - assert(islocked()); -#endif - if (obbpfp) *obbpfp = NULL; *nbbpfp = NULL; @@ -2874,7 +2855,6 @@ BBPprepare(bool subcommit) str bakdirpath, subdirpath; gdk_return ret = GDK_SUCCEED; - assert(islocked()); if(!(bakdirpath = GDKfilepath(0, NULL, BAKDIR, NULL))) return GDK_FAIL; if(!(subdirpath = GDKfilepath(0, NULL, SUBDIR, NULL))) { ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: strheapvacuum - add mal test for str heap vacuum
Changeset: 4b8912db2afc for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/4b8912db2afc Added Files: sql/test/sysmon/Tests/test_vacuum.maltest Modified Files: sql/test/sysmon/Tests/All Branch: strheapvacuum Log Message: add mal test for str heap vacuum diffs (61 lines): diff --git a/sql/test/sysmon/Tests/All b/sql/test/sysmon/Tests/All --- a/sql/test/sysmon/Tests/All +++ b/sql/test/sysmon/Tests/All @@ -7,4 +7,5 @@ timeout_join timeout_aggr timeout_select stop +test_vacuum diff --git a/sql/test/sysmon/Tests/test_vacuum.maltest b/sql/test/sysmon/Tests/test_vacuum.maltest new file mode 100644 --- /dev/null +++ b/sql/test/sysmon/Tests/test_vacuum.maltest @@ -0,0 +1,47 @@ +statement ok +b:= bat.new(:str) + +statement ok +bat.append(b, "hello") + +statement ok +bat.append(b, "world") + +statement ok +k:= 1@0 + +statement ok +bat_size_small:= bat.getVHeapSize(b) + +statement ok +barrier i:= 0; +u:= uuid.new(); +s:str:= uuid.str(u); +bat.replace(b, k, s); + redo i:= iterator.next(1,100); +exit i; + +statement ok +bat_size_next:= bat.getVHeapSize(b) + +statement ok +x_1:= calc.cmp(bat_size_next, bat_size_small) + +query T rowsort +io.print(x_1) + +1 + +statement ok +bn:= bat.vacuum(b) + +statement ok +bat_size_vacuumed:= bat.getVHeapSize(bn) + +statement ok +x_1:= calc.cmp(bat_size_next, bat_size_vacuumed) + +query T rowsort +io.print(x_1) + +1 ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: strheapvacuum - add mal for getVHeapSize of a string bat
Changeset: 6e0a3edf924a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/6e0a3edf924a Modified Files: monetdb5/modules/kernel/bat5.c Branch: strheapvacuum Log Message: add mal for getVHeapSize of a string bat diffs (35 lines): 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 @@ -590,6 +590,23 @@ BKCgetSize(lng *tot, const bat *bid){ return MAL_SUCCEED; } +static str +BKCgetVHeapSize(lng *tot, const bat *bid){ + BAT *b; + lng size = 0; + 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; + } + + *tot = size; + BBPunfix(*bid); + return MAL_SUCCEED; +} + /* * Synced BATs */ @@ -1207,6 +1224,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", "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 checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: strheapvacuum - merge jul2021
Changeset: b25e1b621d3a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/b25e1b621d3a Modified Files: clients/Tests/MAL-signatures.stable.out clients/Tests/MAL-signatures.stable.out.int128 clients/Tests/exports.stable.out gdk/gdk.h gdk/gdk_aggr.c gdk/gdk_bat.c gdk/gdk_batop.c gdk/gdk_bbp.c gdk/gdk_group.c gdk/gdk_heap.c gdk/gdk_join.c gdk/gdk_select.c gdk/gdk_string.c sql/backends/monet5/sql.c sql/backends/monet5/sql.h sql/storage/bat/bat_logger.c sql/storage/bat/bat_storage.c sql/storage/sql_storage.h tools/monetdbe/monetdbe.c Branch: strheapvacuum Log Message: merge jul2021 diffs (truncated from 2253 to 300 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 @@ -9209,7 +9209,7 @@ stdout of test 'MAL-signatures` in direc [ "sql", "analyze", "unsafe pattern sql.analyze(X_0:int, X_1:lng, X_2:str, X_3:str):void ", "sql_analyze;", "" ] [ "sql", "analyze", "unsafe pattern sql.analyze(X_0:int, X_1:lng, X_2:str, X_3:str, X_4:str):void ","sql_analyze;", "" ] [ "sql", "any", "pattern sql.any(X_0:bit, X_1:bit, X_2:bit):bit ", "SQLany_cmp;", "" ] -[ "sql", "append", "pattern sql.append(X_0:int, X_1:str, X_2:str, X_3:str, X_4:bat[:oid], X_5:any):int ", "mvc_append_wrap;", "" ] +[ "sql", "append", "pattern sql.append(X_0:int, X_1:str, X_2:str, X_3:str, X_4:oid, X_5:bat[:oid], X_6:any):int ", "mvc_append_wrap;", "" ] [ "sql", "argRecord","pattern sql.argRecord():str ", "SQLargRecord;","" ] [ "sql", "argRecord","pattern sql.argRecord(X_0:any...):str ", "SQLargRecord;","" ] [ "sql", "assert", "pattern sql.assert(X_0:bit, X_1:str):void ", "SQLassert;", "" ] @@ -9233,7 +9233,7 @@ stdout of test 'MAL-signatures` in direc [ "sql", "bind_idxbat", "pattern sql.bind_idxbat(X_0:int, X_1:str, X_2:str, X_3:str, X_4:int):bat[:any_1] ","mvc_bind_idxbat_wrap;","" ] [ "sql", "bind_idxbat", "pattern sql.bind_idxbat(X_0:int, X_1:str, X_2:str, X_3:str, X_4:int, X_5:int, X_6:int) (X_7:bat[:oid], X_8:bat[:any_1]) ", "mvc_bind_idxbat_wrap;","" ] [ "sql", "bind_idxbat", "pattern sql.bind_idxbat(X_0:int, X_1:str, X_2:str, X_3:str, X_4:int, X_5:int, X_6:int):bat[:any_1] ", "mvc_bind_idxbat_wrap;","" ] -[ "sql", "claim","unsafe pattern sql.claim(X_0:int, X_1:str, X_2:str, X_3:lng):bat[:oid] ", "mvc_claim_wrap;", "" ] +[ "sql", "claim","unsafe pattern sql.claim(X_0:int, X_1:str, X_2:str, X_3:lng) (X_4:oid, X_5:bat[:oid]) ", "mvc_claim_wrap;", "" ] [ "sql", "clear_table", "unsafe pattern sql.clear_table(X_0:str, X_1:str):lng ","mvc_clear_table_wrap;","" ] [ "sql", "commit", "unsafe pattern sql.commit():void ", "SQLcommit;", "" ] [ "sql", "copy_from","unsafe pattern sql.copy_from(X_0:ptr, X_1:str, X_2:str, X_3:str, X_4:str, X_5:str, X_6:lng, X_7:lng, X_8:int, X_9:str, X_10:int, X_11:int):bat[:any]... ", "mvc_import_table_wrap;", "" ] @@ -9686,7 +9686,7 @@ stdout of test 'MAL-signatures` in direc [ "wlr", "alter_set_table", "pattern wlr.alter_set_table(X_0:str, X_1:str, X_2:int):void ", "WLRgeneric;", "" ] [ "wlr", "alter_table", "pattern wlr.alter_table(X_0:str, X_1:str, X_2:int):void ", "WLRgeneric;", "" ] [ "wlr", "alter_user", "pattern wlr.alter_user(X_0:str, X_1:str, X_2:int, X_3:str, X_4:str):void ","WLRgeneric;", "" ] -[ "wlr", "append", "pattern wlr.append(X_0:str, X_1:str, X_2:str, X_3:any...):int ", "WLRappend;", "" ] +[ "wlr", "append", "pattern wlr.append(X_0:str, X_1:str, X_2:str, X_3:oid, X_4:bat[:oid], X_5:any...):int ", "WLRappend;", "" ] [ "wlr", "catalog", "pattern wlr.catalog(X_0:str):void ", "WLRcatalog;", "" ] [ "wlr", "clear_table", "pattern wlr.clear_table(X_0:str, X_1:str):int ", "WLRclear_table;", "" ] [ "wlr", "comment_on", "pattern wlr.comment_on(X_0:int, X_1:str):void ", "WLRgeneric;", "" ] 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 @@ -12510,7 +12510,7 @@ stdout of test 'MAL-signatures` in direc [ "sql", "analyze", "unsafe pattern sql.analyze(X_0:int, X_1:lng, X_2:str, X_3:str):void ", "sql_analyze;", "" ] [ "sql", "analyze", "unsafe
MonetDB: strheapvacuum - merge default
Changeset: 2c7f3ffefd38 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/2c7f3ffefd38 Modified Files: gdk/gdk.h gdk/gdk_bat.c sql/backends/monet5/sql.c sql/storage/bat/bat_storage.c Branch: strheapvacuum Log Message: merge default diffs (truncated from 30948 to 300 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 @@ -5753,6 +5753,7 @@ stdout of test 'MAL-signatures` in direc [ "batcalc", "uuid", "command batcalc.uuid(X_0:bat[:str], X_1:bat[:oid]):bat[:uuid] ", "UUIDstr2uuid_bulk;", "" ] [ "batcalc", "uuid", "command batcalc.uuid(X_0:bat[:uuid], X_1:bat[:oid]):bat[:uuid] ", "UUIDuuid2uuid_bulk;", "" ] [ "batcalc", "wkb", "command batcalc.wkb(X_0:bat[:wkb], X_1:bat[:oid], X_2:int, X_3:int):bat[:wkb] ", "geom_2_geom_bat;", "" ] +[ "batcalc", "wkb", "command batcalc.wkb(X_0:bat[:str], X_1:bat[:oid], X_2:int, X_3:int):bat[:wkb] ", "wkbFromText_bat_cand;","" ] [ "batcalc", "xml", "command batcalc.xml(X_0:bat[:str]):bat[:xml] ", "BATXMLstr2xml;", "" ] [ "batcalc", "xor", "pattern batcalc.xor(X_0:bat[:bit], X_1:bat[:bit]):bat[:bit] ", "CMDbatXOR;", "" ] [ "batcalc", "xor", "pattern batcalc.xor(X_0:bat[:bit], X_1:bat[:bit], X_2:bat[:oid], X_3:bat[:oid]):bat[:bit] ", "CMDbatXOR;", "" ] 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 @@ -8277,6 +8277,7 @@ stdout of test 'MAL-signatures` in direc [ "batcalc", "uuid", "command batcalc.uuid(X_0:bat[:str], X_1:bat[:oid]):bat[:uuid] ", "UUIDstr2uuid_bulk;", "" ] [ "batcalc", "uuid", "command batcalc.uuid(X_0:bat[:uuid], X_1:bat[:oid]):bat[:uuid] ", "UUIDuuid2uuid_bulk;", "" ] [ "batcalc", "wkb", "command batcalc.wkb(X_0:bat[:wkb], X_1:bat[:oid], X_2:int, X_3:int):bat[:wkb] ", "geom_2_geom_bat;", "" ] +[ "batcalc", "wkb", "command batcalc.wkb(X_0:bat[:str], X_1:bat[:oid], X_2:int, X_3:int):bat[:wkb] ", "wkbFromText_bat_cand;","" ] [ "batcalc", "xml", "command batcalc.xml(X_0:bat[:str]):bat[:xml] ", "BATXMLstr2xml;", "" ] [ "batcalc", "xor", "pattern batcalc.xor(X_0:bat[:bit], X_1:bat[:bit]):bat[:bit] ", "CMDbatXOR;", "" ] [ "batcalc", "xor", "pattern batcalc.xor(X_0:bat[:bit], X_1:bat[:bit], X_2:bat[:oid], X_3:bat[:oid]):bat[:bit] ", "CMDbatXOR;", "" ] diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -187,7 +187,7 @@ BAT *BATsample_with_seed(BAT *b, BUN n, gdk_return BATsave(BAT *b) __attribute__((__warn_unused_result__)); BAT *BATselect(BAT *b, BAT *s, const void *tl, const void *th, bool li, bool hi, bool anti); gdk_return BATsemijoin(BAT **r1p, BAT **r2p, BAT *l, BAT *r, BAT *sl, BAT *sr, bool nil_matches, bool max_one, BUN estimate) __attribute__((__warn_unused_result__)); -gdk_return BATsetaccess(BAT *b, restrict_t mode); +BAT *BATsetaccess(BAT *b, restrict_t mode) __attribute__((__warn_unused_result__)); void BATsetcapacity(BAT *b, BUN cnt); void BATsetcount(BAT *b, BUN cnt); BAT *BATslice(BAT *b, BUN low, BUN high); diff --git a/common/stream/stdio_stream.c b/common/stream/stdio_stream.c --- a/common/stream/stdio_stream.c +++ b/common/stream/stdio_stream.c @@ -31,9 +31,8 @@ file_read(stream *restrict s, void *rest return -1; } - if (elmsize && cnt && !feof(fp)) { - if (ferror(fp) || - ((rc = fread(buf, elmsize, cnt, fp)) == 0 && ferror(fp))) { + if (elmsize && cnt) { + if ((rc = fread(buf, elmsize, cnt, fp)) == 0 && ferror(fp)) { mnstr_set_error_errno(s, MNSTR_READ_ERROR, "read error"); return -1; } @@ -55,7 +54,7 @@ file_write(stream *restrict s, const voi if (elmsize && cnt) { size_t rc = fwrite(buf, elmsize, cnt, fp); - if (ferror(fp)) { + if (!rc && ferror(fp)) { mnstr_set_error_errno(s, MNSTR_WRITE_ERROR, "write error"); return -1; } diff --git a/common/utils/mcrypt.c b/common/utils/mcrypt.c --- a/common/utils/mcrypt.c +++ b/common/utils/mcrypt.c @@ -505,6 +505,8 @@ mcrypt_hashPassword( } else #endif { + (void) len; + (void) ret; (void) algo; (void) password; (void) challenge; diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -331,6 +331,8 @@ #include /* for
MonetDB: iso - Don't enforce DML conflicts on non-partitioned me...
Changeset: 36cfd271b55b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/36cfd271b55b Modified Files: sql/storage/store.c sql/test/miscellaneous/Tests/transaction_isolation4.SQL.py Branch: iso Log Message: Don't enforce DML conflicts on non-partitioned merge table children diffs (130 lines): diff --git a/sql/storage/store.c b/sql/storage/store.c --- a/sql/storage/store.c +++ b/sql/storage/store.c @@ -4937,7 +4937,7 @@ sql_trans_drop_schema(sql_trans *tr, sql } static int -sql_trans_propagate_dependencies_parents(sql_trans *tr, sql_table *mt) +sql_trans_propagate_dependencies_parents(sql_trans *tr, sql_table *mt, bool *child_of_partitioned) { int res = LOG_OK; sql_part *pt = NULL; @@ -4945,13 +4945,15 @@ sql_trans_propagate_dependencies_parents for (; mt; mt = pt?pt->t:NULL) { if (!isNew(mt) && (res = sql_trans_add_dependency(tr, mt->base.id, ddl))) /* protect from another transaction changing the table's schema */ return res; + if (child_of_partitioned) + *child_of_partitioned |= (isRangePartitionTable(mt) || isListPartitionTable(mt)); pt = partition_find_part(tr, mt, NULL); } return res; } static int -sql_trans_propagate_dependencies_children(sql_trans *tr, sql_table *pt) +sql_trans_propagate_dependencies_children(sql_trans *tr, sql_table *pt, bool child_of_partitioned) { int res = LOG_OK; @@ -4960,7 +4962,7 @@ sql_trans_propagate_dependencies_childre return res; if ((res = sql_trans_add_dependency_change(tr, pt->base.id, ddl))) /* protect from being added twice */ return res; - if (isTable(pt) && (res = sql_trans_add_dependency(tr, pt->base.id, dml))) /* disallow concurrent updates on pt */ + if (child_of_partitioned && isTable(pt) && (res = sql_trans_add_dependency(tr, pt->base.id, dml))) /* disallow concurrent updates on pt */ return res; } if (isMergeTable(pt) && !list_empty(pt->members)) { @@ -4968,7 +4970,8 @@ sql_trans_propagate_dependencies_childre sql_part *pd = nt->data; sql_table *t = find_sql_table_id(tr, pt->s, pd->member); - if ((res = sql_trans_propagate_dependencies_children(tr, t))) + child_of_partitioned |= (isRangePartitionTable(t) || isListPartitionTable(t)); + if ((res = sql_trans_propagate_dependencies_children(tr, t, child_of_partitioned))) return res; } } @@ -4983,6 +4986,7 @@ sql_trans_add_table(sql_trans *tr, sql_t sql_table *sysobj = find_sql_table(tr, syss, "objects"); int res = 0; sql_table *dup = NULL; + bool child_of_partitioned = false; /* merge table depends on part table */ if ((res = sql_trans_create_dependency(tr, pt->base.id, mt->base.id, TABLE_DEPENDENCY))) @@ -5004,9 +5008,9 @@ sql_trans_add_table(sql_trans *tr, sql_t return res; if ((res = os_add(mt->s->parts, tr, p->base.name, dup_base(>base return res; - if ((res = sql_trans_propagate_dependencies_parents(tr, mt))) + if ((res = sql_trans_propagate_dependencies_parents(tr, mt, _of_partitioned))) return res; - if ((res = sql_trans_propagate_dependencies_children(tr, pt))) + if ((res = sql_trans_propagate_dependencies_children(tr, pt, child_of_partitioned))) return res; return res; } @@ -5140,9 +5144,9 @@ sql_trans_add_range_partition(sql_trans if (!update) res = os_add(mt->s->parts, tr, p->base.name, dup_base(>base)); - if ((res = sql_trans_propagate_dependencies_parents(tr, mt))) + if ((res = sql_trans_propagate_dependencies_parents(tr, mt, NULL))) return res; - if ((res = sql_trans_propagate_dependencies_children(tr, pt))) + if ((res = sql_trans_propagate_dependencies_children(tr, pt, true))) return res; finish: VALclear(); @@ -5268,9 +5272,9 @@ sql_trans_add_value_partition(sql_trans if ((res = os_add(mt->s->parts, tr, p->base.name, dup_base(>base return res; } - if ((res = sql_trans_propagate_dependencies_parents(tr, mt))) + if ((res = sql_trans_propagate_dependencies_parents(tr, mt, NULL))) return res; - if ((res = sql_trans_propagate_dependencies_children(tr, pt))) + if ((res = sql_trans_propagate_dependencies_children(tr, pt, true))) return res; return 0; } diff --git a/sql/test/miscellaneous/Tests/transaction_isolation4.SQL.py b/sql/test/miscellaneous/Tests/transaction_isolation4.SQL.py --- a/sql/test/miscellaneous/Tests/transaction_isolation4.SQL.py +++
MonetDB: iso - Merged with Jul2021
Changeset: cda454f52d8f for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/cda454f52d8f Modified Files: monetdb5/modules/mal/remote.c sql/server/sql_partition.c Branch: iso Log Message: Merged with Jul2021 diffs (truncated from 545 to 300 lines): diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -560,7 +560,8 @@ typedef struct { bool hashash:1, /* the string heap contains hash values */ cleanhash:1,/* string heaps must clean hash */ dirty:1,/* specific heap dirty marker */ - remove:1; /* remove storage file when freeing */ + remove:1, /* remove storage file when freeing */ + wasempty:1; /* heap was empty when last saved/created */ storage_t storage; /* storage mode (mmap/malloc). */ storage_t newstorage; /* new desired storage mode at re-allocation. */ bat parentid; /* cache id of VIEW parent bat */ diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -760,45 +760,47 @@ BBPcheckbats(unsigned bbpversion) /* no files needed */ continue; } - path = GDKfilepath(0, BATDIR, b->theap->filename, NULL); - if (path == NULL) - return GDK_FAIL; + if (b->theap->free > 0) { + path = GDKfilepath(0, BATDIR, b->theap->filename, NULL); + if (path == NULL) + return GDK_FAIL; #ifdef GDKLIBRARY_TAILN - /* if bbpversion > GDKLIBRARY_TAILN, the offset heap can -* exist with either name .tail1 (etc) or .tail, if <= -* GDKLIBRARY_TAILN, only with .tail */ - char tailsave = 0; - size_t taillen = 0; - if (b->ttype == TYPE_str && - b->twidth < SIZEOF_VAR_T) { - /* old version: .tail, not .tail1, .tail2, .tail4 */ - taillen = strlen(path) - 1; - tailsave = path[taillen]; - path[taillen] = 0; - } + /* if bbpversion > GDKLIBRARY_TAILN, the offset heap can +* exist with either name .tail1 (etc) or .tail, if <= +* GDKLIBRARY_TAILN, only with .tail */ + char tailsave = 0; + size_t taillen = 0; + if (b->ttype == TYPE_str && + b->twidth < SIZEOF_VAR_T) { + /* old version: .tail, not .tail1, .tail2, .tail4 */ + taillen = strlen(path) - 1; + tailsave = path[taillen]; + path[taillen] = 0; + } #endif - if (MT_stat(path, ) < 0 + if (MT_stat(path, ) < 0 #ifdef GDKLIBRARY_TAILN - && bbpversion > GDKLIBRARY_TAILN - && b->ttype == TYPE_str - && b->twidth < SIZEOF_VAR_T - && (path[taillen] = tailsave) != 0 - && MT_stat(path, ) < 0 + && bbpversion > GDKLIBRARY_TAILN + && b->ttype == TYPE_str + && b->twidth < SIZEOF_VAR_T + && (path[taillen] = tailsave) != 0 + && MT_stat(path, ) < 0 #endif - ) { - - GDKsyserror("cannot stat file %s (expected size %zu)\n", - path, b->theap->free); + ) { + + GDKsyserror("cannot stat file %s (expected size %zu)\n", + path, b->theap->free); + GDKfree(path); + return GDK_FAIL; + } + if ((size_t) statb.st_size < b->theap->free) { + GDKerror("file %s too small (expected %zu, actual %zu)\n", path, b->theap->free, (size_t) statb.st_size); + GDKfree(path); + return GDK_FAIL; + } GDKfree(path); - return GDK_FAIL; } - if ((size_t) statb.st_size < b->theap->free) { - GDKerror("file %s too small (expected %zu, actual %zu)\n", path, b->theap->free, (size_t) statb.st_size); - GDKfree(path); - return GDK_FAIL; - } - GDKfree(path); - if (b->tvheap != NULL) { + if (b->tvheap != NULL && b->tvheap->free > 0) { path = GDKfilepath(0, BATDIR,
MonetDB: iso - Look for nested merge tables
Changeset: 4246a959b00b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/4246a959b00b Modified Files: sql/storage/store.c sql/test/miscellaneous/Tests/transaction_isolation4.SQL.py Branch: iso Log Message: Look for nested merge tables diffs (142 lines): diff --git a/sql/storage/store.c b/sql/storage/store.c --- a/sql/storage/store.c +++ b/sql/storage/store.c @@ -4936,6 +4936,45 @@ sql_trans_drop_schema(sql_trans *tr, sql return 0; } +static int +sql_trans_propagate_dependencies_parents(sql_trans *tr, sql_table *mt) +{ + int res = LOG_OK; + sql_part *pt = NULL; + + for (; mt; mt = pt?pt->t:NULL) { + if (!isNew(mt) && (res = sql_trans_add_dependency(tr, mt->base.id, ddl))) /* protect from another transaction changing the table's schema */ + return res; + pt = partition_find_part(tr, mt, NULL); + } + return res; +} + +static int +sql_trans_propagate_dependencies_children(sql_trans *tr, sql_table *pt) +{ + int res = LOG_OK; + + if (!isNew(pt)) { + if ((res = sql_trans_add_dependency(tr, pt->base.id, ddl))) /* protect from another transaction changing the table's schema */ + return res; + if ((res = sql_trans_add_dependency_change(tr, pt->base.id, ddl))) /* protect from being added twice */ + return res; + if (isTable(pt) && (res = sql_trans_add_dependency(tr, pt->base.id, dml))) /* disallow concurrent updates on pt */ + return res; + } + if (isMergeTable(pt) && !list_empty(pt->members)) { + for (node *nt = pt->members->h; nt; nt = nt->next) { + sql_part *pd = nt->data; + sql_table *t = find_sql_table_id(tr, pt->s, pd->member); + + if ((res = sql_trans_propagate_dependencies_children(tr, t))) + return res; + } + } + return res; +} + int sql_trans_add_table(sql_trans *tr, sql_table *mt, sql_table *pt) { @@ -4965,11 +5004,9 @@ sql_trans_add_table(sql_trans *tr, sql_t return res; if ((res = os_add(mt->s->parts, tr, p->base.name, dup_base(>base return res; - if (!isNew(pt) && (res = sql_trans_add_dependency(tr, pt->base.id, ddl))) /* protect from another transaction changing the table's schema */ + if ((res = sql_trans_propagate_dependencies_parents(tr, mt))) return res; - if (!isNew(mt) && (res = sql_trans_add_dependency(tr, mt->base.id, ddl))) /* protect from another transaction changing the table's schema */ - return res; - if (!isNew(pt) && (res = sql_trans_add_dependency_change(tr, pt->base.id, ddl))) /* protect from being added twice */ + if ((res = sql_trans_propagate_dependencies_children(tr, pt))) return res; return res; } @@ -5103,13 +5140,9 @@ sql_trans_add_range_partition(sql_trans if (!update) res = os_add(mt->s->parts, tr, p->base.name, dup_base(>base)); - if (!isNew(pt) && (res = sql_trans_add_dependency(tr, pt->base.id, ddl))) /* protect from another transaction changing the table's schema */ - return res; - if (!isNew(mt) && (res = sql_trans_add_dependency(tr, mt->base.id, ddl))) /* protect from another transaction changing the table's schema */ + if ((res = sql_trans_propagate_dependencies_parents(tr, mt))) return res; - if (!isNew(pt) && (res = sql_trans_add_dependency_change(tr, pt->base.id, ddl))) /* protect from being added twice */ - return res; - if (!isNew(pt) && (res = sql_trans_add_dependency(tr, pt->base.id, dml))) /* disallow concurrent updates on pt */ + if ((res = sql_trans_propagate_dependencies_children(tr, pt))) return res; finish: VALclear(); @@ -5235,13 +5268,9 @@ sql_trans_add_value_partition(sql_trans if ((res = os_add(mt->s->parts, tr, p->base.name, dup_base(>base return res; } - if (!isNew(pt) && (res = sql_trans_add_dependency(tr, pt->base.id, ddl))) /* protect from another transaction changing the table's schema */ - return res; - if (!isNew(mt) && (res = sql_trans_add_dependency(tr, mt->base.id, ddl))) /* protect from another transaction changing the table's schema */ + if ((res = sql_trans_propagate_dependencies_parents(tr, mt))) return res; - if (!isNew(pt) && (res = sql_trans_add_dependency_change(tr, pt->base.id, ddl))) /* protect from being added twice */ - return res; - if (!isNew(pt) && (res = sql_trans_add_dependency(tr, pt->base.id, dml))) /* disallow concurrent updates on pt */ + if ((res = sql_trans_propagate_dependencies_children(tr, pt))) return res;
MonetDB: Jul2021 - Fixed parent table iteration
Changeset: 7085d7466460 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/7085d7466460 Modified Files: sql/server/sql_partition.c Branch: Jul2021 Log Message: Fixed parent table iteration diffs (22 lines): diff --git a/sql/server/sql_partition.c b/sql/server/sql_partition.c --- a/sql/server/sql_partition.c +++ b/sql/server/sql_partition.c @@ -25,11 +25,14 @@ partition_find_mergetables(mvc *sql, sql { sql_trans *tr = sql->session->tr; list *res = NULL; + sql_part *pt = NULL; - for(sql_part *pt = partition_find_part(tr, t, NULL); pt; pt = partition_find_part(tr, t, pt)) { - if (!res) - res = sa_list(sql->sa); - list_append(res, pt); + for (; t; t = pt?pt->t:NULL) { + if ((pt=partition_find_part(tr, t, NULL))) { + if (!res) + res = sa_list(sql->sa); + list_append(res, pt); + } } return res; } ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Merge with Jul2021 branch.
Changeset: 5e37d4f15c48 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/5e37d4f15c48 Modified Files: clients/Tests/MAL-signatures.stable.out clients/Tests/MAL-signatures.stable.out.int128 clients/Tests/exports.stable.out gdk/gdk.h gdk/gdk_aggr.c gdk/gdk_bat.c gdk/gdk_batop.c gdk/gdk_bbp.c gdk/gdk_group.c gdk/gdk_heap.c gdk/gdk_join.c gdk/gdk_select.c gdk/gdk_string.c monetdb5/mal/mal_profiler.c monetdb5/mal/mal_runtime.c sql/backends/monet5/sql.c sql/storage/bat/bat_logger.c tools/monetdbe/monetdbe.c Branch: default Log Message: Merge with Jul2021 branch. diffs (truncated from 2693 to 300 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 @@ -9209,7 +9209,7 @@ stdout of test 'MAL-signatures` in direc [ "sql", "analyze", "unsafe pattern sql.analyze(X_0:int, X_1:lng, X_2:str, X_3:str):void ", "sql_analyze;", "" ] [ "sql", "analyze", "unsafe pattern sql.analyze(X_0:int, X_1:lng, X_2:str, X_3:str, X_4:str):void ","sql_analyze;", "" ] [ "sql", "any", "pattern sql.any(X_0:bit, X_1:bit, X_2:bit):bit ", "SQLany_cmp;", "" ] -[ "sql", "append", "pattern sql.append(X_0:int, X_1:str, X_2:str, X_3:str, X_4:bat[:oid], X_5:any):int ", "mvc_append_wrap;", "" ] +[ "sql", "append", "pattern sql.append(X_0:int, X_1:str, X_2:str, X_3:str, X_4:oid, X_5:bat[:oid], X_6:any):int ", "mvc_append_wrap;", "" ] [ "sql", "argRecord","pattern sql.argRecord():str ", "SQLargRecord;","" ] [ "sql", "argRecord","pattern sql.argRecord(X_0:any...):str ", "SQLargRecord;","" ] [ "sql", "assert", "pattern sql.assert(X_0:bit, X_1:str):void ", "SQLassert;", "" ] @@ -9233,7 +9233,7 @@ stdout of test 'MAL-signatures` in direc [ "sql", "bind_idxbat", "pattern sql.bind_idxbat(X_0:int, X_1:str, X_2:str, X_3:str, X_4:int):bat[:any_1] ","mvc_bind_idxbat_wrap;","" ] [ "sql", "bind_idxbat", "pattern sql.bind_idxbat(X_0:int, X_1:str, X_2:str, X_3:str, X_4:int, X_5:int, X_6:int) (X_7:bat[:oid], X_8:bat[:any_1]) ", "mvc_bind_idxbat_wrap;","" ] [ "sql", "bind_idxbat", "pattern sql.bind_idxbat(X_0:int, X_1:str, X_2:str, X_3:str, X_4:int, X_5:int, X_6:int):bat[:any_1] ", "mvc_bind_idxbat_wrap;","" ] -[ "sql", "claim","unsafe pattern sql.claim(X_0:int, X_1:str, X_2:str, X_3:lng):bat[:oid] ", "mvc_claim_wrap;", "" ] +[ "sql", "claim","unsafe pattern sql.claim(X_0:int, X_1:str, X_2:str, X_3:lng) (X_4:oid, X_5:bat[:oid]) ", "mvc_claim_wrap;", "" ] [ "sql", "clear_table", "unsafe pattern sql.clear_table(X_0:str, X_1:str):lng ","mvc_clear_table_wrap;","" ] [ "sql", "commit", "unsafe pattern sql.commit():void ", "SQLcommit;", "" ] [ "sql", "copy_from","unsafe pattern sql.copy_from(X_0:ptr, X_1:str, X_2:str, X_3:str, X_4:str, X_5:str, X_6:lng, X_7:lng, X_8:int, X_9:str, X_10:int, X_11:int):bat[:any]... ", "mvc_import_table_wrap;", "" ] @@ -9686,7 +9686,7 @@ stdout of test 'MAL-signatures` in direc [ "wlr", "alter_set_table", "pattern wlr.alter_set_table(X_0:str, X_1:str, X_2:int):void ", "WLRgeneric;", "" ] [ "wlr", "alter_table", "pattern wlr.alter_table(X_0:str, X_1:str, X_2:int):void ", "WLRgeneric;", "" ] [ "wlr", "alter_user", "pattern wlr.alter_user(X_0:str, X_1:str, X_2:int, X_3:str, X_4:str):void ","WLRgeneric;", "" ] -[ "wlr", "append", "pattern wlr.append(X_0:str, X_1:str, X_2:str, X_3:any...):int ", "WLRappend;", "" ] +[ "wlr", "append", "pattern wlr.append(X_0:str, X_1:str, X_2:str, X_3:oid, X_4:bat[:oid], X_5:any...):int ", "WLRappend;", "" ] [ "wlr", "catalog", "pattern wlr.catalog(X_0:str):void ", "WLRcatalog;", "" ] [ "wlr", "clear_table", "pattern wlr.clear_table(X_0:str, X_1:str):int ", "WLRclear_table;", "" ] [ "wlr", "comment_on", "pattern wlr.comment_on(X_0:int, X_1:str):void ", "WLRgeneric;", "" ] 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 @@ -12510,7 +12510,7 @@ stdout of test 'MAL-signatures` in direc [ "sql", "analyze", "unsafe pattern sql.analyze(X_0:int, X_1:lng, X_2:str, X_3:str):void ", "sql_analyze;", "" ] [ "sql", "analyze", "unsafe pattern sql.analyze(X_0:int,
MonetDB: Jul2021 - Don't save empty heap files.
Changeset: 9f9a288a6902 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/9f9a288a6902 Modified Files: gdk/gdk.h gdk/gdk_bbp.c gdk/gdk_heap.c gdk/gdk_storage.c sql/storage/bat/bat_logger.c Branch: Jul2021 Log Message: Don't save empty heap files. diffs (270 lines): diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -560,7 +560,8 @@ typedef struct { bool hashash:1, /* the string heap contains hash values */ cleanhash:1,/* string heaps must clean hash */ dirty:1,/* specific heap dirty marker */ - remove:1; /* remove storage file when freeing */ + remove:1, /* remove storage file when freeing */ + wasempty:1; /* heap was empty when last saved/created */ storage_t storage; /* storage mode (mmap/malloc). */ storage_t newstorage; /* new desired storage mode at re-allocation. */ bat parentid; /* cache id of VIEW parent bat */ diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -760,45 +760,47 @@ BBPcheckbats(unsigned bbpversion) /* no files needed */ continue; } - path = GDKfilepath(0, BATDIR, b->theap->filename, NULL); - if (path == NULL) - return GDK_FAIL; + if (b->theap->free > 0) { + path = GDKfilepath(0, BATDIR, b->theap->filename, NULL); + if (path == NULL) + return GDK_FAIL; #ifdef GDKLIBRARY_TAILN - /* if bbpversion > GDKLIBRARY_TAILN, the offset heap can -* exist with either name .tail1 (etc) or .tail, if <= -* GDKLIBRARY_TAILN, only with .tail */ - char tailsave = 0; - size_t taillen = 0; - if (b->ttype == TYPE_str && - b->twidth < SIZEOF_VAR_T) { - /* old version: .tail, not .tail1, .tail2, .tail4 */ - taillen = strlen(path) - 1; - tailsave = path[taillen]; - path[taillen] = 0; - } + /* if bbpversion > GDKLIBRARY_TAILN, the offset heap can +* exist with either name .tail1 (etc) or .tail, if <= +* GDKLIBRARY_TAILN, only with .tail */ + char tailsave = 0; + size_t taillen = 0; + if (b->ttype == TYPE_str && + b->twidth < SIZEOF_VAR_T) { + /* old version: .tail, not .tail1, .tail2, .tail4 */ + taillen = strlen(path) - 1; + tailsave = path[taillen]; + path[taillen] = 0; + } #endif - if (MT_stat(path, ) < 0 + if (MT_stat(path, ) < 0 #ifdef GDKLIBRARY_TAILN - && bbpversion > GDKLIBRARY_TAILN - && b->ttype == TYPE_str - && b->twidth < SIZEOF_VAR_T - && (path[taillen] = tailsave) != 0 - && MT_stat(path, ) < 0 + && bbpversion > GDKLIBRARY_TAILN + && b->ttype == TYPE_str + && b->twidth < SIZEOF_VAR_T + && (path[taillen] = tailsave) != 0 + && MT_stat(path, ) < 0 #endif - ) { - - GDKsyserror("cannot stat file %s (expected size %zu)\n", - path, b->theap->free); + ) { + + GDKsyserror("cannot stat file %s (expected size %zu)\n", + path, b->theap->free); + GDKfree(path); + return GDK_FAIL; + } + if ((size_t) statb.st_size < b->theap->free) { + GDKerror("file %s too small (expected %zu, actual %zu)\n", path, b->theap->free, (size_t) statb.st_size); + GDKfree(path); + return GDK_FAIL; + } GDKfree(path); - return GDK_FAIL; } - if ((size_t) statb.st_size < b->theap->free) { - GDKerror("file %s too small (expected %zu, actual %zu)\n", path, b->theap->free, (size_t) statb.st_size); - GDKfree(path); - return GDK_FAIL; - } - GDKfree(path); - if (b->tvheap != NULL) { + if (b->tvheap != NULL && b->tvheap->free > 0) {
MonetDB: Jul2021 - Use BBP_cache for parent bats and don't load ...
Changeset: d32213caa34f for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/d32213caa34f Modified Files: gdk/gdk_logger.c gdk/gdk_select.c gdk/gdk_tm.c monetdb5/mal/mal_debugger.c monetdb5/mal/mal_listing.c monetdb5/mal/mal_profiler.c monetdb5/mal/mal_runtime.c monetdb5/modules/mal/remote.c Branch: Jul2021 Log Message: Use BBP_cache for parent bats and don't load complex atoms if we don't need to. diffs (132 lines): diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c --- a/gdk/gdk_logger.c +++ b/gdk/gdk_logger.c @@ -1408,7 +1408,7 @@ bm_get_counts(logger *lg) lng lid = lng_nil; if (BUNfnd(lg->dcatalog, ) == BUN_NONE) { - BAT *b = BBPquickdesc(bids[p], 1); + BAT *b = BBPquickdesc(bids[p], true); cnt = BATcount(b); } else { deleted++; diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c --- a/gdk/gdk_select.c +++ b/gdk/gdk_select.c @@ -1521,7 +1521,7 @@ BATselect(BAT *b, BAT *s, const void *tl * hash chain (count divided by #slots) times the cost * to do a binary search on the candidate list (or 1 * if no need for search)) */ - tmp = BBPquickdesc(parent, false); + tmp = BBP_cache(parent); if (tmp && BATcheckhash(tmp)) { MT_rwlock_rdlock(>thashlock); hash = phash = tmp->thash != NULL && @@ -1560,7 +1560,7 @@ BATselect(BAT *b, BAT *s, const void *tl (BATcheckorderidx(b) || (/* DISABLES CODE */ (0) && VIEWtparent(b) && - BATcheckorderidx(BBPquickdesc(VIEWtparent(b), false) { + BATcheckorderidx(BBP_cache(VIEWtparent(b)) { BAT *view = NULL; if (/* DISABLES CODE */ (0) && VIEWtparent(b) && !BATcheckorderidx(b)) { view = b; @@ -1850,7 +1850,7 @@ BATselect(BAT *b, BAT *s, const void *tl (!b->batTransient || (/* DISABLES CODE */ (0) && parent != 0 && - (tmp = BBPquickdesc(parent, false)) != NULL && + (tmp = BBP_cache(parent)) != NULL && !tmp->batTransient)); bn = scanselect(b, , , bn, tl, th, li, hi, equi, anti, lval, hval, lnil, maximum, use_imprints, ); @@ -2035,7 +2035,7 @@ rangejoin(BAT *r1, BAT *r2, BAT *l, BAT } if (!BATordered(l) && !BATordered_rev(l) && - (BATcheckorderidx(l) || (/* DISABLES CODE */ (0) && VIEWtparent(l) && BATcheckorderidx(BBPquickdesc(VIEWtparent(l), false) { + (BATcheckorderidx(l) || (/* DISABLES CODE */ (0) && VIEWtparent(l) && BATcheckorderidx(BBP_cache(VIEWtparent(l)) { use_orderidx = true; if (/* DISABLES CODE */ (0) && VIEWtparent(l) && !BATcheckorderidx(l)) { l = BBP_cache(VIEWtparent(l)); @@ -2166,7 +2166,7 @@ rangejoin(BAT *r1, BAT *r2, BAT *l, BAT !l->batTransient || (/* DISABLES CODE */ (0) && VIEWtparent(l) != 0 && -(tmp = BBPquickdesc(VIEWtparent(l), false)) != NULL && +(tmp = BBP_cache(VIEWtparent(l))) != NULL && !tmp->batTransient) || BATcheckimprints(l)) && BATimprints(l) == GDK_SUCCEED) { diff --git a/gdk/gdk_tm.c b/gdk/gdk_tm.c --- a/gdk/gdk_tm.c +++ b/gdk/gdk_tm.c @@ -106,7 +106,7 @@ epilogue(int cnt, bat *subcommit) } } if ((BBP_status(bid) & BBPDELETED) && BBP_refs(bid) <= 0 && BBP_lrefs(bid) <= 0) { - BAT *b = BBPquickdesc(bid, true); + BAT *b = BBPquickdesc(bid, false); /* the unloaded ones are deleted without * loading deleted disk images */ diff --git a/monetdb5/mal/mal_debugger.c b/monetdb5/mal/mal_debugger.c --- a/monetdb5/mal/mal_debugger.c +++ b/monetdb5/mal/mal_debugger.c @@ -138,7 +138,7 @@ printStackElm(stream *f, MalBlkPtr mb, V if (v && v->vtype == TYPE_bat) { bat i = v->val.bval; - BAT *b = BBPquickdesc(i, true); + BAT *b = BBPquickdesc(i, false); if (b) { nme = getTypeName(newBatType(b->ttype)); diff --git a/monetdb5/mal/mal_listing.c b/monetdb5/mal/mal_listing.c --- a/monetdb5/mal/mal_listing.c +++ b/monetdb5/mal/mal_listing.c @@ -142,7 +142,7 @@ renderTerm(MalBlkPtr mb, MalStkPtr stk, (isaBatType(getVarType(mb,varid)) && idx < p->retc); if (stk && isaBatType(getVarType(mb,varid)) && stk->stk[varid].val.bval ){ -
MonetDB: Jul2021 - Delay initialization of string heap hash unti...
Changeset: 49f602f33158 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/49f602f33158 Modified Files: gdk/gdk_string.c Branch: Jul2021 Log Message: Delay initialization of string heap hash until first string is entered. This means that empty string bats take up no space at all. diffs (70 lines): diff --git a/gdk/gdk_string.c b/gdk/gdk_string.c --- a/gdk/gdk_string.c +++ b/gdk/gdk_string.c @@ -71,16 +71,8 @@ strHeap(Heap *d, size_t cap) cap = MAX(cap, BATTINY); size = GDK_STRHASHTABLE * sizeof(stridx_t) + MIN(GDK_ELIMLIMIT, cap * GDK_VARALIGN); - if (HEAPalloc(d, size, 1, 1) == GDK_SUCCEED) { - d->free = GDK_STRHASHTABLE * sizeof(stridx_t); - d->dirty = true; - memset(d->base, 0, d->free); - d->hashash = false; -#ifndef NDEBUG - /* fill should solve initialization problems within valgrind */ - memset(d->base + d->free, 0, d->size - d->free); -#endif - } + if (HEAPalloc(d, size, 1, 1) != GDK_SUCCEED) + GDKerror("alloc failed"); } @@ -164,6 +156,11 @@ strLocate(Heap *h, const char *v) /* search hash-table, if double-elimination is still in place */ BUN off; + if (h->free == 0) { + /* empty, so there are no strings */ + return 0; + } + off = strHash(v); off &= GDK_STRHASHMASK; @@ -264,6 +261,35 @@ strPut(BAT *b, var_t *dst, const void *V stridx_t *bucket; BUN off, strhash; + if (h->free == 0) { + if (h->size < 64 * 1024) { + MT_lock_set(>theaplock); + if (ATOMIC_GET(>refs) == 1) { + if (HEAPextend(h, 64 * 1024, true) != GDK_SUCCEED) { + MT_lock_unset(>theaplock); + return 0; + } + } else { + MT_lock_unset(>theaplock); + Heap *new = HEAPgrow(h, 64 * 1024); + if (new == NULL) + return 0; + MT_lock_set(>theaplock); + HEAPdecref(h, false); + b->tvheap = h = new; + } + MT_lock_unset(>theaplock); + } + h->free = GDK_STRHASHTABLE * sizeof(stridx_t); + h->dirty = true; + memset(h->base, 0, h->free); + h->hashash = false; +#ifndef NDEBUG + /* fill should solve initialization problems within valgrind */ + memset(h->base + h->free, 0, h->size - h->free); +#endif + } + off = strHash(v); strhash = off; off &= GDK_STRHASHMASK; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: iso - Added DML dependency checks
Changeset: d7378d64f5ca for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/d7378d64f5ca Modified Files: sql/backends/monet5/rel_bin.c sql/storage/store.c sql/test/miscellaneous/Tests/transaction_isolation3.SQL.py Branch: iso Log Message: Added DML dependency checks diffs (211 lines): diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c --- a/sql/backends/monet5/rel_bin.c +++ b/sql/backends/monet5/rel_bin.c @@ -4365,6 +4365,9 @@ rel2bin_insert(backend *be, sql_rel *rel /* update predicate list */ if (rel->r && !rel_predicates(be, rel->r)) return NULL; + if (!isNew(t) && sql_trans_add_dependency_change(be->mvc->session->tr, t->base.id, dml) != LOG_OK) + return sql_error(sql, 02, SQLSTATE(HY013) MAL_MALLOC_FAIL); + if (ddl) { ret = ddl; list_prepend(l, ddl); @@ -5355,6 +5358,8 @@ rel2bin_update(backend *be, sql_rel *rel sql->cascade_action = NULL; if (rel->r && !rel_predicates(be, rel->r)) return NULL; + if (!isNew(t) && sql_trans_add_dependency_change(be->mvc->session->tr, t->base.id, dml) != LOG_OK) + return sql_error(sql, 02, SQLSTATE(HY013) MAL_MALLOC_FAIL); return cnt; } @@ -5596,6 +5601,9 @@ rel2bin_delete(backend *be, sql_rel *rel } if (rel->r && !rel_predicates(be, rel->r)) return NULL; + if (!isNew(t) && sql_trans_add_dependency_change(be->mvc->session->tr, t->base.id, dml) != LOG_OK) + return sql_error(sql, 02, SQLSTATE(HY013) MAL_MALLOC_FAIL); + return stdelete; } @@ -5821,6 +5829,9 @@ rel2bin_truncate(backend *be, sql_rel *r restart_sequences = E_ATOM_INT(n->data); cascade = E_ATOM_INT(n->next->data); + if (!isNew(t) && sql_trans_add_dependency_change(be->mvc->session->tr, t->base.id, dml) != LOG_OK) + return sql_error(sql, 02, SQLSTATE(HY013) MAL_MALLOC_FAIL); + truncate = sql_truncate(be, t, restart_sequences, cascade); if (sql->cascade_action) sql->cascade_action = NULL; diff --git a/sql/storage/store.c b/sql/storage/store.c --- a/sql/storage/store.c +++ b/sql/storage/store.c @@ -3108,8 +3108,18 @@ sql_trans_copy_key( sql_trans *tr, sql_t if ((res = store->table_api.table_insert(tr, syskey, >base.id, >base.id, >type, >base.name, (nk->type == fkey) ? &((sql_fkey *) nk)->rkey : , ))) return res; - if (nk->type == fkey && (res = sql_trans_create_dependency(tr, ((sql_fkey *) nk)->rkey, nk->base.id, FKEY_DEPENDENCY))) - return res; + if (nk->type == fkey) { + sql_key *rkey = (sql_key*)os_find_id(tr->cat->objects, tr, ((sql_fkey*)k)->rkey); + + if ((res = sql_trans_create_dependency(tr, rkey->base.id, nk->base.id, FKEY_DEPENDENCY))) + return res; + /* TODO this has to be cleaned out once the sql_cat.c cleanup is done */ + if (!isNew(rkey) && (res = sql_trans_add_dependency(tr, rkey->base.id, ddl))) + return res; + if (!isNew(rkey) && (res = sql_trans_add_dependency(tr, rkey->t->base.id, dml))) /* disallow concurrent updates on other key */ + return res; + } + for (n = nk->columns->h, nr = 0; n; n = n->next, nr++) { sql_kc *kc = n->data; @@ -3128,7 +3138,15 @@ sql_trans_copy_key( sql_trans *tr, sql_t if ((res = sql_trans_alter_null(tr, kc->c, 0))) return res; } - } + + /* TODO this has to be cleaned out too */ + if (!isNew(kc->c) && (res = sql_trans_add_dependency(tr, kc->c->base.id, ddl))) + return res; + } + + /* TODO this has to be cleaned out too */ + if (!isNew(t) && (res = sql_trans_add_dependency(tr, t->base.id, dml))) /* disallow concurrent updates on t */ + return res; if (kres) *kres = nk; return res; @@ -5091,6 +5109,8 @@ sql_trans_add_range_partition(sql_trans return res; if (!isNew(pt) && (res = sql_trans_add_dependency_change(tr, pt->base.id, ddl))) /* protect from being added twice */ return res; + if (!isNew(pt) && (res = sql_trans_add_dependency(tr, pt->base.id, dml))) /* disallow concurrent updates on pt */ + return res; finish: VALclear(); VALclear(); @@ -5221,6 +5241,8 @@ sql_trans_add_value_partition(sql_trans return res; if (!isNew(pt) && (res = sql_trans_add_dependency_change(tr, pt->base.id, ddl))) /* protect from being added twice */ return res; + if (!isNew(pt) && (res = sql_trans_add_dependency(tr, pt->base.id, dml))) /* disallow concurrent updates on pt */ + return res;
MonetDB: string_imprints - Initial implementation of the strimp ...
Changeset: 4ad4318de13e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/4ad4318de13e Added Files: sql/scripts/90_strimps.sql Modified Files: gdk/gdk_strimps.c monetdb5/modules/mal/batExtensions.c sql/backends/monet5/CMakeLists.txt sql/scripts/CMakeLists.txt Branch: string_imprints Log Message: Initial implementation of the strimp filter diffs (145 lines): diff --git a/gdk/gdk_strimps.c b/gdk/gdk_strimps.c --- a/gdk/gdk_strimps.c +++ b/gdk/gdk_strimps.c @@ -455,6 +455,7 @@ STRMPfilter(BAT *b, char *q) BUN i; uint64_t qbmask; uint64_t *ptr; + int zz = 0; if (b->tstrimps == NULL) @@ -471,15 +472,19 @@ STRMPfilter(BAT *b, char *q) qbmask = STRMPmakebitstring(q, b->tstrimps); ptr = (uint64_t *)b->tstrimps->strimps_base; - for (i = 0; i < b->batCount; i++) { - if ((*ptr & qbmask) == qbmask) { + if ((*(ptr + i) & qbmask) == qbmask) { oid pos = i; if (BUNappend(r, , false) != GDK_SUCCEED) goto sfilter_fail; } + else { + zz++; + } } + printf("filtered out: %d entries\n", zz); + r->tkey = true; return virtualize(r); diff --git a/monetdb5/modules/mal/batExtensions.c b/monetdb5/modules/mal/batExtensions.c --- a/monetdb5/modules/mal/batExtensions.c +++ b/monetdb5/modules/mal/batExtensions.c @@ -340,7 +340,7 @@ PATstrimp_makehist(Client cntxt, MalBlkP } #endif static str -PATstrimp(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) +PATstrimpCreate(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { bat bid; BAT *b; @@ -358,6 +358,50 @@ PATstrimp(Client cntxt, MalBlkPtr mb, Ma return MAL_SUCCEED; } +static str +PATstrimpFilter(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { + (void)cntxt; + (void)mb; + (void)stk; + (void)pci; + throw(MAL, "bat.strimpfilter", SQLSTATE(HY002) "UNIMPLEMENTED"); +} + +static str +PATstrimpFilterSelect(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) +{ + bat bid, sid; + BAT *b, *s, *ob; + str pat; + + (void)cntxt; + (void)mb; + + bid = *getArgReference_bat(stk, pci, 1); + if ((b = BATdescriptor(bid)) == NULL) + throw(MAL, "bat.strimpfilter", SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); + + sid = *getArgReference_bat(stk, pci, 2); + if ((s = BATdescriptor(sid)) == NULL) + throw(MAL, "bat.strimpfilter", SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); + + assert(s->ttype == TYPE_void); + + if (!STRMPcreate(b)) { + throw(MAL, "bat.strimpfilter", SQLSTATE(HY002) OPERATION_FAILED); + } + + pat = *getArgReference_str(stk, pci, 3); + if ((ob = STRMPfilter(b, pat)) == NULL) { + BBPunfix(b->batCacheid); + throw(MAL, "bat.strimpfilter", SQLSTATE(HY002)); + } + + *getArgReference_bat(stk, pci, 0) = ob->batCacheid; + BBPkeepref(ob->batCacheid); + + return MAL_SUCCEED; +} #include "mel.h" mel_func batExtensions_init_funcs[] = { @@ -392,7 +436,10 @@ mel_func batExtensions_init_funcs[] = { /* String imprints */ // pattern("bat", "strimpNDigrams", PATstrimp_ndigrams, false, "count digrams in a string bat", args(1,2,arg("",lng),batarg("b",str))), // pattern("bat", "strimpHistogram", PATstrimp_makehist, false, "make a histogram of all the byte pairs in a BAT", args(2,3,arg("",lng), batarg("",lng),batarg("b",str))), - pattern("bat", "strimp", PATstrimp, false, "construct the strimp a BAT", args(1,2,arg("",void),batarg("b",str))), + pattern("bat", "mkstrimp", PATstrimpCreate, false, "construct the strimp a BAT", args(1,2,arg("",void),batarg("b",str))), + pattern("bat", "strimpfilter", PATstrimpFilter, false, "", args(1,3,arg("",bit),arg("b",str),arg("q",str))), + pattern("bat", "strimpfilterselect", PATstrimpFilterSelect, false, "", args(1,5,batarg("",oid),batarg("b",str),batarg("s",oid),arg("q",str),arg("a",bit))), + pattern("bat", "strimpfilterjoin", PATstrimpFilter, false, "", args(2,8,batarg("",oid),batarg("b",str),arg("q",str))), { .imp=NULL } }; #include "mal_import.h" diff --git a/sql/backends/monet5/CMakeLists.txt b/sql/backends/monet5/CMakeLists.txt --- a/sql/backends/monet5/CMakeLists.txt +++ b/sql/backends/monet5/CMakeLists.txt @@ -40,7 +40,8 @@ set(include_sql_files 75_storagemodel 76_dump 80_statistics - 81_tracer) + 81_tracer + 90_strimps) if(HAVE_HGE) list(APPEND include_sql_files diff --git a/sql/scripts/90_strimps.sql b/sql/scripts/90_strimps.sql new file mode 100644 --- /dev/null +++ b/sql/scripts/90_strimps.sql @@ -0,0 +1,8 @@ +create schema strimps; + +-- create procedure strimps.strmpcreate(b string) +-- external name bat.strimpCreate; +-- grant execute on procedure
MonetDB: string_imprints - Fix strimp generation bugs
Changeset: a7567eea4081 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/a7567eea4081 Modified Files: gdk/gdk_strimps.c Branch: string_imprints Log Message: Fix strimp generation bugs diffs (55 lines): diff --git a/gdk/gdk_strimps.c b/gdk/gdk_strimps.c --- a/gdk/gdk_strimps.c +++ b/gdk/gdk_strimps.c @@ -133,12 +133,10 @@ next_pair(PairIterator *pi) { static int8_t STRMPpairLookup(Strimps *s, CharPair *p) { - int8_t ret = -1; size_t idx = 0; size_t npairs = NPAIRS(((uint64_t *)s->strimps.base)[0]); size_t offset = 0; CharPair sp; - (void)p; for (idx = 0; idx < npairs; idx++) { sp.psize = s->sizes_base[idx]; @@ -148,7 +146,7 @@ STRMPpairLookup(Strimps *s, CharPair *p) offset += sp.psize; } - return ret; + return -1; } static bool @@ -160,8 +158,8 @@ ignored(CharPair *p, uint8_t elm) { #define MAX_PAIR_SIZE 8 /* Given a strimp header and a string compute the bitstring of which - * digrams(byte pairs) are present in the string. The strimp header is a - * map from digram(byte pair) to index in the strimp. + * digrams are present in the string. The strimp header is a map from + * digram to index in the strimp. * * This should probably be inlined. */ @@ -179,8 +177,8 @@ STRMPmakebitstring(const str s, Strimps while(pair_at(, )) { pair_idx = STRMPpairLookup(r, ); - if (pair_idx > 0) - ret |= 0x1 << pair_idx; + if (pair_idx >= 0) + ret |= ((uint64_t)0x1 << pair_idx); next_pair(); } @@ -617,7 +615,6 @@ STRMPcreate(BAT *b) } /* Left over code */ - #if 0 /* This counts how many unicode codepoints the given string * contains. ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: string_imprints - Merge with default
Changeset: cffe5ff7bdad for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/cffe5ff7bdad Modified Files: gdk/gdk.h gdk/gdk_private.h Branch: string_imprints Log Message: Merge with default diffs (truncated from 125754 to 300 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 @@ -5752,7 +5752,7 @@ stdout of test 'MAL-signatures` in direc [ "batcalc", "timestamp","pattern batcalc.timestamp(X_0:bat[:timestamp], X_1:bat[:oid], X_2:int):bat[:timestamp] ", "timestamp_2time_timestamp;", "" ] [ "batcalc", "uuid", "command batcalc.uuid(X_0:bat[:str], X_1:bat[:oid]):bat[:uuid] ", "UUIDstr2uuid_bulk;", "" ] [ "batcalc", "uuid", "command batcalc.uuid(X_0:bat[:uuid], X_1:bat[:oid]):bat[:uuid] ", "UUIDuuid2uuid_bulk;", "" ] -[ "batcalc", "wkb", "command batcalc.wkb(X_0:bat[:wkb], X_1:int, X_2:int):bat[:wkb] ", "geom_2_geom_bat;", "" ] +[ "batcalc", "wkb", "command batcalc.wkb(X_0:bat[:wkb], X_1:bat[:oid], X_2:int, X_3:int):bat[:wkb] ", "geom_2_geom_bat;", "" ] [ "batcalc", "xml", "command batcalc.xml(X_0:bat[:str]):bat[:xml] ", "BATXMLstr2xml;", "" ] [ "batcalc", "xor", "pattern batcalc.xor(X_0:bat[:bit], X_1:bat[:bit]):bat[:bit] ", "CMDbatXOR;", "" ] [ "batcalc", "xor", "pattern batcalc.xor(X_0:bat[:bit], X_1:bat[:bit], X_2:bat[:oid], X_3:bat[:oid]):bat[:bit] ", "CMDbatXOR;", "" ] @@ -9208,7 +9208,7 @@ stdout of test 'MAL-signatures` in direc [ "sql", "analyze", "unsafe pattern sql.analyze(X_0:int, X_1:lng, X_2:str, X_3:str):void ", "sql_analyze;", "" ] [ "sql", "analyze", "unsafe pattern sql.analyze(X_0:int, X_1:lng, X_2:str, X_3:str, X_4:str):void ","sql_analyze;", "" ] [ "sql", "any", "pattern sql.any(X_0:bit, X_1:bit, X_2:bit):bit ", "SQLany_cmp;", "" ] -[ "sql", "append", "pattern sql.append(X_0:int, X_1:str, X_2:str, X_3:str, X_4:lng, X_5:any):int ","mvc_append_wrap;", "" ] +[ "sql", "append", "pattern sql.append(X_0:int, X_1:str, X_2:str, X_3:str, X_4:bat[:oid], X_5:any):int ", "mvc_append_wrap;", "" ] [ "sql", "argRecord","pattern sql.argRecord():str ", "SQLargRecord;","" ] [ "sql", "argRecord","pattern sql.argRecord(X_0:any...):str ", "SQLargRecord;","" ] [ "sql", "assert", "pattern sql.assert(X_0:bit, X_1:str):void ", "SQLassert;", "" ] @@ -9232,7 +9232,7 @@ stdout of test 'MAL-signatures` in direc [ "sql", "bind_idxbat", "pattern sql.bind_idxbat(X_0:int, X_1:str, X_2:str, X_3:str, X_4:int):bat[:any_1] ","mvc_bind_idxbat_wrap;","" ] [ "sql", "bind_idxbat", "pattern sql.bind_idxbat(X_0:int, X_1:str, X_2:str, X_3:str, X_4:int, X_5:int, X_6:int) (X_7:bat[:oid], X_8:bat[:any_1]) ", "mvc_bind_idxbat_wrap;","" ] [ "sql", "bind_idxbat", "pattern sql.bind_idxbat(X_0:int, X_1:str, X_2:str, X_3:str, X_4:int, X_5:int, X_6:int):bat[:any_1] ", "mvc_bind_idxbat_wrap;","" ] -[ "sql", "claim","unsafe pattern sql.claim(X_0:int, X_1:str, X_2:str, X_3:lng):lng ","mvc_claim_wrap;", "" ] +[ "sql", "claim","unsafe pattern sql.claim(X_0:int, X_1:str, X_2:str, X_3:lng):bat[:oid] ", "mvc_claim_wrap;", "" ] [ "sql", "clear_table", "unsafe pattern sql.clear_table(X_0:str, X_1:str):lng ","mvc_clear_table_wrap;","" ] [ "sql", "commit", "unsafe pattern sql.commit():void ", "SQLcommit;", "" ] [ "sql", "copy_from","unsafe pattern sql.copy_from(X_0:ptr, X_1:str, X_2:str, X_3:str, X_4:str, X_5:str, X_6:lng, X_7:lng, X_8:int, X_9:str, X_10:int, X_11:int):bat[:any]... ", "mvc_import_table_wrap;", "" ] @@ -9244,6 +9244,7 @@ stdout of test 'MAL-signatures` in direc [ "sql", "corr", "pattern sql.corr(X_0:int, X_1:int, X_2:bit, X_3:bit, X_4:int, X_5:oid, X_6:oid):dbl ", "SQLcorr;", "" ] [ "sql", "corr", "pattern sql.corr(X_0:lng, X_1:lng, X_2:bit, X_3:bit, X_4:int, X_5:oid, X_6:oid):dbl ", "SQLcorr;", "" ] [ "sql", "corr", "pattern sql.corr(X_0:sht, X_1:sht, X_2:bit, X_3:bit, X_4:int, X_5:oid, X_6:oid):dbl ", "SQLcorr;", "" ] +[ "sql", "count","pattern sql.count(X_0:str, X_1:str):lng ", "SQLbasecount;","" ] [ "sql", "count","pattern sql.count(X_0:any_1, X_1:bit, X_2:bit, X_3:bit, X_4:int, X_5:oid, X_6:oid):lng ", "SQLcount;","" ] [ "sql", "covariance", "pattern sql.covariance(X_0:bte, X_1:bte, X_2:bit, X_3:bit, X_4:int, X_5:oid, X_6:oid):dbl ", "SQLcovar_samp;", "" ] [ "sql", "covariance",
MonetDB: string_imprints - Merge with default
Changeset: 80f037721006 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/80f037721006 Modified Files: gdk/gdk_private.h Branch: string_imprints Log Message: Merge with default diffs (truncated from 5721 to 300 lines): diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -541,8 +541,8 @@ gdk_return log_bat_transient(logger *lg, gdk_return log_constant(logger *lg, int type, ptr val, log_id id, lng offset, lng cnt); gdk_return log_delta(logger *lg, BAT *uid, BAT *uval, log_id id); gdk_return log_sequence(logger *lg, int seq, lng id); -gdk_return log_tend(logger *lg); -gdk_return log_tstart(logger *lg, ulng commit_ts, bool flush); +gdk_return log_tend(logger *lg, ulng commit_ts); +gdk_return log_tstart(logger *lg, bool flush); gdk_return logger_activate(logger *lg); lng logger_changes(logger *lg); logger *logger_create(int debug, const char *fn, const char *logdir, int version, preversionfix_fptr prefuncp, postversionfix_fptr postfuncp, void *funcdata); @@ -761,6 +761,7 @@ void MCcloseClient(Client c); Client MCforkClient(Client father); Client MCgetClient(int id); Client MCinitClient(oid user, bstream *fin, stream *fout); +size_t MCmemoryClaim(void); int MCpushClientInput(Client c, bstream *new_input, int listing, char *prompt); void MCstopClients(Client c); str MCsuspendClient(int id); diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c --- a/gdk/gdk_bat.c +++ b/gdk/gdk_bat.c @@ -809,12 +809,12 @@ COLcopy(BAT *b, int tt, bool writable, r /* first try case (1); create a view, possibly with different * atom-types */ - if (role == b->batRole && + if (!writable && + role == b->batRole && b->batRestricted == BAT_READ && ATOMstorage(b->ttype) != TYPE_msk && /* no view on TYPE_msk */ (!VIEWtparent(b) || -BBP_cache(VIEWtparent(b))->batRestricted == BAT_READ) && - !writable) { +BBP_cache(VIEWtparent(b))->batRestricted == BAT_READ)) { bn = VIEWcreate(b->hseqbase, b); if (bn == NULL) return NULL; @@ -875,8 +875,8 @@ COLcopy(BAT *b, int tt, bool writable, r strconcat_len(thp.filename, sizeof(thp.filename), BBP_physical(bn->batCacheid), ".theap", NULL); - if ((b->ttype && HEAPcopy(, b->theap) != GDK_SUCCEED) || - (bn->tvheap && HEAPcopy(, b->tvheap) != GDK_SUCCEED)) { + if ((b->ttype && HEAPcopy(, b->theap, b->tbaseoff << b->tshift) != GDK_SUCCEED) || + (bn->tvheap && HEAPcopy(, b->tvheap, 0) != GDK_SUCCEED)) { HEAPfree(, true); HEAPfree(, true); BBPreclaim(bn); diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c --- a/gdk/gdk_batop.c +++ b/gdk/gdk_batop.c @@ -32,7 +32,7 @@ unshare_varsized_heap(BAT *b) h->farmid = BBPselectfarm(b->batRole, TYPE_str, varheap); strconcat_len(h->filename, sizeof(h->filename), BBP_physical(b->batCacheid), ".theap", NULL); - if (HEAPcopy(h, b->tvheap) != GDK_SUCCEED) { + if (HEAPcopy(h, b->tvheap, 0) != GDK_SUCCEED) { HEAPfree(h, true); GDKfree(h); return GDK_FAIL; @@ -496,7 +496,7 @@ append_varsized_bat(BAT *b, BAT *n, stru h->farmid = BBPselectfarm(b->batRole, b->ttype, varheap); strconcat_len(h->filename, sizeof(h->filename), BBP_physical(b->batCacheid), ".theap", NULL); - if (HEAPcopy(h, b->tvheap) != GDK_SUCCEED) { + if (HEAPcopy(h, b->tvheap, 0) != GDK_SUCCEED) { HEAPfree(h, true); GDKfree(h); return GDK_FAIL; diff --git a/gdk/gdk_group.c b/gdk/gdk_group.c --- a/gdk/gdk_group.c +++ b/gdk/gdk_group.c @@ -453,41 +453,43 @@ rev(oid x) return x; } -/* population count: count number of 1 bits in a value */ -static inline int -pop(oid x) +/* count trailing zeros, also see candmask_lobit in gdk_cand.h */ +static inline int __attribute__((__const__)) +ctz(oid x) { -#ifdef __GNUC__ +#if defined(__GNUC__) #if SIZEOF_OID == SIZEOF_INT - return __builtin_popcount(x); + return __builtin_ctz(x); #else - return __builtin_popcountl(x); + return __builtin_ctzl(x); #endif -#else -#ifdef _MSC_VER +#elif defined(_MSC_VER) #if SIZEOF_OID == SIZEOF_INT - return (int) __popcnt((unsigned int) (x)); -#else - return (int) __popcnt64((unsigned __int64) (x)); -#endif + unsigned long idx; + if (_BitScanForward(, (unsigned long) x)) +
MonetDB: Jul2021 - Dereference external values.
Changeset: a53bf23e6341 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/a53bf23e6341 Modified Files: monetdb5/modules/kernel/bat5.c Branch: Jul2021 Log Message: Dereference external values. diffs (51 lines): 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 @@ -44,6 +44,17 @@ */ +#define derefStr(b, v) \ + do { \ + int _tpe= ATOMstorage((b)->ttype); \ + if (_tpe >= TYPE_str) { \ + if ((v) == 0 || *(str*) (v) == 0) \ + (v) = (str) str_nil;\ + else \ + (v) = *(str *) (v); \ + } \ + } while (0) + str BKCnewBAT(bat *res, const int *tt, const BUN *cap, role_t role) { @@ -232,12 +243,7 @@ BKCappend_val_force_wrap(bat *r, const b throw(MAL, "bat.append", SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); if ((b = BATsetaccess(b, BAT_WRITE)) == NULL) throw(MAL, "bat.append", OPERATION_FAILED); - if (b->ttype >= TYPE_str && ATOMstorage(b->ttype) >= TYPE_str) { - if (u == 0 || *(str*)u == 0) - u = (ptr) str_nil; - else - u = (ptr) *(str *)u; - } + derefStr(b, u); if (BUNappend(b, u, force ? *force : false) != GDK_SUCCEED) { BBPunfix(b->batCacheid); throw(MAL, "bat.append", GDK_EXCEPTION); @@ -262,6 +268,7 @@ BKCbun_inplace(bat *r, const bat *bid, c if ((b = BATdescriptor(*bid)) == NULL) throw(MAL, "bat.inplace", SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); + derefStr(b, t); if (void_inplace(b, *id, t, false) != GDK_SUCCEED) { BBPunfix(b->batCacheid); throw(MAL, "bat.inplace", GDK_EXCEPTION); @@ -280,6 +287,7 @@ BKCbun_inplace_force(bat *r, const bat * if ((b = BATdescriptor(*bid)) == NULL) throw(MAL, "bat.inplace", SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); + derefStr(b, t); if (void_inplace(b, *id, t, *force) != GDK_SUCCEED) { BBPunfix(b->batCacheid); throw(MAL, "bat.inplace", GDK_EXCEPTION); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: iso - Add type of dependency to check at end of transac...
Changeset: b55bcf09188c for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/b55bcf09188c Modified Files: sql/backends/monet5/sql_cat.c sql/backends/monet5/sql_statistics.c sql/include/sql_catalog.h sql/server/sql_mvc.c sql/server/sql_privileges.c sql/storage/sql_storage.h sql/storage/store.c Branch: iso Log Message: Add type of dependency to check at end of transaction diffs (truncated from 701 to 300 lines): diff --git a/sql/backends/monet5/sql_cat.c b/sql/backends/monet5/sql_cat.c --- a/sql/backends/monet5/sql_cat.c +++ b/sql/backends/monet5/sql_cat.c @@ -1830,7 +1830,7 @@ SQLcomment_on(Client cntxt, MalBlkPtr mb } if (ok != LOG_OK) throw(SQL, "sql.comment_on", SQLSTATE(42000) "Comment on failed%s", ok == LOG_CONFLICT ? " due to conflict with another transaction" : ""); - if ((ok = sql_trans_add_dependency(tx, objid)) != LOG_OK) /* At the moment this adds dependencies for old objects :( */ + if ((ok = sql_trans_add_dependency(tx, objid, ddl)) != LOG_OK) /* At the moment this adds dependencies for old objects :( */ throw(SQL, "sql.comment_on", SQLSTATE(HY013) MAL_MALLOC_FAIL); } else { if (!is_oid_nil(rid)) { diff --git a/sql/backends/monet5/sql_statistics.c b/sql/backends/monet5/sql_statistics.c --- a/sql/backends/monet5/sql_statistics.c +++ b/sql/backends/monet5/sql_statistics.c @@ -320,7 +320,7 @@ sql_analyze(Client cntxt, MalBlkPtr mb, GDKfree(minval); throw(SQL, "analyze", SQLSTATE(42000) "ANALYZE: failed%s", log_res == LOG_CONFLICT ? " due to conflict with another transaction" : ""); } - if (!isNew(c) && (log_res = sql_trans_add_dependency(tr, c->base.id)) != LOG_OK) { + if (!isNew(c) && (log_res = sql_trans_add_dependency(tr, c->base.id, ddl)) != LOG_OK) { GDKfree(maxval); GDKfree(minval); throw(SQL, "analyze", SQLSTATE(HY013) MAL_MALLOC_FAIL); diff --git a/sql/include/sql_catalog.h b/sql/include/sql_catalog.h --- a/sql/include/sql_catalog.h +++ b/sql/include/sql_catalog.h @@ -315,7 +315,7 @@ typedef struct sql_trans { list *dropped; /* protection against recursive cascade action*/ list *predicates; /* list of read predicates logged during update transactions */ list *dependencies; /* list of dependencies created (list of sqlids from the objects) */ - list *removals; /* list of old objects removed or renamed (it would be tested for conflicts at the end of the transaction) */ + list *depchanges; /* list of dependencies changed (it would be tested for conflicts at the end of the transaction) */ int logchanges; /* count number of changes to be applied too the wal */ int active; /* is active transaction */ diff --git a/sql/server/sql_mvc.c b/sql/server/sql_mvc.c --- a/sql/server/sql_mvc.c +++ b/sql/server/sql_mvc.c @@ -1318,7 +1318,7 @@ mvc_create_dependency(mvc *m, sql_base * TRC_DEBUG(SQL_TRANS, "Create dependency: %d %d %d\n", b->id, depend_id, (int) depend_type); if ( (b->id != depend_id) || (depend_type == BEDROPPED_DEPENDENCY) ) { if (!b->new) - sql_trans_add_dependency(m->session->tr, b->id); + sql_trans_add_dependency(m->session->tr, b->id, ddl); sql_trans_create_dependency(m->session->tr, b->id, depend_id, depend_type); } } @@ -1331,7 +1331,7 @@ mvc_create_dependencies(mvc *m, list *bl for (node *n = blist->h ; n ; n = n->next) { sql_base *b = n->data; if (!b->new) /* only add old objects to the transaction dependency list */ - sql_trans_add_dependency(m->session->tr, b->id); + sql_trans_add_dependency(m->session->tr, b->id, ddl); mvc_create_dependency(m, b, depend_id, dep_type); } } diff --git a/sql/server/sql_privileges.c b/sql/server/sql_privileges.c --- a/sql/server/sql_privileges.c +++ b/sql/server/sql_privileges.c @@ -130,9 +130,9 @@ sql_grant_global_privs( mvc *sql, char * throw(SQL,"sql.grant_global",SQLSTATE(42000) "GRANT: failed%s", log_res == LOG_CONFLICT ? " due to conflict with another transaction" : ""); /* Add dependencies created */ - if ((log_res = sql_trans_add_dependency(sql->session->tr, grantee_id)) != LOG_OK) + if ((log_res = sql_trans_add_dependency(sql->session->tr, grantee_id, ddl)) !=
MonetDB: iso - Remove redundant if (bad merge)
Changeset: 1b3ac9021c1a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/1b3ac9021c1a Modified Files: sql/storage/store.c Branch: iso Log Message: Remove redundant if (bad merge) diffs (152 lines): diff --git a/sql/storage/store.c b/sql/storage/store.c --- a/sql/storage/store.c +++ b/sql/storage/store.c @@ -3723,81 +3723,79 @@ sql_trans_commit(sql_trans *tr) } } - if (!list_empty(tr->changes)) { - MT_lock_set(>commit); - /* log changes should only be done if there is something to log */ - if (!tr->parent && tr->logchanges > 0) { - int min_changes = GDKdebug & FORCEMITOMASK ? 5 : 100; - flush = (tr->logchanges > min_changes && list_empty(store->changes)); - if (flush) - MT_lock_set(>flush); - ok = store->logger_api.log_tstart(store, flush); - /* log */ - for(node *n=tr->changes->h; n && ok == LOG_OK; n = n->next) { - sql_change *c = n->data; - - if (c->log && ok == LOG_OK) - ok = c->log(tr, c); - } - if (ok == LOG_OK && store->prev_oid != store->obj_id) - ok = store->logger_api.log_sequence(store, OBJ_SID, store->obj_id); - store->prev_oid = store->obj_id; - if (ok == LOG_OK && !flush) - ok = store->logger_api.log_tend(store); /* flush/sync */ - store_lock(store); - if (ok == LOG_OK && !flush) /* mark as done */ - ok = store->logger_api.log_tdone(store, commit_ts); - } else { - store_lock(store); - if (tr->parent) - tr->parent->logchanges += tr->logchanges; - } - oldest = tr->parent ? commit_ts : oldest; - tr->logchanges = 0; - TRC_DEBUG(SQL_STORE, "Forwarding changes (" ULLFMT ", " ULLFMT ") -> " ULLFMT "\n", tr->tid, tr->ts, commit_ts); - /* apply committed changes */ - if (ATOMIC_GET(>nr_active) == 1 && !tr->parent) { - id_hash_clear(store->dependencies); - id_hash_clear(store->removals); - oldest = commit_ts; - } - store_pending_changes(store, oldest); + MT_lock_set(>commit); + /* log changes should only be done if there is something to log */ + if (!tr->parent && tr->logchanges > 0) { + int min_changes = GDKdebug & FORCEMITOMASK ? 5 : 100; + flush = (tr->logchanges > min_changes && list_empty(store->changes)); + if (flush) + MT_lock_set(>flush); + ok = store->logger_api.log_tstart(store, flush); + /* log */ for(node *n=tr->changes->h; n && ok == LOG_OK; n = n->next) { sql_change *c = n->data; - if (c->commit && ok == LOG_OK) - ok = c->commit(tr, c, commit_ts, oldest); - else - c->obj->new = 0; - c->ts = commit_ts; - } - /* when directly flushing: flush logger after changes got applied */ - if (ok == LOG_OK && flush) { - ok = store->logger_api.log_tend(store); /* flush/sync */ - if (ok == LOG_OK) - ok = store->logger_api.log_tdone(store, commit_ts); /* mark as done */ - MT_lock_unset(>flush); + if (c->log && ok == LOG_OK) + ok = c->log(tr, c); } - /* garbage collect */ - for(node *n=tr->changes->h; n && ok == LOG_OK; ) { - node *next = n->next; - sql_change *c = n->data; - - if (!c->cleanup || c->cleanup(store, c, oldest)) { - _DELETE(c); -
MonetDB: iso - Merged with Jul2021
Changeset: e67ce51fe0de for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/e67ce51fe0de Modified Files: sql/storage/bat/bat_storage.c sql/storage/objectset.c sql/storage/store.c sql/test/miscellaneous/Tests/All Branch: iso Log Message: Merged with Jul2021 diffs (truncated from 507 to 300 lines): diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c --- a/gdk/gdk_aggr.c +++ b/gdk/gdk_aggr.c @@ -3637,7 +3637,7 @@ BATmin_skipnil(BAT *b, void *aggr, bit s if (BATcheckorderidx(b) || (/* DISABLES CODE */ (0) && VIEWtparent(b) && -(pb = BBPdescriptor(VIEWtparent(b))) != NULL && +(pb = BBP_cache(VIEWtparent(b))) != NULL && pb->tbaseoff == b->tbaseoff && BATcount(pb) == BATcount(b) && pb->hseqbase == b->hseqbase && @@ -3668,9 +3668,9 @@ BATmin_skipnil(BAT *b, void *aggr, bit s } } else if ((VIEWtparent(b) == 0 || (/* DISABLES CODE */ (0) && -BATcount(b) == BATcount(BBPdescriptor(VIEWtparent(b) && +BATcount(b) == BATcount(BBP_cache(VIEWtparent(b) && BATcheckimprints(b)) { - Imprints *imprints = VIEWtparent(b) ? BBPdescriptor(VIEWtparent(b))->timprints : b->timprints; + Imprints *imprints = VIEWtparent(b) ? BBP_cache(VIEWtparent(b))->timprints : b->timprints; int i; MT_thread_setalgorithm(VIEWtparent(b) ? "using parent imprints" : "using imprints"); @@ -3751,7 +3751,7 @@ BATmax_skipnil(BAT *b, void *aggr, bit s if (BATcheckorderidx(b) || (/* DISABLES CODE */ (0) && VIEWtparent(b) && -(pb = BBPdescriptor(VIEWtparent(b))) != NULL && +(pb = BBP_cache(VIEWtparent(b))) != NULL && pb->tbaseoff == b->tbaseoff && BATcount(pb) == BATcount(b) && pb->hseqbase == b->hseqbase && @@ -3773,9 +3773,9 @@ BATmax_skipnil(BAT *b, void *aggr, bit s } } else if ((VIEWtparent(b) == 0 || (/* DISABLES CODE */ (0) && -BATcount(b) == BATcount(BBPdescriptor(VIEWtparent(b) && +BATcount(b) == BATcount(BBP_cache(VIEWtparent(b) && BATcheckimprints(b)) { - Imprints *imprints = VIEWtparent(b) ? BBPdescriptor(VIEWtparent(b))->timprints : b->timprints; + Imprints *imprints = VIEWtparent(b) ? BBP_cache(VIEWtparent(b))->timprints : b->timprints; int i; MT_thread_setalgorithm(VIEWtparent(b) ? "using parent imprints" : "using imprints"); @@ -4059,7 +4059,7 @@ doBATgroupquantile(BAT *b, BAT *g, BAT * if (BATcheckorderidx(b) || (/* DISABLES CODE */ (0) && VIEWtparent(b) && -(pb = BBPdescriptor(VIEWtparent(b))) != NULL && +(pb = BBP_cache(VIEWtparent(b))) != NULL && pb->tbaseoff == b->tbaseoff && BATcount(pb) == BATcount(b) && pb->hseqbase == b->hseqbase && diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c --- a/gdk/gdk_batop.c +++ b/gdk/gdk_batop.c @@ -1929,7 +1929,7 @@ BATkeyed(BAT *b) BAThash(b) == GDK_SUCCEED) || (/* DISABLES CODE */ (0) && VIEWtparent(b) != 0 && - BATcheckhash(BBPdescriptor(VIEWtparent(b) { + BATcheckhash(BBP_cache(VIEWtparent(b) { /* we already have a hash table on b, or b is * persistent and we could create a hash * table, or b is a view on a bat that already @@ -1939,7 +1939,7 @@ BATkeyed(BAT *b) MT_rwlock_rdlock(>thashlock); hs = b->thash; if (hs == NULL && VIEWtparent(b) != 0) { - BAT *b2 = BBPdescriptor(VIEWtparent(b)); + BAT *b2 = BBP_cache(VIEWtparent(b)); lo = b->tbaseoff - b2->tbaseoff; hs = b2->thash; } @@ -2445,7 +2445,7 @@ BATsort(BAT **sorted, BAT **order, BAT * return GDK_SUCCEED; } if (VIEWtparent(b)) { - pb = BBPdescriptor(VIEWtparent(b)); + pb = BBP_cache(VIEWtparent(b)); if (/* DISABLES CODE */ (1) || b->tbaseoff != pb->tbaseoff || BATcount(b) != BATcount(pb) || diff
MonetDB: Jul2021 - Simplify unload test.
Changeset: c29fdf74c0c4 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/c29fdf74c0c4 Modified Files: gdk/gdk_bbp.c Branch: Jul2021 Log Message: Simplify unload test. diffs (17 lines): diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -2375,9 +2375,10 @@ decref(bat i, bool logical, bool release if (BBP_refs(i) > 0 || (BBP_lrefs(i) > 0 && (b == NULL || - (BATdirty(b) && (BBP_status(i) & BBPHOT)) || - (BBP_status(i) & BBPSYNCING) || /* no swap during (sub)commit */ - (BBP_status(i) & (BBPPERSISTENT | BBPHOT)) == BBPHOT || + BATdirty(b) || + (BBP_status(i) & BBPHOT) || + (BBP_status(i) & BBPSYNCING) || + !(BBP_status(i) & BBPPERSISTENT) || GDKinmemory(b->theap->farmid { /* bat cannot be swapped out */ } else if (b ? b->batSharecnt == 0 : (BBP_status(i) & BBPTMP)) { ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jul2021 - Don't go through BBPdescriptor to get parent ...
Changeset: 4381827a1c0b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/4381827a1c0b Modified Files: gdk/gdk_aggr.c gdk/gdk_batop.c gdk/gdk_group.c gdk/gdk_imprints.c gdk/gdk_join.c gdk/gdk_select.c sql/benchmarks/tpcds/Tests/one.test.in Branch: Jul2021 Log Message: Don't go through BBPdescriptor to get parent BAT descriptor. We don't want to wait, the descriptor is available since the view is in core. diffs (231 lines): diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c --- a/gdk/gdk_aggr.c +++ b/gdk/gdk_aggr.c @@ -3637,7 +3637,7 @@ BATmin_skipnil(BAT *b, void *aggr, bit s if (BATcheckorderidx(b) || (/* DISABLES CODE */ (0) && VIEWtparent(b) && -(pb = BBPdescriptor(VIEWtparent(b))) != NULL && +(pb = BBP_cache(VIEWtparent(b))) != NULL && pb->tbaseoff == b->tbaseoff && BATcount(pb) == BATcount(b) && pb->hseqbase == b->hseqbase && @@ -3668,9 +3668,9 @@ BATmin_skipnil(BAT *b, void *aggr, bit s } } else if ((VIEWtparent(b) == 0 || (/* DISABLES CODE */ (0) && -BATcount(b) == BATcount(BBPdescriptor(VIEWtparent(b) && +BATcount(b) == BATcount(BBP_cache(VIEWtparent(b) && BATcheckimprints(b)) { - Imprints *imprints = VIEWtparent(b) ? BBPdescriptor(VIEWtparent(b))->timprints : b->timprints; + Imprints *imprints = VIEWtparent(b) ? BBP_cache(VIEWtparent(b))->timprints : b->timprints; int i; MT_thread_setalgorithm(VIEWtparent(b) ? "using parent imprints" : "using imprints"); @@ -3751,7 +3751,7 @@ BATmax_skipnil(BAT *b, void *aggr, bit s if (BATcheckorderidx(b) || (/* DISABLES CODE */ (0) && VIEWtparent(b) && -(pb = BBPdescriptor(VIEWtparent(b))) != NULL && +(pb = BBP_cache(VIEWtparent(b))) != NULL && pb->tbaseoff == b->tbaseoff && BATcount(pb) == BATcount(b) && pb->hseqbase == b->hseqbase && @@ -3773,9 +3773,9 @@ BATmax_skipnil(BAT *b, void *aggr, bit s } } else if ((VIEWtparent(b) == 0 || (/* DISABLES CODE */ (0) && -BATcount(b) == BATcount(BBPdescriptor(VIEWtparent(b) && +BATcount(b) == BATcount(BBP_cache(VIEWtparent(b) && BATcheckimprints(b)) { - Imprints *imprints = VIEWtparent(b) ? BBPdescriptor(VIEWtparent(b))->timprints : b->timprints; + Imprints *imprints = VIEWtparent(b) ? BBP_cache(VIEWtparent(b))->timprints : b->timprints; int i; MT_thread_setalgorithm(VIEWtparent(b) ? "using parent imprints" : "using imprints"); @@ -4059,7 +4059,7 @@ doBATgroupquantile(BAT *b, BAT *g, BAT * if (BATcheckorderidx(b) || (/* DISABLES CODE */ (0) && VIEWtparent(b) && -(pb = BBPdescriptor(VIEWtparent(b))) != NULL && +(pb = BBP_cache(VIEWtparent(b))) != NULL && pb->tbaseoff == b->tbaseoff && BATcount(pb) == BATcount(b) && pb->hseqbase == b->hseqbase && diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c --- a/gdk/gdk_batop.c +++ b/gdk/gdk_batop.c @@ -1929,7 +1929,7 @@ BATkeyed(BAT *b) BAThash(b) == GDK_SUCCEED) || (/* DISABLES CODE */ (0) && VIEWtparent(b) != 0 && - BATcheckhash(BBPdescriptor(VIEWtparent(b) { + BATcheckhash(BBP_cache(VIEWtparent(b) { /* we already have a hash table on b, or b is * persistent and we could create a hash * table, or b is a view on a bat that already @@ -1939,7 +1939,7 @@ BATkeyed(BAT *b) MT_rwlock_rdlock(>thashlock); hs = b->thash; if (hs == NULL && VIEWtparent(b) != 0) { - BAT *b2 = BBPdescriptor(VIEWtparent(b)); + BAT *b2 = BBP_cache(VIEWtparent(b)); lo = b->tbaseoff - b2->tbaseoff; hs = b2->thash; } @@ -2445,7 +2445,7 @@ BATsort(BAT **sorted, BAT **order, BAT * return GDK_SUCCEED; } if (VIEWtparent(b)) { - pb = BBPdescriptor(VIEWtparent(b)); + pb = BBP_cache(VIEWtparent(b));
MonetDB: Jul2021 - small optimimization, ie no need to check for...
Changeset: 032b2107f7e2 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/032b2107f7e2 Modified Files: sql/storage/objectset.c sql/storage/store.c Branch: Jul2021 Log Message: small optimimization, ie no need to check for in transaction for new objects diffs (32 lines): diff --git a/sql/storage/objectset.c b/sql/storage/objectset.c --- a/sql/storage/objectset.c +++ b/sql/storage/objectset.c @@ -606,6 +606,8 @@ tc_commit_objectversion(sql_trans *tr, s ov->ts = commit_ts; change->committed = commit_ts < TRANSACTION_ID_BASE ? true: false; (void)oldest; + if (!tr->parent) + change->obj->new = 0; } else { os_rollback(ov, tr->store); @@ -1101,7 +1103,6 @@ os_obj_intransaction(objectset *os, stru versionhead *n = find_id(os, b->id); if (n) { - //objectversion *ov = get_valid_object_id(tr, n->ov); objectversion *ov = n->ov; if (ov && os_atmc_get_state(ov) == active && ov->ts == tr->tid) diff --git a/sql/storage/store.c b/sql/storage/store.c --- a/sql/storage/store.c +++ b/sql/storage/store.c @@ -2909,7 +2909,7 @@ new_table(sql_trans *tr, sql_table *t, s { int res = 0; t = find_sql_table(tr, t->s, t->base.name); /* could have changed by depending changes */ - if (!isLocalTemp(t) && !os_obj_intransaction(t->s->tables, tr, >base)) + if (!isLocalTemp(t) && !isNew(t) && !os_obj_intransaction(t->s->tables, tr, >base)) res = table_dup(tr, t, t->s, NULL, tres); else *tres = t; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list