Changeset: cdcc6bd1fb1f for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cdcc6bd1fb1f Modified Files: clients/mapiclient/mclient.c gdk/gdk_utils.c monetdb5/mal/mal_profiler.c Branch: makelibstreamgreatagain Log Message:
Merge with default branch. diffs (truncated from 712 to 300 lines): diff --git a/clients/mapiclient/ReadlineTools.c b/clients/mapiclient/ReadlineTools.c --- a/clients/mapiclient/ReadlineTools.c +++ b/clients/mapiclient/ReadlineTools.c @@ -12,6 +12,8 @@ #include "monetdb_config.h" #ifdef HAVE_LIBREADLINE +#include <fcntl.h> +#include <unistd.h> #include <readline/readline.h> #include <readline/history.h> @@ -39,7 +41,7 @@ static const char *sql_commands[] = { static Mapi _mid; static char _history_file[FILENAME_MAX]; -static int _save_history = 0; +static bool _save_history = false; static const char *language; static char * @@ -289,8 +291,73 @@ continue_completion(rl_completion_func_t rl_attempted_completion_function = func; } +#ifndef BUFSIZ +#define BUFSIZ 1024 +#endif + +static void +readline_show_error(const char *msg) { + rl_save_prompt(); + rl_message(msg); + rl_restore_prompt(); + rl_clear_message(); +} + +static int +invoke_editor(int cnt, int key) { + char template[] = "/tmp/mclient_temp_XXXXXX"; + char cmd[BUFSIZ]; + char *editor; + FILE *fp; + size_t cmd_len; + + (void) cnt; + (void) key; + + if ((fp = fdopen(mkstemp(template), "r+")) == NULL) { + // Notify the user that we cannot create temp file + readline_show_error("invoke_editor: Cannot create temp file\n"); + goto bailout; + } + + fwrite(rl_line_buffer, sizeof(char), rl_end, fp); + fflush(fp); + + editor = getenv("VISUAL"); + if (!editor) { + editor = getenv("EDITOR"); + if (!editor) { + readline_show_error("invoke_editor: EDITOR/VISUAL env variable not set\n"); + goto bailout; + } + } + + snprintf(cmd, BUFSIZ, "%s %s", editor, template); + if (system(cmd) != 0) { + readline_show_error("invoke_editor: Starting editor failed\n"); + goto bailout; + } + + fseek(fp, 0, SEEK_SET); + cmd_len = fread(cmd, sizeof(char), BUFSIZ, fp); + fclose(fp); + + *(cmd + cmd_len) = 0; + + rl_replace_line(cmd, 0); + rl_point = cmd_len - 1; + + unlink(template); + + return 0; + +bailout: + fclose(fp); + return 1; +} + void -init_readline(Mapi mid, const char *lang, int save_history) +init_readline(Mapi mid, const char *lang, bool save_history) { language = lang; _mid = mid; @@ -308,6 +375,8 @@ init_readline(Mapi mid, const char *lang rl_attempted_completion_function = mal_completion; } + rl_bind_key(024, invoke_editor); + if (save_history) { int len; if (getenv("HOME") != NULL) { @@ -317,7 +386,7 @@ init_readline(Mapi mid, const char *lang if (len == -1 || len >= FILENAME_MAX) fprintf(stderr, "Warning: history filename path is too large\n"); else - _save_history = 1; + _save_history = true; } if (_save_history) { FILE *f; diff --git a/clients/mapiclient/ReadlineTools.h b/clients/mapiclient/ReadlineTools.h --- a/clients/mapiclient/ReadlineTools.h +++ b/clients/mapiclient/ReadlineTools.h @@ -13,7 +13,7 @@ #include "mapi.h" -void init_readline(Mapi mid, const char *language, int save_history); +void init_readline(Mapi mid, const char *language, bool save_history); void deinit_readline(void); void save_line(const char *s); rl_completion_func_t *suspend_completion(void); diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c --- a/clients/mapiclient/mclient.c +++ b/clients/mapiclient/mclient.c @@ -2207,7 +2207,7 @@ mydestroy(void *private) #endif static bool -doFile(Mapi mid, stream *fp, bool useinserts, bool interactive, int save_history) +doFile(Mapi mid, stream *fp, bool useinserts, bool interactive, bool save_history) { char *line = NULL; char *buf = NULL; @@ -3173,7 +3173,7 @@ main(int argc, char **argv) bool useinserts = false; int c = 0; Mapi mid; - int save_history = 0; + bool save_history = false; bool interactive = false; bool has_fileargs = false; int option_index = 0; @@ -3257,7 +3257,7 @@ main(int argc, char **argv) dbname = dotfile.dbname; language = dotfile.language; host = dotfile.host; - save_history = (int)dotfile.save_history; + save_history = dotfile.save_history; output = dotfile.output; pagewidth = dotfile.pagewidth; port = dotfile.port; @@ -3320,7 +3320,7 @@ main(int argc, char **argv) host = optarg; break; case 'H': - save_history = 1; + save_history = true; break; case 'i': interactive = true; diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c --- a/gdk/gdk_utils.c +++ b/gdk/gdk_utils.c @@ -1360,7 +1360,7 @@ GDKusec(void) return (lng) (f.QuadPart / 10); #elif defined(HAVE_CLOCK_GETTIME) struct timespec ts; - clock_gettime(CLOCK_REALTIME, &ts); + (void) clock_gettime(CLOCK_REALTIME, &ts); return (lng) (ts.tv_sec * LL_CONSTANT(1000000) + ts.tv_nsec / 1000); #elif defined(HAVE_GETTIMEOFDAY) struct timeval tv; diff --git a/monetdb5/ChangeLog b/monetdb5/ChangeLog --- a/monetdb5/ChangeLog +++ b/monetdb5/ChangeLog @@ -1,3 +1,16 @@ # ChangeLog file for MonetDB5 # This file is updated with Maddlog +* Thu Aug 20 2020 Sjoerd Mullender <sjo...@acm.org> +- The settings for specifying how mserver5 should listen to "The + Internet" have been overhauled. See the manual for details. In + brief, mapi_autosense, mapi_ipv6 and mapi_open are gone. If + mapi_listenaddr equals "localhost" or "all", we listen to both IPv4 + and IPv6 (if available), if "127.0.0.1" or "0.0.0.0", we listen to + IPv4 only, if "::1" or "::" we listen to IPv6 only. The first of + each pair is loopback interface only, the second is all interfaces. + If mapi_listenaddr is "none", then no IP port is opened, you need to + use a UNIX domain socket. If mapi_port is 0, we let the operating + system choose a free port (like mapi_autosense). Default behavior + has not changed. + diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c --- a/monetdb5/mal/mal_profiler.c +++ b/monetdb5/mal/mal_profiler.c @@ -246,9 +246,9 @@ This information can be used to determin logadd(",\"parent\":%d", VIEWtparent(d)); logadd(",\"seqbase\":"BUNFMT, d->hseqbase); v= BBPquickdesc(VIEWtparent(d), false); - logadd(",\"persistence\":\"%s\"", (v && !v->batTransient ? "persistent" : "transient")); + logadd(",\"mode\":\"%s\"", (v && !v->batTransient ? "persistent" : "transient")); } else - logadd(",\"persistence\":\"%s\"", (d->batTransient ? "transient" : "persistent")); + logadd(",\"mode\":\"%s\"", (d->batTransient ? "transient" : "persistent")); logadd(",\"sorted\":%d", d->tsorted); logadd(",\"revsorted\":%d", d->trevsorted); logadd(",\"nonil\":%d", d->tnonil); @@ -260,6 +260,7 @@ This information can be used to determin logadd(",\"file\":\"%s\"", cv + 1); GDKfree(cv); total += cnt * d->twidth; + logadd(",\"width\":%d", d->twidth); /* keeping information about the individual auxiliary heaps is helpful during analysis. */ if( d->thash) logadd(",\"hash\":" LLFMT, (lng) hashinfo(d->thash, d->batCacheid)); @@ -290,10 +291,10 @@ This information can be used to determin GDKfree(cv); GDKfree(stmtq); } - logadd(",\"eol\":%d", getVarEolife(mb,getArg(pci,j))); - logadd(",\"used\":%d", isVarUsed(mb,getArg(pci,j))); - logadd(",\"fixed\":%d", isVarFixed(mb,getArg(pci,j))); - logadd(",\"udf\":%d", isVarUDFtype(mb,getArg(pci,j))); + // logadd(",\"eol\":%d", getVarEolife(mb,getArg(pci,j))); useful for MAL debugging + // logadd(",\"used\":%d", isVarUsed(mb,getArg(pci,j))); + // logadd(",\"fixed\":%d", isVarFixed(mb,getArg(pci,j))); + // logadd(",\"udf\":%d", isVarUDFtype(mb,getArg(pci,j))); GDKfree(tname); logadd("}"); } diff --git a/sql/test/BugTracker-2020/Tests/All b/sql/test/BugTracker-2020/Tests/All --- a/sql/test/BugTracker-2020/Tests/All +++ b/sql/test/BugTracker-2020/Tests/All @@ -18,3 +18,4 @@ interval-math.Bug-6935 tpch-cube.Bug-6938 HAVE_PYMONETDB?remote-table-like.Bug-6841 KNOWNFAIL?copy-empty-blob.Bug-6948 +values-like-join.Bug-6954 diff --git a/sql/test/BugTracker-2020/Tests/copy-empty-blob.Bug-6948.sql b/sql/test/BugTracker-2020/Tests/copy-empty-blob.Bug-6948.sql --- a/sql/test/BugTracker-2020/Tests/copy-empty-blob.Bug-6948.sql +++ b/sql/test/BugTracker-2020/Tests/copy-empty-blob.Bug-6948.sql @@ -9,5 +9,5 @@ 2,"" 3, -- This should return 4 rows -select * form blobtbl; +select * from blobtbl; rollback; diff --git a/sql/test/BugTracker-2020/Tests/copy-empty-blob.Bug-6948.stable.err b/sql/test/BugTracker-2020/Tests/copy-empty-blob.Bug-6948.stable.err --- a/sql/test/BugTracker-2020/Tests/copy-empty-blob.Bug-6948.stable.err +++ b/sql/test/BugTracker-2020/Tests/copy-empty-blob.Bug-6948.stable.err @@ -0,0 +1,12 @@ +stderr of test 'copy-empty-blob.Bug-6948` in directory 'sql/test/BugTracker-2020` itself: + + +# 16:22:46 > +# 16:22:46 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-2979" "--port=31302" +# 16:22:46 > + + +# 16:22:46 > +# 16:22:46 > "Done." +# 16:22:46 > + diff --git a/sql/test/BugTracker-2020/Tests/copy-empty-blob.Bug-6948.stable.out b/sql/test/BugTracker-2020/Tests/copy-empty-blob.Bug-6948.stable.out --- a/sql/test/BugTracker-2020/Tests/copy-empty-blob.Bug-6948.stable.out +++ b/sql/test/BugTracker-2020/Tests/copy-empty-blob.Bug-6948.stable.out @@ -0,0 +1,31 @@ +stdout of test 'copy-empty-blob.Bug-6948` in directory 'sql/test/BugTracker-2020` itself: + + +# 16:22:46 > +# 16:22:46 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-2979" "--port=31302" +# 16:22:46 > + +#start transaction; +#create table blobtbl (i int, b blob); +#copy into blobtbl from stdin delimiters ',','\n','"'; +#0,NULL +#1,12ff +#2,"" +#3, +# +[ 4 ] +#select * from blobtbl; +% sys.blobtbl, sys.blobtbl # table_name +% i, b # name +% int, blob # type +% 1, 0 # length +[ 0, NULL ] +[ 1, 12FF ] +[ 2, ] +[ 3, ] +#rollback; + _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list