Changeset: 146b7e9f3930 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/146b7e9f3930
Modified Files:
gdk/gdk_strimps.c
monetdb5/mal/mal_embedded.c
sql/backends/monet5/sql_upgrades.c
sql/backends/monet5/sql_user.c
sql/storage/store.c
Branch: Jun2023
Log Message:
Merge with Sep2022
diffs (152 lines):
diff --git a/gdk/gdk_strimps.c b/gdk/gdk_strimps.c
--- a/gdk/gdk_strimps.c
+++ b/gdk/gdk_strimps.c
@@ -688,14 +688,7 @@ STRMPcreateStrimpHeap(BAT *b, BAT *s)
if ((r = b->tstrimps) == NULL &&
STRMPbuildHeader(b, s, hpairs)) { /* Find the header pairs, put
the result in hpairs */
- /* The 64th bit in the bit string is used to indicate if
- the string is NULL. So the corresponding pair does
- not encode useful information. We need to keep it for
- alignment but we must make sure that it will not
- match an actual pair of characters we encounter in
- strings.*/
- for (i = 0; i < hpairs[STRIMP_HEADER_SIZE - 1].psize; i++)
- hpairs[STRIMP_HEADER_SIZE - 1].pbytes[i] = 0;
+
sz = 8 + STRIMP_HEADER_SIZE; /* add 8-bytes for the descriptor
and
the pair sizes */
for (i = 0; i < STRIMP_HEADER_SIZE; i++) {
@@ -725,12 +718,25 @@ STRMPcreateStrimpHeap(BAT *b, BAT *s)
r->sizes_base = h1 = (uint8_t *)r->strimps.base + 8;
r->pairs_base = h2 = (uint8_t *)h1 + STRIMP_HEADER_SIZE;
- for (i = 0; i < STRIMP_HEADER_SIZE; i++) {
+ for (i = 0; i < STRIMP_HEADER_SIZE - 1; i++) {
uint8_t psize = hpairs[i].psize;
h1[i] = psize;
memcpy(h2, hpairs[i].pbytes, psize);
h2 += psize;
}
+
+ /* The 64th bit in the bit string is used to indicate if
+ the string is NULL. So the corresponding pair does
+ not encode useful information. We need to keep it for
+ alignment but we must make sure that it will not
+ match an actual pair of characters we encounter in
+ strings.*/
+ h1[STRIMP_HEADER_SIZE - 1] = hpairs[STRIMP_HEADER_SIZE -
1].psize;
+ for(i = 0; i < hpairs[STRIMP_HEADER_SIZE - 1].psize; i++) {
+ *(h2 + i) = 0;
+ }
+ h2 += hpairs[STRIMP_HEADER_SIZE - 1].psize;
+
r->bitstrings_base = h2;
r->strimps.free = sz;
r->rec_cnt = 0;
diff --git a/monetdb5/mal/mal_embedded.c b/monetdb5/mal/mal_embedded.c
--- a/monetdb5/mal/mal_embedded.c
+++ b/monetdb5/mal/mal_embedded.c
@@ -69,7 +69,7 @@ malEmbeddedBoot(int workerlimit, int mem
"unable to open vault_key_file %s:
%s\n",
GDKgetenv("monet_vault_key"),
strerror(errno));
}
- len = fread(secret, 1, sizeof(secret), secretf);
+ len = fread(secret, 1, sizeof(secret) - 1, secretf);
fclose(secretf);
secret[len] = '\0';
len = strlen(secret); /* secret can contain null-bytes
*/
diff --git a/sql/ChangeLog.Sep2022 b/sql/ChangeLog.Sep2022
--- a/sql/ChangeLog.Sep2022
+++ b/sql/ChangeLog.Sep2022
@@ -1,3 +1,9 @@
# ChangeLog file for sql
# This file is updated with Maddlog
+* Fri Jun 9 2023 Sjoerd Mullender <[email protected]>
+- An upgrade that both creates a new .snapshot user and extends the
+ sys.db_user_info table with (among others) a password column did
+ these in such a way that the passord value for the new user was NULL.
+ This is fixed by updating the password.
+
diff --git a/sql/backends/monet5/sql_user.c b/sql/backends/monet5/sql_user.c
--- a/sql/backends/monet5/sql_user.c
+++ b/sql/backends/monet5/sql_user.c
@@ -329,18 +329,17 @@ monet5_create_user(ptr _mvc, str user, s
pwd = passwd;
}
- if ((err = AUTHGeneratePasswordHash(&hash, pwd)) != MAL_SUCCEED) {
+ err = AUTHGeneratePasswordHash(&hash, pwd);
+ if (!enc)
+ free(pwd);
+ if (err != MAL_SUCCEED) {
GDKfree(schema_buf);
- if (!enc)
- free(pwd);
throw(MAL, "sql.create_user", SQLSTATE(42000) "create backend
hash failure");
}
user_id = store_next_oid(m->session->tr->store);
sqlid default_role_id = role_id > 0 ? role_id : user_id;
if ((log_res = store->table_api.table_insert(m->session->tr,
db_user_info, &user, &fullname, &schema_id, &schema_path, &max_memory,
&max_workers, &optimizer, &default_role_id, &hash))) {
- if (!enc)
- free(pwd);
GDKfree(schema_buf);
GDKfree(hash);
throw(SQL, "sql.create_user", SQLSTATE(42000) "Create user
failed%s", log_res == LOG_CONFLICT ? " due to conflict with another
transaction" : "");
@@ -350,8 +349,6 @@ monet5_create_user(ptr _mvc, str user, s
GDKfree(hash);
if ((log_res = store->table_api.table_insert(m->session->tr, auths,
&user_id, &user, &grantorid))) {
- if (!enc)
- free(pwd);
throw(SQL, "sql.create_user", SQLSTATE(42000) "Create user
failed%s", log_res == LOG_CONFLICT ? " due to conflict with another
transaction" : "");
}
@@ -359,21 +356,15 @@ monet5_create_user(ptr _mvc, str user, s
// update schema authorization to be default_role_id
switch (sql_trans_change_schema_authorization(m->session->tr,
schema_id, default_role_id)) {
case -1:
- if (!enc)
- free(pwd);
throw(SQL,"sql.create_user",SQLSTATE(HY013)
MAL_MALLOC_FAIL);
case -2:
case -3:
- if (!enc)
- free(pwd);
throw(SQL,"sql.create_user",SQLSTATE(42000)
"Update schema authorization failed due to transaction conflict");
default:
break;
}
}
- if (!enc)
- free(pwd);
return ret;
}
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -2654,6 +2654,12 @@ hot_snapshot_write_tar(stream *out, cons
char *dest_name = dest_path + snprintf(dest_path, sizeof(dest_path),
"%s/", prefix);
stream *infile = NULL;
+ lng timeoffset = 0;
+ QryCtx *qry_ctx = MT_thread_get_qry_ctx();
+ if (qry_ctx != NULL) {
+ timeoffset = (qry_ctx->starttime && qry_ctx->querytimeout) ?
(qry_ctx->starttime + qry_ctx->querytimeout) : 0;
+ }
+
int len;
if (sscanf(p, "%[^\n]\n%n", abs_src_path, &len) != 1) {
GDKerror("internal error: first line of plan is malformed");
@@ -2666,6 +2672,7 @@ hot_snapshot_write_tar(stream *out, cons
char command;
long size;
while (sscanf(p, "%c %ld %100s\n%n", &command, &size, src_name, &len)
== 3) {
+ GDK_CHECK_TIMEOUT_BODY(timeoffset,
GOTO_LABEL_TIMEOUT_HANDLER(end));
p += len;
strcpy(dest_name, src_name);
if (size < 0) {
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]