Changeset: ed74c966801b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/ed74c966801b Modified Files: clients/Tests/exports.stable.out gdk/gdk_bat.c gdk/gdk_bbp.c gdk/gdk_calc.c gdk/gdk_hash.c gdk/gdk_hash.h gdk/gdk_join.c gdk/gdk_private.h gdk/gdk_select.c monetdb5/mal/CMakeLists.txt monetdb5/mal/mal_private.h monetdb5/modules/mal/mkey.c monetdb5/modules/mal/tracer.c sql/backends/monet5/sql.c sql/backends/monet5/sql_upgrades.c sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64.int128 sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade/Tests/upgrade.stable.out sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.32bit sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade/Tests/upgrade.stable.out sql/test/testdb-upgrade/Tests/upgrade.stable.out.32bit sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128 testing/Mz.py.in testing/sqllogictest.py Branch: default Log Message:
Merge with Jul2021 branch. diffs (truncated from 114122 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 @@ -331,6 +331,7 @@ gdk_return GDKtracer_set_adapter(const c gdk_return GDKtracer_set_component_level(const char *comp, const char *lvl); gdk_return GDKtracer_set_flush_level(const char *lvl); gdk_return GDKtracer_set_layer_level(const char *layer, const char *lvl); +gdk_return GDKtracer_set_tracefile(const char *tracefile); gdk_return GDKtracer_stop(void); size_t GDKuniqueid(size_t offset); gdk_return GDKupgradevarheap(BAT *b, var_t v, BUN cap, bool copyall) __attribute__((__warn_unused_result__)); @@ -895,6 +896,7 @@ const char *columnRef; const char *comment_onRef; const char *commitRef; str compileString(Symbol *fcn, Client c, str s); +char *concatErrors(char *err1, const char *err2) __attribute__((__nonnull__(1, 2))) __attribute__((__returns_nonnull__)); const char *connectRef; const char *contextRef; str convertConstant(malType type, ValPtr vr); diff --git a/clients/mapilib/monetdb-mapi.pc.in b/clients/mapilib/monetdb-mapi.pc.in --- a/clients/mapilib/monetdb-mapi.pc.in +++ b/clients/mapilib/monetdb-mapi.pc.in @@ -4,11 +4,15 @@ # # Copyright 1997 - July 2008 CWI, August 2008 - 2021 MonetDB B.V. +prefix=@CMAKE_INSTALL_PREFIX@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ + Name: monetdb-mapi Description: MonetDB MAPI C-client libary URL: https://www.monetdb.org/ Version: @MONETDB_VERSION@ Requires.private: monetdb-stream = @MONETDB_VERSION@ openssl -Libs: -L@CMAKE_INSTALL_FULL_LIBDIR@ -lmapi -Cflags: -I@CMAKE_INSTALL_FULL_INCLUDEDIR@/monetdb +Libs: -L${libdir} -lmapi +Cflags: -I${includedir}/monetdb diff --git a/common/stream/monetdb-stream.pc.in b/common/stream/monetdb-stream.pc.in --- a/common/stream/monetdb-stream.pc.in +++ b/common/stream/monetdb-stream.pc.in @@ -4,12 +4,16 @@ # # Copyright 1997 - July 2008 CWI, August 2008 - 2021 MonetDB B.V. +prefix=@CMAKE_INSTALL_PREFIX@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ + Name: monetdb-stream Description: MonetDB streams libary URL: https://www.monetdb.org/ Version: @MONETDB_VERSION@ Requires.private: @PKG_ZLIB@ @PKG_BZIP2@ @PKG_CURL@ @PKG_LZMA@ @PKG_SNAPPY@ -Libs: -L@CMAKE_INSTALL_FULL_LIBDIR@ -lstream +Libs: -L${libdir} -lstream Libs.private: @SOCKET_LIBS@ @PKG_LIBICONV@ -Cflags: -I@CMAKE_INSTALL_FULL_INCLUDEDIR@/monetdb +Cflags: -I${includedir}/monetdb diff --git a/ctest/monetdb5/mal/test_malEmbeddedBoot.c b/ctest/monetdb5/mal/test_malEmbeddedBoot.c --- a/ctest/monetdb5/mal/test_malEmbeddedBoot.c +++ b/ctest/monetdb5/mal/test_malEmbeddedBoot.c @@ -17,8 +17,8 @@ main(void) gdk_return gdk_res; gdk_res = GDKinit(NULL, 0, true); - if (gdk_res == GDK_FAIL) { - msg = createException(MAL, "embedded.monetdb_startup", "GDKinit() failed"); + if (gdk_res != GDK_SUCCEED) { + msg = createException(MAL, "embedded.monetdb_startup", "GDKinit() failed"); return 1; } if ((msg = malEmbeddedBoot(0, 0, 0, 0, 0)) != MAL_SUCCEED) diff --git a/ctest/monetdb5/mal/test_malInclude.c b/ctest/monetdb5/mal/test_malInclude.c --- a/ctest/monetdb5/mal/test_malInclude.c +++ b/ctest/monetdb5/mal/test_malInclude.c @@ -18,8 +18,8 @@ main(void) gdk_return gdk_res; gdk_res = GDKinit(NULL, 0, true); - if (gdk_res == GDK_FAIL) { - createException(MAL, "embedded.monetdb_startup", "GDKinit() failed"); + if (gdk_res != GDK_SUCCEED) { + createException(MAL, "embedded.monetdb_startup", "GDKinit() failed"); return 1; } char *modules[2]; diff --git a/ctest/tools/monetdbe/example_copy.c b/ctest/tools/monetdbe/example_copy.c --- a/ctest/tools/monetdbe/example_copy.c +++ b/ctest/tools/monetdbe/example_copy.c @@ -35,14 +35,14 @@ main(void) error(err) // Get working directory and construct the CSV path - if (getcwd(csv_path, sizeof(csv_path)) == NULL) { + if (getcwd(csv_path, sizeof(csv_path)) == NULL) { error("Could not get the current working directory"); - } + } strcat(csv_path, "/test.csv"); - strcpy(sql, "COPY SELECT * FROM test INTO '"); - strcat(sql, csv_path); - strcat(sql, "' USING DELIMITERS ','"); + strcpy(sql, "COPY SELECT * FROM test INTO '"); + strcat(sql, csv_path); + strcat(sql, "' USING DELIMITERS ','"); if ((err = monetdbe_query(mdbe, sql, NULL, NULL)) != NULL) error(err) @@ -54,8 +54,8 @@ main(void) memset(sql, 0, 1000); strcpy(sql, "COPY INTO test_copy FROM '"); - strcat(sql, csv_path); - strcat(sql, "' DELIMITERS ','"); + strcat(sql, csv_path); + strcat(sql, "' DELIMITERS ','"); if ((err = monetdbe_query(mdbe, sql, NULL, NULL)) != NULL) { delete_file(csv_path) @@ -74,6 +74,8 @@ main(void) delete_file(csv_path) + if ((err = monetdbe_cleanup_result(mdbe, result)) != NULL) + error(err) if (monetdbe_close(mdbe)) error("Failed to close database"); diff --git a/documentation/monetdbe/introduction.rst b/documentation/monetdbe/introduction.rst --- a/documentation/monetdbe/introduction.rst +++ b/documentation/monetdbe/introduction.rst @@ -49,7 +49,7 @@ A single library to be linked into the a . Full use of the multi-core architectures. . Seamless integration with the application. . Single user control over the resources. -. Working with :memory: databases with controlled RAM footprint. +. Working with in-memory databases with controlled RAM footprint. . Boosting your data analytics .. image:: architecture.png @@ -67,11 +67,11 @@ What to expect? --------------- The MonetDBe library supports three different storage schemes. -A light-weight scheme for small databases confined to main memory, i.e. connect(':memory:'). +A light-weight scheme for small databases confined to main memory, i.e. connect('in-memory'). The maximum footprint can be set explicitly or is derived from the host (VM) resource limits. Using a directory on your local machine is the way to go if you need persistence, but with exclusive access as it concerns ACID properties. If the application works -with :memory: or a local database then switching to a MonetDB server merely +with in-memory or a local database then switching to a MonetDB server merely requires the connect call to be provided with the access point information. The MonetDBe code is available from the development branch of MonetDB as an **alpha-release**.. diff --git a/documentation/monetdbe/monetdbe_api.rst b/documentation/monetdbe/monetdbe_api.rst --- a/documentation/monetdbe/monetdbe_api.rst +++ b/documentation/monetdbe/monetdbe_api.rst @@ -9,10 +9,10 @@ If all went well they return a NULL. Oth General considerations ---------------------- -There can be a single :memory: database or local persistent database open at a time. +There can be a single in-memory database or local persistent database open at a time. The database location should be passed as a full path. Relative paths are currently not supported. -As soon as you create a connection with another database, the content of the :memory: data store is lost. +As soon as you create a connection with another database, the content of the in-memory data store is lost. MonetDB/e can also be used as a proxy to a remote database. It is possible to have multiple such connections open. @@ -21,31 +21,33 @@ Data Types The API wraps the internal data types to those more convenient for programming directly in C. -| MonetDBe type | MonetDB internal type | -| ----------------------- | --------------------- | -| int8_t | bool| -| int8_t | int8_t| -| int16_t | int16_t| -| int32_t | int32_t| -| int64_t | int64_t| -| __int128 | int128_t| -| float | float| -| double | double| -| char * | str| -| monetdbe_data_blob | blob| -| monetdbe_data_date | date| -| monetdbe_data_time | time| -| monetdbe_data_timestamp | timestamp| -| ----------------------- | --------------------- | +======================= ===================== +MonetDBe type MonetDB internal type +======================= ===================== +int8_t bool +int8_t int8_t +int16_t int16_t +int32_t int32_t +int64_t int64_t +__int128 int128_t +float float +double double +char * str +monetdbe_data_blob blob +monetdbe_data_date date +monetdbe_data_time time +monetdbe_data_timestamp timestamp +======================= ===================== Connection and server options ----------------------------- .. c:function:: int monetdbe_open(monetdbe_database *db, char *url, monetdbe_options *options) - Initialize a monetdbe_database structure. The database of interest is denoted by an url and denote either ':memory:', /fullpath/directory, - mapi:monetdb://company.nl:50000/database. The latter refers to a MonetDB server location. - The :memory: and local path options lead to an exclusive lock on the database storage.. + Initialize a monetdbe_database structure. The database of interest is denoted by an url and denote either ``NULL``, /fullpath/directory, + mapi:monetdb://company.nl:50000/database. The latter refers to a + MonetDB server location. The value ``NULL`` denotes an in-memory database. + The ``NULL`` and local path options lead to an exclusive lock on the database storage. Opening the same database multiple times concurrently is allowed, but opening another one concurrently will throw an error for now. There may be multiple connections to multiple MonetDB servers. @@ -53,7 +55,7 @@ Connection and server options Close the database handler and release the resources for another database connection. From here on the connection can not be used anymore to pass queries and any pending result set is cleaned up. - Be aware that the content of an ':memory:' database is discarded. + Be aware that the content of an 'in-memory' database is discarded. Transaction management ---------------------- @@ -120,7 +122,7 @@ Backup and restore ------------------ .. c:function:: char* monetdbe_dump_database(monetdbe_database db, char *backupfile); - Dump a :memory: database as a collection of SQL statements on a local file + Dump a in-memory database as a collection of SQL statements on a local file .. c:function:: char* monetdbe_dump_table(monetdbe_database db, const char *schema_name, const char *table_name, const char *backupfile); @@ -128,7 +130,7 @@ Backup and restore .. c:function:: char* monetdbe_restore(monetdbe_database db, char *localfile); - [TODO] Restore a SQL dump to initialize the ':memory:' case. This is similar to loading a SQL script. + [TODO] Restore a SQL dump to initialize the 'in-memory' case. This is similar to loading a SQL script. Miscellaneous ------------- diff --git a/gdk/gdk_analytic_func.c b/gdk/gdk_analytic_func.c --- a/gdk/gdk_analytic_func.c +++ b/gdk/gdk_analytic_func.c @@ -89,14 +89,14 @@ ntile##IMP##TPE: \ #define ANALYTICAL_NTILE_SINGLE_IMP(TPE, LNG_HGE, UPCAST) \ do { \ TPE ntl = *(TPE*) ntile; \ - if (!is_##TPE##_nil(ntl) && ntl < 0) goto invalidntile; \ + if (!is_##TPE##_nil(ntl) && ntl <= 0) goto invalidntile; \ ANALYTICAL_NTILE(SINGLE, TPE, ntl, LNG_HGE, UPCAST, ;); \ } while (0) #define ANALYTICAL_NTILE_MULTI_IMP(TPE, LNG_HGE, UPCAST) \ do { \ TPE *restrict nn = (TPE*)Tloc(n, 0); \ - ANALYTICAL_NTILE(MULTI, TPE, nn[k], LNG_HGE, UPCAST, if (val < 0) goto invalidntile;); \ + ANALYTICAL_NTILE(MULTI, TPE, nn[k], LNG_HGE, UPCAST, if (val <= 0) goto invalidntile;); \ } while (0) gdk_return @@ -1838,7 +1838,7 @@ GDKanalyticalsum(BAT *r, BAT *p, BAT *o, bailout: GDKerror("42000!error while calculating floating-point sum\n"); res = GDK_FAIL; - goto cleanup; + goto cleanup; calc_overflow: GDKerror("22003!overflow in calculation.\n"); res = GDK_FAIL; diff --git a/gdk/gdk_atoms.c b/gdk/gdk_atoms.c --- a/gdk/gdk_atoms.c +++ b/gdk/gdk_atoms.c @@ -914,9 +914,10 @@ mskWrite(const msk *a, stream *s, size_t } static void * -mskRead(msk *a, size_t *dstlen, stream *s, size_t cnt) +mskRead(msk *A, size_t *dstlen, stream *s, size_t cnt) { int8_t v; + msk *a = A; if (cnt != 1) return NULL; if (a == NULL || *dstlen == 0) { @@ -924,8 +925,11 @@ mskRead(msk *a, size_t *dstlen, stream * _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list