Changeset: d9e59bd97640 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/d9e59bd97640 Modified Files: clients/Tests/MAL-signatures.stable.out clients/Tests/MAL-signatures.stable.out.int128 monetdb5/modules/atoms/uuid.c sql/backends/monet5/rel_bin.c sql/backends/monet5/sql.c sql/backends/monet5/sql_execute.c sql/backends/monet5/sql_gencode.c sql/backends/monet5/sql_gencode.h sql/backends/monet5/sql_statement.c sql/backends/monet5/sql_statement.h sql/common/sql_types.c sql/server/rel_dump.c sql/server/rel_optimizer.c sql/server/rel_updates.c sql/test/SQLancer/Tests/sqlancer08.test sql/test/SQLancer/Tests/sqlancer17.test Branch: pushcands Log Message:
Merged with default diffs (truncated from 54665 to 300 lines): diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c --- a/gdk/gdk_logger.c +++ b/gdk/gdk_logger.c @@ -774,34 +774,36 @@ la_bat_create(logger *lg, logaction *la) } static gdk_return -logger_write_new_types(logger *lg, FILE *fp) +logger_write_new_types(logger *lg, FILE *fp, bool append) { bte id = 0; /* write types and insert into bats */ /* first the fixed sized types */ - for (int i=0;i<GDKatomcnt; i++) { + for (int i = 0; i < GDKatomcnt; i++) { if (ATOMvarsized(i)) continue; - if (BUNappend(lg->type_id, &id, false) != GDK_SUCCEED || - BUNappend(lg->type_nme, BATatoms[i].name, false) != GDK_SUCCEED || - BUNappend(lg->type_nr, &i, false) != GDK_SUCCEED || - fprintf(fp, "%d,%s\n", id, BATatoms[i].name) < 0) { + if (append && + (BUNappend(lg->type_id, &id, false) != GDK_SUCCEED || + BUNappend(lg->type_nme, BATatoms[i].name, false) != GDK_SUCCEED || + BUNappend(lg->type_nr, &i, false) != GDK_SUCCEED)) return GDK_FAIL; - } + if (fprintf(fp, "%d,%s\n", id, BATatoms[i].name) < 0) + return GDK_FAIL; id++; } /* second the var sized types */ - id=-127; /* start after nil */ - for (int i=0;i<GDKatomcnt; i++) { + id = -127; /* start after nil */ + for (int i = 0; i < GDKatomcnt; i++) { if (!ATOMvarsized(i)) continue; - if (BUNappend(lg->type_id, &id, false) != GDK_SUCCEED || - BUNappend(lg->type_nme, BATatoms[i].name, false) != GDK_SUCCEED || - BUNappend(lg->type_nr, &i, false) != GDK_SUCCEED || - fprintf(fp, "%d,%s\n", id, BATatoms[i].name) < 0) { + if (append && + (BUNappend(lg->type_id, &id, false) != GDK_SUCCEED || + BUNappend(lg->type_nme, BATatoms[i].name, false) != GDK_SUCCEED || + BUNappend(lg->type_nr, &i, false) != GDK_SUCCEED)) return GDK_FAIL; - } + if (fprintf(fp, "%d,%s\n", id, BATatoms[i].name) < 0) + return GDK_FAIL; id++; } return GDK_SUCCEED; @@ -957,7 +959,7 @@ logger_read_types_file(logger *lg, FILE gdk_return -logger_create_types_file(logger *lg, const char *filename) +logger_create_types_file(logger *lg, const char *filename, bool append) { FILE *fp; @@ -972,7 +974,7 @@ logger_create_types_file(logger *lg, con return GDK_FAIL; } - if (logger_write_new_types(lg, fp) != GDK_SUCCEED) { + if (logger_write_new_types(lg, fp, append) != GDK_SUCCEED) { fclose(fp); MT_remove(filename); GDKerror("writing log file %s failed", filename); @@ -1306,7 +1308,7 @@ logger_commit(logger *lg) } static gdk_return -check_version(logger *lg, FILE *fp, const char *fn, const char *logdir, const char *filename) +check_version(logger *lg, FILE *fp, const char *fn, const char *logdir, const char *filename, bool *needsnew) { int version = 0; @@ -1335,6 +1337,7 @@ check_version(logger *lg, FILE *fp, cons version < lg->version ? "Maybe you need to upgrade to an intermediate release first.\n" : ""); return GDK_FAIL; } + *needsnew = false; /* already written a new log file */ return GDK_SUCCEED; } else if (version != lg->version) { if (lg->prefuncp == NULL || @@ -1346,11 +1349,13 @@ check_version(logger *lg, FILE *fp, cons fclose(fp); return GDK_FAIL; } + *needsnew = true; /* we need to write a new log file */ } else { - lg->postfuncp = NULL; /* don't call */ + lg->postfuncp = NULL; /* don't call */ + *needsnew = false; /* log file already up-to-date */ } - if (fgetc(fp) != '\n' || /* skip \n */ - fgetc(fp) != '\n') { /* skip \n */ + if (fgetc(fp) != '\n' || /* skip \n */ + fgetc(fp) != '\n') { /* skip \n */ GDKerror("Badly formatted log file"); fclose(fp); return GDK_FAIL; @@ -1771,6 +1776,7 @@ logger_load(int debug, const char *fn, c bool needcommit = false; int dbg = GDKdebug; bool readlogs = false; + bool needsnew = false; /* need to write new log file? */ /* refactor */ if (!LOG_DISABLED(lg)) { @@ -1873,7 +1879,7 @@ logger_load(int debug, const char *fn, c GDKerror("cannot create directory for log file %s\n", filename); goto error; } - if (logger_create_types_file(lg, filename) != GDK_SUCCEED) + if (logger_create_types_file(lg, filename, true) != GDK_SUCCEED) goto error; } @@ -1905,7 +1911,7 @@ logger_load(int debug, const char *fn, c } if (fp != NULL) { /* check_version always closes fp */ - if (check_version(lg, fp, fn, logdir, filename) != GDK_SUCCEED) { + if (check_version(lg, fp, fn, logdir, filename, &needsnew) != GDK_SUCCEED) { fp = NULL; goto error; } @@ -2019,6 +2025,16 @@ logger_load(int debug, const char *fn, c } if (lg->postfuncp && (*lg->postfuncp)(lg->funcdata, lg) != GDK_SUCCEED) goto error; + if (needsnew) { + if (GDKmove(0, lg->dir, LOGFILE, NULL, lg->dir, LOGFILE, "bak", true) != GDK_SUCCEED) { + TRC_CRITICAL(GDK, "couldn't move log to log.bak\n"); + return GDK_FAIL; + } + if (logger_create_types_file(lg, filename, false) != GDK_SUCCEED) { + TRC_CRITICAL(GDK, "couldn't write new log\n"); + return GDK_FAIL; + } + } dbg = GDKdebug; GDKdebug &= ~(CHECKMASK|PROPMASK); if (logger_commit(lg) != GDK_SUCCEED) { @@ -2027,6 +2043,11 @@ logger_load(int debug, const char *fn, c GDKdebug = dbg; for( ; log_id <= lg->saved_id; log_id++) (void)logger_cleanup(lg, log_id); /* ignore error of removing file */ + if (needsnew && + GDKunlink(0, lg->dir, LOGFILE, "bak") != GDK_SUCCEED) { + TRC_CRITICAL(GDK, "couldn't remove old log.bak file\n"); + return GDK_FAIL; + } } else { lg->id = lg->saved_id+1; } diff --git a/gdk/gdk_logger_internals.h b/gdk/gdk_logger_internals.h --- a/gdk/gdk_logger_internals.h +++ b/gdk/gdk_logger_internals.h @@ -96,6 +96,6 @@ struct old_logger { BAT *del; /* bat ids of bats being deleted by upgrade */ }; -gdk_return logger_create_types_file(logger *lg, const char *filename); +gdk_return logger_create_types_file(logger *lg, const char *filename, bool append); #endif /* _LOGGER_INTERNALS_H_ */ diff --git a/gdk/gdk_logger_old.c b/gdk/gdk_logger_old.c --- a/gdk/gdk_logger_old.c +++ b/gdk/gdk_logger_old.c @@ -1764,7 +1764,7 @@ old_logger_destroy(old_logger *lg) GDKfree(subcommit); return rc; } - if ((rc = logger_create_types_file(lg->lg, lg->filename)) != GDK_SUCCEED) { + if ((rc = logger_create_types_file(lg->lg, lg->filename, true)) != GDK_SUCCEED) { TRC_CRITICAL(GDK, "logger_destroy failed\n"); GDKfree(subcommit); return rc; diff --git a/monetdb5/modules/atoms/uuid.c b/monetdb5/modules/atoms/uuid.c --- a/monetdb5/modules/atoms/uuid.c +++ b/monetdb5/modules/atoms/uuid.c @@ -453,8 +453,8 @@ bailout: #include "mel.h" mel_func uuid_init_funcs[] = { command("uuid", "new", UUIDgenerateUuid, true, "Generate a new uuid", args(1,1, arg("",uuid))), - command("uuid", "new", UUIDgenerateUuidInt, true, "Generate a new uuid (dummy version for side effect free multiplex loop)", args(1,2, arg("",uuid),argany("d",0))), - command("batuuid", "new", UUIDgenerateUuidInt_bulk, true, "Generate a new uuid (dummy version for side effect free multiplex loop)", args(1,2, batarg("",uuid),batargany("d",0))), + command("uuid", "new", UUIDgenerateUuidInt, false, "Generate a new uuid (dummy version for side effect free multiplex loop)", args(1,2, arg("",uuid),argany("d",0))), + command("batuuid", "new", UUIDgenerateUuidInt_bulk, false, "Generate a new uuid (dummy version for side effect free multiplex loop)", args(1,2, batarg("",uuid),batargany("d",0))), command("uuid", "uuid", UUIDstr2uuid, false, "Coerce a string to a uuid, validating its format", args(1,2, arg("",uuid),arg("s",str))), command("uuid", "str", UUIDuuid2str, false, "Coerce a uuid to its string type", args(1,2, arg("",str),arg("u",uuid))), command("uuid", "isaUUID", UUIDisaUUID, false, "Test a string for a UUID format", args(1,2, arg("",bit),arg("u",str))), diff --git a/monetdb5/modules/mal/clients.c b/monetdb5/modules/mal/clients.c --- a/monetdb5/modules/mal/clients.c +++ b/monetdb5/modules/mal/clients.c @@ -976,54 +976,54 @@ CLTgetSessionID(Client cntxt, MalBlkPtr #include "mel.h" mel_func clients_init_funcs[] = { - pattern("clients", "setListing", CLTsetListing, false, "Turn on/off echo of MAL instructions:\n1 - echo input,\n2 - show mal instruction,\n4 - show details of type resolutoin, \n8 - show binding information.", args(1,2, arg("",int),arg("flag",int))), + pattern("clients", "setListing", CLTsetListing, true, "Turn on/off echo of MAL instructions:\n1 - echo input,\n2 - show mal instruction,\n4 - show details of type resolutoin, \n8 - show binding information.", args(1,2, arg("",int),arg("flag",int))), pattern("clients", "getId", CLTgetClientId, false, "Return a number that uniquely represents the current client.", args(1,1, arg("",int))), pattern("clients", "getInfo", CLTInfo, false, "Pseudo bat with client attributes.", args(2,2, batarg("",str),batarg("",str))), pattern("clients", "getScenario", CLTgetScenario, false, "Retrieve current scenario name.", args(1,1, arg("",str))), - pattern("clients", "setScenario", CLTsetScenario, false, "Switch to other scenario handler, return previous one.", args(1,2, arg("",str),arg("msg",str))), - pattern("clients", "quit", CLTquit, false, "Terminate the client session.", args(1,1, arg("",void))), - pattern("clients", "quit", CLTquit, false, "Terminate the session for a single client using a soft error.\nIt is the privilige of the console user.", args(1,2, arg("",void),arg("idx",int))), + pattern("clients", "setScenario", CLTsetScenario, true, "Switch to other scenario handler, return previous one.", args(1,2, arg("",str),arg("msg",str))), + pattern("clients", "quit", CLTquit, true, "Terminate the client session.", args(1,1, arg("",void))), + pattern("clients", "quit", CLTquit, true, "Terminate the session for a single client using a soft error.\nIt is the privilige of the console user.", args(1,2, arg("",void),arg("idx",int))), command("clients", "getLogins", CLTLogin, false, "Pseudo bat of client id and login time.", args(2,2, batarg("user",oid),batarg("start",str))), - pattern("clients", "stop", CLTstop, false, "Stop the query execution at the next eligble statement.", args(0,1, arg("id",int))), - pattern("clients", "suspend", CLTsuspend, false, "Put a client process to sleep for some time.\nIt will simple sleep for a second at a time, until\nthe awake bit has been set in its descriptor", args(1,2, arg("",void),arg("id",int))), - pattern("clients", "wakeup", CLTwakeup, false, "Wakeup a client process", args(1,2, arg("",void),arg("id",int))), + pattern("clients", "stop", CLTstop, true, "Stop the query execution at the next eligble statement.", args(0,1, arg("id",int))), + pattern("clients", "suspend", CLTsuspend, true, "Put a client process to sleep for some time.\nIt will simple sleep for a second at a time, until\nthe awake bit has been set in its descriptor", args(1,2, arg("",void),arg("id",int))), + pattern("clients", "wakeup", CLTwakeup, true, "Wakeup a client process", args(1,2, arg("",void),arg("id",int))), pattern("clients", "getprofile", CLTgetProfile, false, "Retrieve the profile settings for a client", args(5,5, arg("opt",str),arg("q",int),arg("s",int),arg("w",int),arg("m",int))), - pattern("clients", "setsession", CLTsetSessionTimeout, false, "Abort a session after n seconds.", args(1,2, arg("",void),arg("n",lng))), - pattern("clients", "settimeout", CLTsetTimeout, false, "Abort a query after n seconds.", args(1,2, arg("",void),arg("n",lng))), - pattern("clients", "settimeout", CLTsetTimeout, false, "Abort a query after q seconds (q=0 means run undisturbed).\nThe session timeout aborts the connection after spending too\nmany seconds on query processing.", args(1,3, arg("",void),arg("q",lng),arg("s",lng))), - pattern("clients", "setQryTimeoutMicro", CLTqueryTimeoutMicro, false, "", args(1,2, arg("",void),arg("n",lng))), - pattern("clients", "setquerytimeout", CLTqueryTimeout, false, "", args(1,2, arg("",void),arg("n",int))), - pattern("clients", "setquerytimeout", CLTqueryTimeout, false, "", args(1,3, arg("",void),arg("sid",bte),arg("n",int))), - pattern("clients", "setquerytimeout", CLTqueryTimeout, false, "", args(1,3, arg("",void),arg("sid",sht),arg("n",int))), - pattern("clients", "setquerytimeout", CLTqueryTimeout, false, "A query is aborted after q seconds (q=0 means run undisturbed).", args(1,3, arg("",void),arg("sid",int),arg("n",int))), - pattern("clients", "setsessiontimeout", CLTsessionTimeout, false, "", args(1,2, arg("",void),arg("n",int))), - pattern("clients", "setsessiontimeout", CLTsessionTimeout, false, "", args(1,3, arg("",void),arg("sid",bte),arg("n",int))), - pattern("clients", "setsessiontimeout", CLTsessionTimeout, false, "", args(1,3, arg("",void),arg("sid",sht),arg("n",int))), - pattern("clients", "setsessiontimeout", CLTsessionTimeout, false, "Set the session timeout for a particulat session id", args(1,3, arg("",void),arg("sid",int),arg("n",int))), - pattern("clients", "setoptimizer", CLTsetoptimizer, false, "", args(1,2, arg("",void),arg("opt",str))), - pattern("clients", "setoptimizer", CLTsetoptimizer, false, "Set the session optimizer", args(1,3, arg("",void),arg("sid",int),arg("opt",str))), - pattern("clients", "setworkerlimit", CLTsetworkerlimit, false, "", args(1,2, arg("",void),arg("n",int))), - pattern("clients", "setworkerlimit", CLTsetworkerlimit, false, "Limit the number of worker threads per query", args(1,3, arg("",void),arg("sid",int),arg("n",int))), - pattern("clients", "setmemorylimit", CLTsetmemorylimit, false, "", args(1,2, arg("",void),arg("n",int))), - pattern("clients", "setmemorylimit", CLTsetmemorylimit, false, "Limit the memory claim in MB per query", args(1,3, arg("",void),arg("sid",int),arg("n",int))), - pattern("clients", "stopsession", CLTstopSession, false, "", args(1,2, arg("",void),arg("sid",bte))), - pattern("clients", "stopsession", CLTstopSession, false, "", args(1,2, arg("",void),arg("sid",sht))), - pattern("clients", "stopsession", CLTstopSession, false, "Stop a particular session", args(1,2, arg("",void),arg("sid",int))), - command("clients", "setprinttimeout", CLTsetPrintTimeout, false, "Print running query every so many seconds.", args(1,2, arg("",void),arg("n",int))), - pattern("clients", "shutdown", CLTshutdown, false, "", args(1,2, arg("",str),arg("delay",int))), - pattern("clients", "shutdown", CLTshutdown, false, "Close all other client connections. Return if it succeeds.\nIf forced is set then always stop the system the hard way", args(1,3, arg("",str),arg("delay",int),arg("forced",bit))), + pattern("clients", "setsession", CLTsetSessionTimeout, true, "Abort a session after n seconds.", args(1,2, arg("",void),arg("n",lng))), + pattern("clients", "settimeout", CLTsetTimeout, true, "Abort a query after n seconds.", args(1,2, arg("",void),arg("n",lng))), + pattern("clients", "settimeout", CLTsetTimeout, true, "Abort a query after q seconds (q=0 means run undisturbed).\nThe session timeout aborts the connection after spending too\nmany seconds on query processing.", args(1,3, arg("",void),arg("q",lng),arg("s",lng))), + pattern("clients", "setQryTimeoutMicro", CLTqueryTimeoutMicro, true, "", args(1,2, arg("",void),arg("n",lng))), + pattern("clients", "setquerytimeout", CLTqueryTimeout, true, "", args(1,2, arg("",void),arg("n",int))), + pattern("clients", "setquerytimeout", CLTqueryTimeout, true, "", args(1,3, arg("",void),arg("sid",bte),arg("n",int))), + pattern("clients", "setquerytimeout", CLTqueryTimeout, true, "", args(1,3, arg("",void),arg("sid",sht),arg("n",int))), + pattern("clients", "setquerytimeout", CLTqueryTimeout, true, "A query is aborted after q seconds (q=0 means run undisturbed).", args(1,3, arg("",void),arg("sid",int),arg("n",int))), + pattern("clients", "setsessiontimeout", CLTsessionTimeout, true, "", args(1,2, arg("",void),arg("n",int))), + pattern("clients", "setsessiontimeout", CLTsessionTimeout, true, "", args(1,3, arg("",void),arg("sid",bte),arg("n",int))), + pattern("clients", "setsessiontimeout", CLTsessionTimeout, true, "", args(1,3, arg("",void),arg("sid",sht),arg("n",int))), + pattern("clients", "setsessiontimeout", CLTsessionTimeout, true, "Set the session timeout for a particulat session id", args(1,3, arg("",void),arg("sid",int),arg("n",int))), + pattern("clients", "setoptimizer", CLTsetoptimizer, true, "", args(1,2, arg("",void),arg("opt",str))), + pattern("clients", "setoptimizer", CLTsetoptimizer, true, "Set the session optimizer", args(1,3, arg("",void),arg("sid",int),arg("opt",str))), + pattern("clients", "setworkerlimit", CLTsetworkerlimit, true, "", args(1,2, arg("",void),arg("n",int))), + pattern("clients", "setworkerlimit", CLTsetworkerlimit, true, "Limit the number of worker threads per query", args(1,3, arg("",void),arg("sid",int),arg("n",int))), + pattern("clients", "setmemorylimit", CLTsetmemorylimit, true, "", args(1,2, arg("",void),arg("n",int))), + pattern("clients", "setmemorylimit", CLTsetmemorylimit, true, "Limit the memory claim in MB per query", args(1,3, arg("",void),arg("sid",int),arg("n",int))), + pattern("clients", "stopsession", CLTstopSession, true, "", args(1,2, arg("",void),arg("sid",bte))), + pattern("clients", "stopsession", CLTstopSession, true, "", args(1,2, arg("",void),arg("sid",sht))), + pattern("clients", "stopsession", CLTstopSession, true, "Stop a particular session", args(1,2, arg("",void),arg("sid",int))), + command("clients", "setprinttimeout", CLTsetPrintTimeout, true, "Print running query every so many seconds.", args(1,2, arg("",void),arg("n",int))), + pattern("clients", "shutdown", CLTshutdown, true, "", args(1,2, arg("",str),arg("delay",int))), + pattern("clients", "shutdown", CLTshutdown, true, "Close all other client connections. Return if it succeeds.\nIf forced is set then always stop the system the hard way", args(1,3, arg("",str),arg("delay",int),arg("forced",bit))), command("clients", "md5sum", CLTmd5sum, false, "Return hex string representation of the MD5 hash of the given string", args(1,2, arg("",str),arg("pw",str))), command("clients", "sha1sum", CLTsha1sum, false, "Return hex string representation of the SHA-1 hash of the given string", args(1,2, arg("",str),arg("pw",str))), command("clients", "sha2sum", CLTsha2sum, false, "Return hex string representation of the SHA-2 hash with bits of the given string", args(1,3, arg("",str),arg("pw",str),arg("bits",int))), command("clients", "ripemd160sum", CLTripemd160sum, false, "Return hex string representation of the RIPEMD160 hash of the given string", args(1,2, arg("",str),arg("pw",str))), command("clients", "backendsum", CLTbackendsum, false, "Return hex string representation of the currently used hash of the given string", args(1,2, arg("",str),arg("pw",str))), - pattern("clients", "addUser", CLTaddUser, false, "Allow user with password access to the given scenarios", args(1,3, arg("",oid),arg("nme",str),arg("pw",str))), - pattern("clients", "removeUser", CLTremoveUser, false, "Remove the given user from the system", args(1,2, arg("",void),arg("nme",str))), + pattern("clients", "addUser", CLTaddUser, true, "Allow user with password access to the given scenarios", args(1,3, arg("",oid),arg("nme",str),arg("pw",str))), + pattern("clients", "removeUser", CLTremoveUser, true, "Remove the given user from the system", args(1,2, arg("",void),arg("nme",str))), pattern("clients", "getUsername", CLTgetUsername, false, "Return the username of the currently logged in user", args(1,1, arg("",str))), pattern("clients", "getPasswordHash", CLTgetPasswordHash, false, "Return the password hash of the given user", args(1,2, arg("",str),arg("user",str))), - pattern("clients", "changeUsername", CLTchangeUsername, false, "Change the username of the user into the new string", args(1,3, arg("",void),arg("old",str),arg("new",str))), - pattern("clients", "changePassword", CLTchangePassword, false, "Change the password for the current user", args(1,3, arg("",void),arg("old",str),arg("new",str))), - pattern("clients", "setPassword", CLTsetPassword, false, "Set the password for the given user", args(1,3, arg("",void),arg("user",str),arg("pass",str))), + pattern("clients", "changeUsername", CLTchangeUsername, true, "Change the username of the user into the new string", args(1,3, arg("",void),arg("old",str),arg("new",str))), + pattern("clients", "changePassword", CLTchangePassword, true, "Change the password for the current user", args(1,3, arg("",void),arg("old",str),arg("new",str))), + pattern("clients", "setPassword", CLTsetPassword, true, "Set the password for the given user", args(1,3, arg("",void),arg("user",str),arg("pass",str))), pattern("clients", "checkPermission", CLTcheckPermission, false, "Check permission for a user, requires hashed password (backendsum)", args(1,3, arg("",void),arg("usr",str),arg("pw",str))), pattern("clients", "getUsers", CLTgetUsers, false, "return a BAT with user id and one with name available in the system", args(2,2, batarg("",oid),batarg("",str))), pattern("clients", "current_sessionid", CLTgetSessionID, false, "return current session ID", args(1,1, arg("",int))), diff --git a/monetdb5/modules/mal/profiler.c b/monetdb5/modules/mal/profiler.c --- a/monetdb5/modules/mal/profiler.c +++ b/monetdb5/modules/mal/profiler.c @@ -213,18 +213,18 @@ CMDcpuloadPercentage(int *cycles, int *i #include "mel.h" mel_func profiler_init_funcs[] = { - pattern("profiler", "start", CMDstartProfiler, false, "Start offline performance profiling", noargs), _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list