MonetDB: Oct2014 - Better check whether imprints can be created.
Changeset: c9bff4383833 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c9bff4383833 Modified Files: gdk/gdk_imprints.c Branch: Oct2014 Log Message: Better check whether imprints can be created. And it's not an error if they can't. diffs (25 lines): diff --git a/gdk/gdk_imprints.c b/gdk/gdk_imprints.c --- a/gdk/gdk_imprints.c +++ b/gdk/gdk_imprints.c @@ -548,6 +548,12 @@ BATimprints(BAT *b) assert(BAThdense(b)); /* assert void head */ + /* we only create imprints for types that look like types we know */ + if (b-ttype != ATOMstorage(b-ttype) + (ATOMnilptr(b-ttype) != ATOMnilptr(ATOMstorage(b-ttype)) || +BATatoms[b-ttype].atomCmp != BATatoms[ATOMstorage(b-ttype)].atomCmp)) + return NULL;/* doesn't look enough like base type */ + switch (ATOMstorage(b-T-type)) { case TYPE_bte: case TYPE_sht: @@ -557,8 +563,6 @@ BATimprints(BAT *b) case TYPE_dbl: break; default:/* type not supported */ - GDKerror(#BATimprints: col type not -suitable for imprints index.\n); return NULL;/* do nothing */ } ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Oct2014 - Delete correct imprints files.
Changeset: c1a323ed3e43 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c1a323ed3e43 Modified Files: gdk/gdk_imprints.c Branch: Oct2014 Log Message: Delete correct imprints files. diffs (12 lines): diff --git a/gdk/gdk_imprints.c b/gdk/gdk_imprints.c --- a/gdk/gdk_imprints.c +++ b/gdk/gdk_imprints.c @@ -820,7 +820,7 @@ IMPSremove(BAT *b) if (imprints-imprints-storage != STORE_MEM) HEAPdelete(imprints-imprints, BBP_physical(b-batCacheid), - imprints); + b-batCacheid 0 ? timprints : himprints); else HEAPfree(imprints-imprints); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Oct2014 - Added some comments.
Changeset: a153b001d0b2 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a153b001d0b2 Modified Files: gdk/gdk_imprints.c Branch: Oct2014 Log Message: Added some comments. diffs (19 lines): diff --git a/gdk/gdk_imprints.c b/gdk/gdk_imprints.c --- a/gdk/gdk_imprints.c +++ b/gdk/gdk_imprints.c @@ -662,9 +662,12 @@ BATimprints(BAT *b) imprints-imprints-farmid = BBPselectfarm(TRANSIENT, b-ttype, imprintsheap); /* The heap we create here consists of three parts: -* bins, max 64 entries with bin boundaries; -* imps; -* dict. */ +* bins, max 64 entries with bin boundaries, domain of b; +* imps, max one entry per page, entry is bits wide; +* dict, max two entries per three pages. +* In addition, we add some housekeeping entries at +* the start so that we can determine whether we can +* trust the imprints when encountered on startup. */ if (HEAPalloc(imprints-imprints, 64 * b-T-width + pages * (imprints-bits / 8) + ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Oct2014 - Approve after changeset 882e12ddac9d.
Changeset: c9ce322da769 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c9ce322da769 Modified Files: clients/Tests/SQL-dump_all.stable.out clients/Tests/SQL-dump_all.stable.out.oid32 clients/Tests/SQL-dump_geom.stable.out clients/Tests/SQL-dump_geom.stable.out.32bit clients/Tests/SQL-dump_geom.stable.out.64bit.oid32 clients/Tests/SQL-dump_none.stable.out Branch: Oct2014 Log Message: Approve after changeset 882e12ddac9d. diffs (150 lines): diff --git a/clients/Tests/SQL-dump_all.stable.out b/clients/Tests/SQL-dump_all.stable.out --- a/clients/Tests/SQL-dump_all.stable.out +++ b/clients/Tests/SQL-dump_all.stable.out @@ -5318,8 +5318,8 @@ 5910 5909resultwrd 64 0 0 0 5911 5909val wrd 64 0 1 1 5914 5913resultbigint64 0 0 0 5915 5913val bigint64 0 1 1 -5918 5917resultdecimal 1 0 0 0 -5919 5917val decimal 1 0 1 1 +5918 5917resultdecimal 18 3 0 0 +5919 5917val decimal 18 3 1 1 5922 5921resultreal 24 0 0 0 5923 5921val real 24 0 1 1 5926 5925resultdouble53 0 0 0 @@ -5345,8 +5345,8 @@ 5959 5956q double53 0 1 2 5962 5961resultbigint64 0 0 0 5963 5961val bigint64 0 1 1 5964 5961q double53 0 1 2 -5967 5966resultdecimal 1 0 0 0 -5968 5966val decimal 1 0 1 1 +5967 5966resultdecimal 18 3 0 0 +5968 5966val decimal 18 3 1 1 5969 5966q double53 0 1 2 5972 5971resultreal 24 0 0 0 5973 5971val real 24 0 1 1 diff --git a/clients/Tests/SQL-dump_all.stable.out.oid32 b/clients/Tests/SQL-dump_all.stable.out.oid32 --- a/clients/Tests/SQL-dump_all.stable.out.oid32 +++ b/clients/Tests/SQL-dump_all.stable.out.oid32 @@ -5318,8 +5318,8 @@ 5910 5909resultwrd 64 0 0 0 5911 5909val wrd 64 0 1 1 5914 5913resultbigint64 0 0 0 5915 5913val bigint64 0 1 1 -5918 5917resultdecimal 1 0 0 0 -5919 5917val decimal 1 0 1 1 +5918 5917resultdecimal 18 3 0 0 +5919 5917val decimal 18 3 1 1 5922 5921resultreal 24 0 0 0 5923 5921val real 24 0 1 1 5926 5925resultdouble53 0 0 0 @@ -5345,8 +5345,8 @@ 5959 5956q double53 0 1 2 5962 5961resultbigint64 0 0 0 5963 5961val bigint64 0 1 1 5964 5961q double53 0 1 2 -5967 5966resultdecimal 1 0 0 0 -5968 5966val decimal 1 0 1 1 +5967 5966resultdecimal 18 3 0 0 +5968 5966val decimal 18 3 1 1 5969 5966q double53 0 1 2 5972 5971resultreal 24 0 0 0 5973 5971val real 24 0 1 1 diff --git a/clients/Tests/SQL-dump_geom.stable.out b/clients/Tests/SQL-dump_geom.stable.out --- a/clients/Tests/SQL-dump_geom.stable.out +++ b/clients/Tests/SQL-dump_geom.stable.out @@ -5243,8 +5243,8 @@ 5910 5909resultwrd 64 0 0 0 5911 5909val wrd 64 0 1 1 5914 5913resultbigint64 0 0 0 5915 5913val bigint64 0 1 1 -5918 5917resultdecimal 1 0 0 0 -5919 5917val decimal 1 0 1 1 +5918 5917resultdecimal 18 3 0 0 +5919 5917val decimal 18 3 1 1 5922 5921resultreal 24 0 0 0 5923 5921val real 24 0 1 1 5926 5925resultdouble53 0 0 0 @@ -5270,8 +5270,8 @@ 5959 5956q double53 0 1 2 5962 5961resultbigint64 0 0 0 5963 5961val bigint64 0 1 1 5964 5961q double53 0 1 2 -5967 5966
MonetDB: mosaic - Gather mosaic statistics on complete databases
Changeset: 1cebff7ea880 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1cebff7ea880 Added Files: monetdb5/modules/mal/Tests/mosaic_linear_subselect.stable.err monetdb5/modules/mal/Tests/mosaic_linear_subselect.stable.out Modified Files: monetdb5/modules/mal/Tests/mosaic_delta_joins.stable.out monetdb5/modules/mal/mosaic.c monetdb5/modules/mal/mosaic.mal monetdb5/modules/mal/mosaic_delta.c monetdb5/modules/mal/mosaic_dict.c monetdb5/modules/mal/mosaic_hdr.c monetdb5/modules/mal/mosaic_linear.c monetdb5/modules/mal/mosaic_rle.c monetdb5/optimizer/opt_mosaic.c Branch: mosaic Log Message: Gather mosaic statistics on complete databases diffs (truncated from 950 to 300 lines): diff --git a/monetdb5/modules/mal/Tests/mosaic_delta_joins.stable.out b/monetdb5/modules/mal/Tests/mosaic_delta_joins.stable.out --- a/monetdb5/modules/mal/Tests/mosaic_delta_joins.stable.out +++ b/monetdb5/modules/mal/Tests/mosaic_delta_joins.stable.out @@ -112,6 +112,8 @@ end main; # ht t # name # void voidvoid # type #--# +[ 0@0, 2@0,0@0 ] +[ 1@0, 3@0,1@0 ] #--# # ht t # name # void oid oid # type @@ -122,6 +124,8 @@ end main; # ht t # name # void voidvoid # type #--# +[ 0@0, 0@0,2@0 ] +[ 1@0, 1@0,3@0 ] # 19:38:40 # 19:38:40 Done. diff --git a/monetdb5/modules/mal/Tests/mosaic_linear_subselect.stable.err b/monetdb5/modules/mal/Tests/mosaic_linear_subselect.stable.err new file mode 100644 --- /dev/null +++ b/monetdb5/modules/mal/Tests/mosaic_linear_subselect.stable.err @@ -0,0 +1,30 @@ +stderr of test 'mosaic_linear_subselect` in directory 'monetdb5/modules/mal` itself: + + +# 11:03:45 +# 11:03:45 mserver5 --debug=10 --set gdk_nr_threads=0 --set mapi_open=true --set mapi_port=39740 --set mapi_usock=/var/tmp/mtest-12899/.s.monetdb.39740 --set monet_prompt= --forcemito --set mal_listing=2 --dbpath=/export/scratch1/mk/mosaic//Linux/var/MonetDB/mTests_monetdb5_modules_mal mosaic_linear_subselect.mal +# 11:03:45 + +# builtin opt gdk_dbpath = /export/scratch1/mk/mosaic//Linux/var/monetdb5/dbfarm/demo +# builtin opt gdk_debug = 0 +# builtin opt gdk_vmtrim = no +# builtin opt monet_prompt = +# builtin opt monet_daemon = no +# builtin opt mapi_port = 5 +# builtin opt mapi_open = false +# builtin opt mapi_autosense = false +# builtin opt sql_optimizer = default_pipe +# builtin opt sql_debug = 0 +# cmdline opt gdk_nr_threads = 0 +# cmdline opt mapi_open = true +# cmdline opt mapi_port = 39740 +# cmdline opt mapi_usock = /var/tmp/mtest-12899/.s.monetdb.39740 +# cmdline opt monet_prompt = +# cmdline opt mal_listing = 2 +# cmdline opt gdk_dbpath = /export/scratch1/mk/mosaic//Linux/var/MonetDB/mTests_monetdb5_modules_mal +# cmdline opt gdk_debug = 536870922 + +# 11:03:46 +# 11:03:46 Done. +# 11:03:46 + diff --git a/monetdb5/modules/mal/Tests/mosaic_linear_subselect.stable.out b/monetdb5/modules/mal/Tests/mosaic_linear_subselect.stable.out new file mode 100644 --- /dev/null +++ b/monetdb5/modules/mal/Tests/mosaic_linear_subselect.stable.out @@ -0,0 +1,246 @@ +stdout of test 'mosaic_linear_subselect` in directory 'monetdb5/modules/mal` itself: + + +# 11:03:45 +# 11:03:45 mserver5 --debug=10 --set gdk_nr_threads=0 --set mapi_open=true --set mapi_port=39740 --set mapi_usock=/var/tmp/mtest-12899/.s.monetdb.39740 --set monet_prompt= --forcemito --set mal_listing=2 --dbpath=/export/scratch1/mk/mosaic//Linux/var/MonetDB/mTests_monetdb5_modules_mal mosaic_linear_subselect.mal +# 11:03:45 + +# MonetDB 5 server v11.20.0 +# This is an unreleased version +# Serving database 'mTests_monetdb5_modules_mal', using 8 threads +# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs and 128bit integers dynamically linked +# Found 15.591 GiB available main-memory. +# Copyright (c) 1993-July 2008 CWI. +# Copyright (c) August 2008-2014 MonetDB B.V., all rights reserved +# Visit http://www.monetdb.org/ for further information +# Listening for connection requests on mapi:monetdb://vienna.ins.cwi.nl:39740/ +# Listening for UNIX domain connection requests on mapi:monetdb:///var/tmp/mtest-12899/.s.monetdb.39740 +# MonetDB/GIS module loaded +# MonetDB/SQL module loaded +function user.main():void; +# Linear range compressions +b := bat.new(:oid,:int); +bat.append(b,0); +bat.append(b,2); +bat.append(b,4); +bat.append(b,6); +bat.append(b,8); +bat.append(b,10); +bat.append(b,1); +bat.append(b,4); +bat.append(b,7); +bat.append(b,10); +bat.append(b,13); +bat.append(b,16); +io.print(b); +x := mosaic.compress(b,linear); +#mosaic.dump(x); +z := mosaic.decompress(x); +io.print(z); +s := algebra.subselect(b,0,4,false,false,false); +io.print(s); +xs :=
MonetDB: Oct2014 - Cleanup: remove unused macros, no magical num...
Changeset: 96ab180d1316 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=96ab180d1316 Modified Files: gdk/gdk_imprints.h Branch: Oct2014 Log Message: Cleanup: remove unused macros, no magical numbers. diffs (28 lines): diff --git a/gdk/gdk_imprints.h b/gdk/gdk_imprints.h --- a/gdk/gdk_imprints.h +++ b/gdk/gdk_imprints.h @@ -30,19 +30,12 @@ typedef struct { } cchdc_t; /* hard bounds */ -#define IMPS_MAX_CNT 16777215 -#define IMPS_PAGE 64 +#define IMPS_MAX_CNT ((1 24) - 1) /* 24 one bits */ +#define IMPS_PAGE 64 /* auxiliary macros */ -#define IMPScnt(X) ((X) 16777215) /* 24 bits for cnt */ -#define IMPSsetcnt(X,Y) ((X) = (Y)) /* no overflow check */ -#define IMPScnt_inc(X) ((X)++) /* no overflow check */ -#define IMPSrepeat(X)(((X) 16777216) != 0) -#define IMPSsetrepeat(X) ((X) |= 16777216) -#define IMPSunsetrepeat(X) ((X) = (~16777216)) -#define IMPSsetBit(B,X,Y) uint##B##_t)1)(Y))|(X)) -#define IMPSunsetBit(B,X,Y)((~(((uint##B##_t)1)(Y)))(X)) -#define IMPSisSet(B,X,Y) (uint##B##_t)1)Y)X) != 0) -#define IMPSmod2(X,Y)((X)((Y)-1)) +#define IMPSsetBit(B, X, Y)((X) | ((uint##B##_t) 1 (Y))) +#define IMPSunsetBit(B, X, Y) ((X) ~((uint##B##_t) 1 (Y))) +#define IMPSisSet(B, X, Y) (((X) ((uint##B##_t) 1 (Y))) != 0) #endif /* GDK_IMPS_H */ ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Oct2014 - Implemented persistent imprints.
Changeset: 757ca2e33646 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=757ca2e33646 Modified Files: gdk/gdk_bbp.c gdk/gdk_imprints.c Branch: Oct2014 Log Message: Implemented persistent imprints. Imprints are saved to disk when they are created, and used when found when imprints are requested. The start of the imprints heap contains some information with which it can be determined whether the imprint is valid. Saving is done in two stages: first the heap is written, and when that is successful, the first word of the file is overwritten with an indicator that the heap was written successfully. diffs (152 lines): diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -3777,6 +3777,12 @@ BBPdiskscan(const char *parent) } else if (strncmp(p + 1, thash, 5) == 0) { BAT *b = getdesc(bid); delete = (b == NULL || !b-T-hash); + } else if (strncmp(p + 1, himprints, 9) == 0) { + BAT *b = getdesc(bid); + delete = b == NULL; + } else if (strncmp(p + 1, timprints, 9) == 0) { + BAT *b = getdesc(bid); + delete = b == NULL; } else if (strncmp(p + 1, priv, 4) != 0 strncmp(p + 1, new, 3) != 0 strncmp(p + 1, head, 4) != 0 strncmp(p + 1, tail, 4) != 0) { ok = FALSE; } diff --git a/gdk/gdk_imprints.c b/gdk/gdk_imprints.c --- a/gdk/gdk_imprints.c +++ b/gdk/gdk_imprints.c @@ -587,6 +587,7 @@ BATimprints(BAT *b) BUN cnt; str nme = BBP_physical(b-batCacheid); size_t pages; + int fd; ALGODEBUG fprintf(stderr, #BATimprints(b=%s# BUNFMT ) %s: created imprints\n, BATgetId(b), @@ -599,6 +600,54 @@ BATimprints(BAT *b) BATimprints); return NULL; } + imprints-imprints = GDKzalloc(sizeof(Heap)); + if (imprints-imprints == NULL || + (imprints-imprints-filename = +GDKmalloc(strlen(nme) + 12)) == NULL) { + GDKfree(imprints-imprints); + GDKfree(imprints); + GDKerror(#BATimprints: memory allocation error.\n); + BBPunfix(smp-batCacheid); + MT_lock_unset(GDKimprintsLock(abs(b-batCacheid)), + BATimprints); + return NULL; + } + sprintf(imprints-imprints-filename, %s.%cimprints, nme, + b-batCacheid 0 ? 't' : 'h'); + pages = (((size_t) BATcount(b) * b-T-width) + IMPS_PAGE - 1) / IMPS_PAGE; + imprints-imprints-farmid = BBPselectfarm(PERSISTENT, b-ttype, + imprintsheap); + if ((fd = GDKfdlocate(imprints-imprints-farmid, nme, rb, + b-batCacheid 0 ? timprints : himprints)) = 0) { + size_t hdata[4]; + struct stat st; + if (read(fd, hdata, sizeof(hdata)) == sizeof(hdata) + hdata[0] ((size_t) 1 16) + hdata[3] == (size_t) BATcount(b) + fstat(fd, st) == 0 + st.st_size = (off_t) (imprints-imprints-size = imprints-imprints-free = 64 * b-T-width + + pages * ((bte) hdata[0] / 8) + + hdata[2] * sizeof(cchdc_t) + + sizeof(uint64_t) /* padding for alignment */ + + 4 * SIZEOF_SIZE_T) + HEAPload(imprints-imprints, nme, b-batCacheid 0 ? timprints : himprints, 0) = 0) { + /* usable */ + imprints-bits = (bte) (hdata[0] 0xFF); + imprints-impcnt = (BUN) hdata[1]; + imprints-dictcnt = (BUN) hdata[2]; + imprints-bins = imprints-imprints-base + 4 * SIZEOF_SIZE_T; + imprints-imps = (char *) imprints-bins + 64 * b-T-width; + imprints-dict = (void *) ((size_t) ((char *) imprints-imps + pages * (imprints-bits / 8) + sizeof(uint64_t)) ~(sizeof(uint64_t) - 1)); + b-T-imprints = imprints; + close(fd); + goto do_return; + } + close(fd); + /* file exists, but can't be used: delete it */ +
MonetDB: Oct2014 - IMPSdestroy is not used outside the GDK.
Changeset: 5552db19c19c for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5552db19c19c Modified Files: clients/Tests/exports.stable.out gdk/gdk.h gdk/gdk_private.h Branch: Oct2014 Log Message: IMPSdestroy is not used outside the GDK. diffs (34 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 @@ -299,7 +299,6 @@ int HEAPextend(Heap *h, size_t size, int int HEAPfree(Heap *h); size_t HEAPmemsize(Heap *h); size_t HEAPvmsize(Heap *h); -void IMPSdestroy(BAT *b); lng IMPSimprintsize(BAT *b); void MRschedule(int taskcnt, void **arg, void( *cmd)(void *p)); int MT_check_nr_cores(void); diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -2175,7 +2175,6 @@ gdk_export BAT *BAThash(BAT *b, BUN mask * */ -gdk_export void IMPSdestroy(BAT *b); gdk_export BAT *BATimprints(BAT *b); gdk_export lng IMPSimprintsize(BAT *b); diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h --- a/gdk/gdk_private.h +++ b/gdk/gdk_private.h @@ -160,6 +160,8 @@ int HEAPshrink(Heap *h, size_t size) __attribute__((__visibility__(hidden))); int HEAPwarm(Heap *h) __attribute__((__visibility__(hidden))); +void IMPSdestroy(BAT *b) + __attribute__((__visibility__(hidden))); oid MAXoid(BAT *i) __attribute__((__visibility__(hidden))); void MT_global_exit(int status) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Oct2014 - Avoid loop, use a single expression to set bi...
Changeset: 50b7b59af500 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=50b7b59af500 Modified Files: gdk/gdk_select.c Branch: Oct2014 Log Message: Avoid loop, use a single expression to set bits in bit mask. diffs (25 lines): diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c --- a/gdk/gdk_select.c +++ b/gdk/gdk_select.c @@ -251,13 +251,18 @@ do { \ do { \ uint##B##_t *im = (uint##B##_t *) imprints-imps; \ uint##B##_t mask = 0, innermask;\ - int j, lbin, hbin; \ + int lbin, hbin; \ lbin = IMPSgetbin(ATOMstorage(b-ttype), imprints-bits,\ imprints-bins, tl); \ hbin = IMPSgetbin(ATOMstorage(b-ttype), imprints-bits,\ imprints-bins, th); \ - for (j = lbin; j = hbin; j++) \ - mask = IMPSsetBit(B, mask, j); \ + /* note: (1n)-1 gives a sequence o n one bits */ \ + /* to set bits hbin..lbin inclusive, we would do: */\ + /* mask = ((1 (hbin + 1)) - 1) - ((1 lbin) - 1); */ \ + /* except ((1 (hbin + 1)) - 1) is not defined if */ \ + /* hbin == sizeof(uint##B##_t)*8 - 1 */ \ + /* the following does work, however */ \ + mask = (uint##B##_t) 1 hbin) - 1) 1) | 1) - (((uint##B##_t) 1 lbin) - 1); \ innermask = mask; \ if (!b-T-nonil || vl != minval) \ innermask = IMPSunsetBit(B, innermask, lbin); \ ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: mosaic - added parsing of INSERT ONLY
Changeset: e9bdcf3cf60c for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e9bdcf3cf60c Modified Files: sql/backends/monet5/rel_bin.c sql/backends/monet5/sql.c sql/include/sql_catalog.h sql/scripts/75_storagemodel.sql sql/server/rel_schema.c sql/server/rel_trans.h sql/server/rel_updates.c sql/server/sql_mvc.c sql/server/sql_mvc.h sql/server/sql_parser.h sql/server/sql_parser.y sql/server/sql_scan.c sql/storage/bat/bat_storage.c sql/storage/sql_storage.h sql/storage/store.c Branch: mosaic Log Message: added parsing of INSERT ONLY added parsing and initial handling (ie storing only) of alter table table_NAME alter column column_Name set storage 'storage string'; Sofar only the storage string is saved. Next step is to call the proper compression algo's. diffs (truncated from 576 to 300 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 @@ -731,7 +731,7 @@ stmt_col( mvc *sql, sql_column *c, stmt { stmt *sc = stmt_bat(sql-sa, c, RDONLY); - if (isTable(c-t) !c-t-readonly + if (isTable(c-t) c-t-access != TABLE_READONLY (c-base.flag != TR_NEW || c-t-base.flag != TR_NEW /* alter */) (c-t-persistence == SQL_PERSIST || c-t-persistence == SQL_DECLARED_TABLE) !c-t-commit_action) { stmt *i = stmt_bat(sql-sa, c, RD_INS); @@ -749,7 +749,7 @@ stmt_idx( mvc *sql, sql_idx *i, stmt *de { stmt *sc = stmt_idxbat(sql-sa, i, RDONLY); - if (isTable(i-t) !i-t-readonly + if (isTable(i-t) i-t-access != TABLE_READONLY (i-base.flag != TR_NEW || i-t-base.flag != TR_NEW /* alter */) (i-t-persistence == SQL_PERSIST || i-t-persistence == SQL_DECLARED_TABLE) !i-t-commit_action) { stmt *ic = stmt_idxbat(sql-sa, i, RD_INS); diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c --- a/sql/backends/monet5/sql.c +++ b/sql/backends/monet5/sql.c @@ -534,10 +534,10 @@ alter_table(mvc *sql, char *sname, sql_t } } - if (t-readonly != nt-readonly) { - if (t-readonly table_has_updates(sql-session-tr, nt)) - return sql_message(4!ALTER TABLE: set READONLY not possible with outstanding updates (wait until updates are flushed)\n); - mvc_readonly(sql, nt, t-readonly); + if (t-access != nt-access) { + if (t-access table_has_updates(sql-session-tr, nt)) + return sql_message(4!ALTER TABLE: set READ or INSERT ONLY not possible with outstanding updates (wait until updates are flushed)\n); + mvc_access(sql, nt, t-access); } /* check for changes */ @@ -583,6 +583,10 @@ alter_table(mvc *sql, char *sname, sql_t } if (c-def != nc-def) mvc_default(sql, nc, c-def); + if (c-storage_type != nc-storage_type) { + /* TODO here we should call the storage related functions */ + mvc_storage(sql, nc, c-storage_type); + } } for (; n; n = n-next) { /* propagate alter table .. add column */ @@ -2205,7 +2209,7 @@ SQLtid(Client cntxt, MalBlkPtr mb, MalSt nr = store_funcs.count_col(tr, c, 1); - if (isTable(t) !t-readonly (t-base.flag != TR_NEW /* alter */ ) + if (isTable(t) t-access == TABLE_WRITABLE (t-base.flag != TR_NEW /* alter */ ) t-persistence == SQL_PERSIST !t-commit_action) inr = store_funcs.count_col(tr, c, 0); nr -= inr; @@ -3967,7 +3971,7 @@ SQLcompress(Client cntxt, MalBlkPtr mb, t = mvc_bind_table(m, s, *tbl); if (t == NULL) throw(SQL, sql.compress, 42S02!Table missing); - if ( !t-readonly) + if (t-access != TABLE_READONLY) throw(SQL, sql.compress, !Table must be read only); tr = m-session-tr; t-base.wtime = s-base.wtime = tr-wtime = tr-wstime; @@ -3991,11 +3995,11 @@ SQLcompress(Client cntxt, MalBlkPtr mb, d = c-data; if (d-bid) BBPdecref(d-bid, TRUE); - if (d-ibid) - BBPdecref(d-ibid, TRUE); - d-bid = 0; + //if (d-ibid) + //BBPdecref(d-ibid, TRUE); + d-bid = bid; d-ibase = 0; - d-ibid = bid; /* use the insert bat */ + //d-ibid = 0; /* use the insert bat */ c-base.wtime = tr-wstime; c-base.rtime = tr-stime; } @@ -4029,7 +4033,7 @@ SQLdecompress(Client cntxt, MalBlkPtr mb t = mvc_bind_table(m, s, *tbl); if (t == NULL)
MonetDB: Oct2014 - Remove unneeded cleanup.
Changeset: 40b4c4a19c7a for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=40b4c4a19c7a Modified Files: gdk/gdk_imprints.c Branch: Oct2014 Log Message: Remove unneeded cleanup. diffs (11 lines): diff --git a/gdk/gdk_imprints.c b/gdk/gdk_imprints.c --- a/gdk/gdk_imprints.c +++ b/gdk/gdk_imprints.c @@ -607,7 +607,6 @@ BATimprints(BAT *b) GDKfree(imprints-imprints); GDKfree(imprints); GDKerror(#BATimprints: memory allocation error.\n); - BBPunfix(smp-batCacheid); MT_lock_unset(GDKimprintsLock(abs(b-batCacheid)), BATimprints); return NULL; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: mosaic - call MOScompressInternal
Changeset: 1e94fe1a63af for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1e94fe1a63af Modified Files: sql/backends/monet5/sql.c Branch: mosaic Log Message: call MOScompressInternal diffs (47 lines): diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c --- a/sql/backends/monet5/sql.c +++ b/sql/backends/monet5/sql.c @@ -48,6 +48,7 @@ # include rdf.h #endif #include mal_instruction.h +#include mosaic.h static int rel_is_table(sql_rel *rel) @@ -506,7 +507,7 @@ table_has_updates(sql_trans *tr, sql_tab } static str -alter_table(mvc *sql, char *sname, sql_table *t) +alter_table(Client cntxt, mvc *sql, char *sname, sql_table *t) { sql_schema *s = mvc_bind_schema(sql, sname); sql_table *nt = NULL; @@ -583,8 +584,16 @@ alter_table(mvc *sql, char *sname, sql_t } if (c-def != nc-def) mvc_default(sql, nc, c-def); + if (c-storage_type != nc-storage_type) { - /* TODO here we should call the storage related functions */ + bat bid = 0; + BAT *b = store_funcs.bind_col(sql-session-tr, nc, 0); + sql_delta *d; + char *msg = MOScompressInternal(cntxt, bid, b-batCacheid, c-storage_type); + if (msg) + return msg; + d = nc-data; + d-bid = bid; mvc_storage(sql, nc, c-storage_type); } } @@ -1093,7 +1102,7 @@ SQLcatalog(Client cntxt, MalBlkPtr mb, M } case DDL_ALTER_TABLE:{ sql_table *t = *(sql_table **) getArgReference(stk, pci, 3); - msg = alter_table(sql, sname, t); + msg = alter_table(cntxt, sql, sname, t); break; } case DDL_CREATE_TYPE:{ ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list