Changeset: 15f365419546 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/15f365419546 Branch: default Log Message:
Merge with Dec2023 branch. diffs (truncated from 613 to 300 lines): diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c --- a/gdk/gdk_heap.c +++ b/gdk/gdk_heap.c @@ -1247,6 +1247,13 @@ HEAP_malloc(BAT *b, size_t nbytes) void HEAP_free(Heap *heap, var_t mem) { +/* we cannot free pieces of the heap because we may have used + * append_varsized_bat to create the heap; if we did, there may be + * multiple locations in the offset heap that refer to the same entry in + * the vheap, so we cannot free any until we free all */ + (void) heap; + (void) mem; +#if 0 HEADER *hheader = HEAP_index(heap, 0, HEADER); CHUNK *beforep; CHUNK *blockp; @@ -1318,6 +1325,7 @@ HEAP_free(Heap *heap, var_t mem) */ hheader->head = block; } +#endif } void diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c --- a/gdk/gdk_logger.c +++ b/gdk/gdk_logger.c @@ -2335,7 +2335,6 @@ log_new(int debug, const char *fn, const static logged_range * do_flush_range_cleanup(logger *lg) { - rotation_lock(lg); logged_range *frange = lg->flush_ranges; logged_range *first = frange; @@ -2345,7 +2344,6 @@ do_flush_range_cleanup(logger *lg) frange = frange->next; } if (first == frange) { - rotation_unlock(lg); return first; } @@ -2361,7 +2359,6 @@ do_flush_range_cleanup(logger *lg) frange->output_log = NULL; } } - rotation_unlock(lg); return flast; } @@ -2535,9 +2532,9 @@ log_activate(logger *lg) flush_cleanup = true; do_rotate(lg); } - rotation_unlock(lg); if (flush_cleanup) (void) do_flush_range_cleanup(lg); + rotation_unlock(lg); return res; } @@ -3162,15 +3159,16 @@ log_tflush(logger *lg, ulng file_id, uln if (log_open_output(lg) != GDK_SUCCEED) GDKfatal("Could not create new log file\n"); /* TODO: does not have to be fatal (yet) */ do_rotate(lg); - rotation_unlock(lg); (void) do_flush_range_cleanup(lg); assert(lg->flush_ranges == lg->current); + rotation_unlock(lg); return log_commit(lg, p, NULL, 0); } if (LOG_DISABLED(lg)) return GDK_SUCCEED; + rotation_lock(lg); logged_range *frange = do_flush_range_cleanup(lg); while (frange->next && frange->id < file_id) { @@ -3192,22 +3190,20 @@ log_tflush(logger *lg, ulng file_id, uln /* else somebody else has flushed our log file */ if (ATOMIC_DEC(&frange->refcount) == 1 && !LOG_DISABLED(lg)) { - rotation_lock(lg); if (frange != lg->current && frange->output_log) { close_stream(frange->output_log); frange->output_log = NULL; } - rotation_unlock(lg); } if (ATOMIC_DEC(&lg->nr_flushers) == 0) { /* I am the last flusher * if present, * wake up the exclusive flusher in log_tstart */ - rotation_lock(lg); + /* rotation_lock is still being held */ MT_cond_signal(&lg->excl_flush_cv); - rotation_unlock(lg); } + rotation_unlock(lg); return GDK_SUCCEED; } @@ -3381,8 +3377,8 @@ log_tstart(logger *lg, bool flushnow, ul GDKfatal("Could not create new log file\n"); /* TODO: does not have to be fatal (yet) */ } do_rotate(lg); + (void) do_flush_range_cleanup(lg); rotation_unlock(lg); - (void) do_flush_range_cleanup(lg); if (lg->saved_id + 1 < lg->id) log_flush(lg, (1ULL << 63)); diff --git a/sql/server/sql_atom.c b/sql/server/sql_atom.c --- a/sql/server/sql_atom.c +++ b/sql/server/sql_atom.c @@ -113,7 +113,7 @@ atom_get_int(atom *a) lng r = 0; #endif - if (!a->isnull) { + if (a && !a->isnull) { switch (ATOMstorage(a->data.vtype)) { case TYPE_bte: r = a->data.val.btval; diff --git a/sql/server/sql_datetime.c b/sql/server/sql_datetime.c --- a/sql/server/sql_datetime.c +++ b/sql/server/sql_datetime.c @@ -139,25 +139,29 @@ parse_interval_(mvc *sql, lng sign, cons switch (sk) { case imonth: if (val >= 12) { - snprintf(sql->errstr, ERRSIZE, _("Overflow detected in months (" LLFMT ")\n"), val); + if (sql) + snprintf(sql->errstr, ERRSIZE, _("Overflow detected in months (" LLFMT ")\n"), val); return -1; } break; case ihour: if (val >= 24) { - snprintf(sql->errstr, ERRSIZE, _("Overflow detected in hours (" LLFMT ")\n"), val); + if (sql) + snprintf(sql->errstr, ERRSIZE, _("Overflow detected in hours (" LLFMT ")\n"), val); return -1; } break; case imin: if (val >= 60) { - snprintf(sql->errstr, ERRSIZE, _("Overflow detected in minutes (" LLFMT ")\n"), val); + if (sql) + snprintf(sql->errstr, ERRSIZE, _("Overflow detected in minutes (" LLFMT ")\n"), val); return -1; } break; case isec: if (val >= 60000) { - snprintf(sql->errstr, ERRSIZE, _("Overflow detected in seconds (" LLFMT ")\n"), val); + if (sql) + snprintf(sql->errstr, ERRSIZE, _("Overflow detected in seconds (" LLFMT ")\n"), val); return -1; } break; diff --git a/sql/test/BugTracker-2023/Tests/All b/sql/test/BugTracker-2023/Tests/All --- a/sql/test/BugTracker-2023/Tests/All +++ b/sql/test/BugTracker-2023/Tests/All @@ -15,4 +15,8 @@ misc-crashes-7390 greatest-least-multi-arg-7391 union-query-7401 join-on-row_number-over-7403 +parse_interval-crash-7412 between-crash-7413 +corr-issue-7414 +insert-delete-insert-crash-7415 +orderby-debug-crash-7416 diff --git a/sql/test/BugTracker-2023/Tests/corr-issue-7414.test b/sql/test/BugTracker-2023/Tests/corr-issue-7414.test new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2023/Tests/corr-issue-7414.test @@ -0,0 +1,37 @@ +statement ok +CREATE TABLE t7414 ( v1 , v2 ) as ( select i , cast ( i as string ) from generate_series ( 1 , 1000 ) as t ( i ) ) + +query I +SELECT COUNT(*) FROM t7414 +---- +999 + +statement error 22018!conversion of string to type bit failed. +DELETE FROM t7414 WHERE NULLIF ( v2 , v2 = ( SELECT corr ( v1 , v1 ) OVER ( ROWS 2 PRECEDING ) ) ) + +query I nosort +SELECT corr ( v1 , v1 ) OVER ( ROWS 2 PRECEDING ) FROM t7414 WHERE v1<5 +---- +NULL +1 +1 +1 + +query T nosort +SELECT NULLIF ( v2 , ( SELECT corr ( v1 , v1 ) OVER ( ROWS 2 PRECEDING ) ) ) FROM t7414 WHERE v1<5 +---- +1 +2 +3 +4 + +statement ok +DELETE FROM t7414 WHERE NULLIF ( v2 , v2 = ( SELECT corr ( v1 , v1 ) OVER ( ROWS 2 PRECEDING ) ) ) IS NULL + +query I +SELECT COUNT(*) FROM t7414 +---- +999 + +statement ok +DROP TABLE t7414 diff --git a/sql/test/BugTracker-2023/Tests/insert-delete-insert-crash-7415.test b/sql/test/BugTracker-2023/Tests/insert-delete-insert-crash-7415.test new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2023/Tests/insert-delete-insert-crash-7415.test @@ -0,0 +1,55 @@ +statement ok +CREATE TABLE t1 AS SELECT t1.value AS id, CAST( sys.group_concat( CASE WHEN id.value IS NOT NULL THEN 'DB' ELSE '' END , '') AS BLOB) AS name FROM sys.generate_series(0, 1000) AS t1 LEFT JOIN sys.generate_series(0, 1000) AS id ON id.value < t1.value GROUP BY id ORDER BY id + +query I +select count(*) from t1 +---- +1000 + +statement ok +insert into t1 (select * from t1) + +statement ok +insert into t1 (select * from t1) + +statement ok +insert into t1 (select * from t1) + +statement ok +insert into t1 (select * from t1) + +query I +select count(*) from t1 +---- +16000 + +query I +select count(*) from t1 WHERE id=1 +---- +16 + +statement ok +DELETE FROM t1 WHERE id=1 + +--statement error 42S02!SELECT: no such table 'analytics' +--select nth_value(aa, 1) over (partition by bb) from analytics + +query I +select count(*) from t1 +---- +15984 + +-- the next insert causes a HEAP_malloc: Assertion `trail == 0 || block > trail' failed. in gdk/gdk_heap.c:1161 +statement ok +insert into t1 (select * from t1) + +statement ok +insert into t1 (select * from t1) + +query I +select count(*) from t1 +---- +56610 + +statement ok +DROP TABLE t1 diff --git a/sql/test/BugTracker-2023/Tests/orderby-debug-crash-7416.test b/sql/test/BugTracker-2023/Tests/orderby-debug-crash-7416.test new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2023/Tests/orderby-debug-crash-7416.test @@ -0,0 +1,16 @@ +query II +SELECT 0 , 827 ORDER BY 1 +---- +0 +827 + +query I +SELECT debug +---- +0 + +statement error 42000!SELECT: the order by column number (0) is not in the number of projections range (2) +SELECT 0 , 827 ORDER BY 0 + +statement error 42000!SELECT: the order by column number (0) is not in the number of projections range (2) +SELECT 0 , 827 ORDER BY debug _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org