Changeset: 8bb4a9ab371c for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/8bb4a9ab371c Modified Files: clients/Tests/exports.stable.out gdk/gdk_utils.c monetdb5/mal/mal_interpreter.c monetdb5/modules/mal/mal_mapi.c monetdb5/modules/mal/remote.c sql/backends/monet5/UDF/capi/capi.c sql/backends/monet5/sql.c sql/backends/monet5/sql_rank.c sql/backends/monet5/sql_scenario.c sql/storage/store.c Branch: resource_management Log Message:
merge with default diffs (truncated from 3662 to 300 lines): diff --git a/clients/Tests/MAL-signatures-hge.test b/clients/Tests/MAL-signatures-hge.test --- a/clients/Tests/MAL-signatures-hge.test +++ b/clients/Tests/MAL-signatures-hge.test @@ -46584,11 +46584,6 @@ pattern io.printf(X_0:streams, X_1:str, IOprintfStream; Select default format io -setmallocsuccesscount -command io.setmallocsuccesscount(X_0:lng):void -IOsetmallocsuccesscount; -Set number of mallocs that are allowed to succeed. -io stdin pattern io.stdin():bstream io_stdin; @@ -47362,7 +47357,7 @@ mmath atan2 command mmath.atan2(X_0:dbl, X_1:dbl):dbl MATHbinary_ATAN2dbl; -The atan2(x,y) function calculates the arc tangent of the two @variables x and y. It is similar to calculating the arc@tangent of y / x, except that the signs of both arguments are @used to determine the quadrant of the result. The value is @returned in radians and is mathematically defined to be between @-PI/2 and PI/2 (inclusive). +The atan2(x,y) function calculates the arc tangent of the two @variables x and y. It is similar to calculating the arc@tangent of y / x, except that the signs of both arguments are @used to determine the quadrant of the result. The value is @returned in radians and is mathematically defined to be between @-PI/2 and PI/2 (inclusive). mmath atan2 command mmath.atan2(X_0:flt, X_1:flt):flt @@ -47402,7 +47397,7 @@ mmath cosh command mmath.cosh(X_0:dbl):dbl MATHunary_COSHdbl; -The cosh() function returns the hyperbolic cosine of x, which is @defined mathematically as (exp(x) + exp(-x)) / 2. +The cosh() function returns the hyperbolic cosine of x, which is @defined mathematically as (exp(x) + exp(-x)) / 2. mmath cosh command mmath.cosh(X_0:flt):flt @@ -47442,7 +47437,7 @@ mmath fabs command mmath.fabs(X_0:dbl):dbl MATHunary_FABSdbl; -The fabs(x) function returns the absolute value of the @floating-point number x. +The fabs(x) function returns the absolute value of the floating-point number x. mmath finite command mmath.finite(X_0:dbl):bit @@ -47522,12 +47517,12 @@ mmath nextafter command mmath.nextafter(X_0:dbl, X_1:dbl):dbl MATHbinary_NEXTAFTERdbl; -The returns the next representable floating-point value of x in the direction of y. +The nextafter(x,y) function returns the next representable floating-point value of x in the direction of y. mmath nextafter command mmath.nextafter(X_0:flt, X_1:flt):flt MATHbinary_NEXTAFTERflt; -The returns the next representable floating-point value of x in the direction of y. +The nextafter(x,y) function returns the next representable floating-point value of x in the direction of y. mmath pi command mmath.pi():dbl @@ -47537,7 +47532,7 @@ mmath pow command mmath.pow(X_0:dbl, X_1:dbl):dbl MATHbinary_POWdbl; -The pow(x,y) function returns the value of x raised to the power of y. +The pow(x,y) function returns the value of x raised to the power of y. mmath pow command mmath.pow(X_0:flt, X_1:flt):flt @@ -47587,7 +47582,7 @@ mmath sinh command mmath.sinh(X_0:dbl):dbl MATHunary_SINHdbl; -The sinh() function returns the hyperbolic sine of x, which @is defined mathematically as (exp(x) - exp(-x)) / 2. +The sinh() function returns the hyperbolic sine of x, which is @defined mathematically as (exp(x) - exp(-x)) / 2. mmath sinh command mmath.sinh(X_0:flt):flt diff --git a/clients/Tests/MAL-signatures.test b/clients/Tests/MAL-signatures.test --- a/clients/Tests/MAL-signatures.test +++ b/clients/Tests/MAL-signatures.test @@ -35074,11 +35074,6 @@ pattern io.printf(X_0:streams, X_1:str, IOprintfStream; Select default format io -setmallocsuccesscount -command io.setmallocsuccesscount(X_0:lng):void -IOsetmallocsuccesscount; -Set number of mallocs that are allowed to succeed. -io stdin pattern io.stdin():bstream io_stdin; @@ -35832,7 +35827,7 @@ mmath atan2 command mmath.atan2(X_0:dbl, X_1:dbl):dbl MATHbinary_ATAN2dbl; -The atan2(x,y) function calculates the arc tangent of the two @variables x and y. It is similar to calculating the arc@tangent of y / x, except that the signs of both arguments are @used to determine the quadrant of the result. The value is @returned in radians and is mathematically defined to be between @-PI/2 and PI/2 (inclusive). +The atan2(x,y) function calculates the arc tangent of the two @variables x and y. It is similar to calculating the arc@tangent of y / x, except that the signs of both arguments are @used to determine the quadrant of the result. The value is @returned in radians and is mathematically defined to be between @-PI/2 and PI/2 (inclusive). mmath atan2 command mmath.atan2(X_0:flt, X_1:flt):flt @@ -35872,7 +35867,7 @@ mmath cosh command mmath.cosh(X_0:dbl):dbl MATHunary_COSHdbl; -The cosh() function returns the hyperbolic cosine of x, which is @defined mathematically as (exp(x) + exp(-x)) / 2. +The cosh() function returns the hyperbolic cosine of x, which is @defined mathematically as (exp(x) + exp(-x)) / 2. mmath cosh command mmath.cosh(X_0:flt):flt @@ -35912,7 +35907,7 @@ mmath fabs command mmath.fabs(X_0:dbl):dbl MATHunary_FABSdbl; -The fabs(x) function returns the absolute value of the @floating-point number x. +The fabs(x) function returns the absolute value of the floating-point number x. mmath finite command mmath.finite(X_0:dbl):bit @@ -35992,12 +35987,12 @@ mmath nextafter command mmath.nextafter(X_0:dbl, X_1:dbl):dbl MATHbinary_NEXTAFTERdbl; -The returns the next representable floating-point value of x in the direction of y. +The nextafter(x,y) function returns the next representable floating-point value of x in the direction of y. mmath nextafter command mmath.nextafter(X_0:flt, X_1:flt):flt MATHbinary_NEXTAFTERflt; -The returns the next representable floating-point value of x in the direction of y. +The nextafter(x,y) function returns the next representable floating-point value of x in the direction of y. mmath pi command mmath.pi():dbl @@ -36007,7 +36002,7 @@ mmath pow command mmath.pow(X_0:dbl, X_1:dbl):dbl MATHbinary_POWdbl; -The pow(x,y) function returns the value of x raised to the power of y. +The pow(x,y) function returns the value of x raised to the power of y. mmath pow command mmath.pow(X_0:flt, X_1:flt):flt @@ -36057,7 +36052,7 @@ mmath sinh command mmath.sinh(X_0:dbl):dbl MATHunary_SINHdbl; -The sinh() function returns the hyperbolic sine of x, which @is defined mathematically as (exp(x) - exp(-x)) / 2. +The sinh() function returns the hyperbolic sine of x, which is @defined mathematically as (exp(x) - exp(-x)) / 2. mmath sinh command mmath.sinh(X_0:flt):flt 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 @@ -319,7 +319,6 @@ void GDKreset(int status); void GDKsetbuf(char *); void GDKsetdebug(unsigned debug); gdk_return GDKsetenv(const char *name, const char *value); -void GDKsetmallocsuccesscount(lng count); stream *GDKstdin; stream *GDKstdout; ssize_t GDKstrFromStr(unsigned char *restrict dst, const unsigned char *restrict src, ssize_t len, char quote); @@ -719,6 +718,7 @@ MapiMsg mapi_seek_row(MapiHdl hdl, int64 MapiHdl mapi_send(Mapi mid, const char *cmd) __attribute__((__nonnull__(1))); MapiMsg mapi_setAutocommit(Mapi mid, bool autocommit) __attribute__((__nonnull__(1))); MapiMsg mapi_set_columnar_protocol(Mapi mid, bool columnar_protocol) __attribute__((__nonnull__(1))); +MapiMsg mapi_set_rtimeout(Mapi mid, unsigned int timeout, bool (*callback)(void *), void *callback_data) __attribute__((__nonnull__(1))); MapiMsg mapi_set_size_header(Mapi mid, bool value) __attribute__((__nonnull__(1))); MapiMsg mapi_set_time_zone(Mapi mid, int seconds_east_of_utc) __attribute__((__nonnull__(1))); MapiMsg mapi_set_timeout(Mapi mid, unsigned int timeout, bool (*callback)(void *), void *callback_data) __attribute__((__nonnull__(1))); @@ -1741,6 +1741,7 @@ int mnstr_readStr(stream *restrict s, ch ssize_t mnstr_read_block(stream *restrict s, void *restrict buf, size_t elmsize, size_t cnt); ssize_t mnstr_readline(stream *restrict s, void *restrict buf, size_t maxcnt); void mnstr_set_bigendian(stream *s, bool bigendian); +void mnstr_set_error(stream *s, mnstr_error_kind kind, const char *fmt, ...) __attribute__((__format__(__printf__, 3, 4))); void mnstr_settimeout(stream *s, unsigned int ms, bool (*func)(void *), void *data); const char *mnstr_version(void); ssize_t mnstr_write(stream *restrict s, const void *restrict buf, size_t elmsize, size_t cnt); diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c --- a/clients/mapiclient/dump.c +++ b/clients/mapiclient/dump.c @@ -1286,6 +1286,8 @@ describe_table(Mapi mid, const char *sch s = sescape(schema); t = sescape(tname); + if (s == NULL || t == NULL) + goto bailout; maxquerylen = 5120 + strlen(t) + strlen(s); query = malloc(maxquerylen); if (query == NULL) @@ -2249,7 +2251,11 @@ dump_table(Mapi mid, const char *schema, goto doreturn; } for (int64_t i = 0; i < rows; i++) { - mapi_fetch_row(hdl); + if (mapi_fetch_row(hdl) == 0) { + mapi_close_handle(hdl); + fprintf(stderr, "unexepcted error\n"); + goto doreturn; + } tables[i].schema = strdup(mapi_fetch_field(hdl, 0)); tables[i].table = strdup(mapi_fetch_field(hdl, 1)); if (tables[i].schema == NULL || tables[i].table == NULL) { @@ -3365,7 +3371,6 @@ dump_database(Mapi mid, stream *sqlf, co mnstr_printf(sqlf, " %sCYCLE;\n", strcmp(cycle, "true") == 0 ? "" : "NO "); if (mnstr_errnr(sqlf) != MNSTR_NO__ERROR) { mapi_close_handle(hdl); - hdl = NULL; goto bailout2; } } diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c --- a/clients/mapiclient/mclient.c +++ b/clients/mapiclient/mclient.c @@ -25,6 +25,7 @@ # include "getopt.h" # endif #endif +#include "stream.h" #include "mapi.h" #include <unistd.h> #include <string.h> @@ -38,7 +39,6 @@ #include <readline/history.h> #include "ReadlineTools.h" #endif -#include "stream.h" #include "msqldump.h" #define LIBMUTILS 1 #include "mprompt.h" @@ -1308,6 +1308,10 @@ sigint_handler(int signum) (void) signum; state = INTERRUPT; +#ifndef HAVE_SIGACTION + if (signal(signum, sigint_handler) == SIG_ERR) + perror("Could not reinstall sigal handler"); +#endif #ifdef HAVE_LIBREADLINE readline_int_handler(); #endif @@ -2289,7 +2293,7 @@ doFile(Mapi mid, stream *fp, bool useins char *newbuf; state = READING; l = mnstr_readline(fp, buf + length, bufsiz - length); - if (l == -1 && state == INTERRUPT) { + if (l <= 0 && state == INTERRUPT) { /* we were interrupted */ mnstr_clearerr(fp); mnstr_write(toConsole, "\n", 1, 1); @@ -3219,7 +3223,8 @@ putfile(void *data, const char *filename close_stream(priv->f); priv->f = NULL; if (fname) { - MT_remove(fname); + if (MT_remove(fname) < 0) + perror(fname); free(fname); } if (filename == NULL) @@ -3293,8 +3298,19 @@ isfile(FILE *fp) return true; } +static bool +interrupted(void *m) +{ + Mapi mid = m; + if (state == INTERRUPT) { + mnstr_set_error(mapi_get_from(mid), MNSTR_INTERRUPT, NULL); + return true; + } + return false; +} + static void -catch_interrupts(void) +catch_interrupts(Mapi mid) { #ifdef HAVE_SIGACTION struct sigaction sa; @@ -3309,6 +3325,7 @@ catch_interrupts(void) perror("Could not install signal handler"); } #endif + mapi_set_rtimeout(mid, 100, interrupted, mid); } int @@ -3743,7 +3760,7 @@ main(int argc, char **argv) if (!has_fileargs && command == NULL && isatty(fileno(stdin))) { char *lang; - catch_interrupts(); + catch_interrupts(mid); if (mode == SQL) { lang = "/SQL"; @@ -3843,7 +3860,7 @@ main(int argc, char **argv) if (s == NULL) { _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org