Changeset: afbbaca9055c for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/afbbaca9055c Removed Files: gdk/gdk_logger_old.c Modified Files: ChangeLog.Aug2024 gdk/CMakeLists.txt gdk/gdk.h gdk/gdk_bbp.c gdk/gdk_logger.c gdk/gdk_logger.h gdk/gdk_logger_internals.h sql/storage/bat/bat_logger.c Branch: Aug2024 Log Message:
Removed upgrade code for versions before Jul2021. diffs (truncated from 5004 to 300 lines): diff --git a/ChangeLog.Aug2024 b/ChangeLog.Aug2024 --- a/ChangeLog.Aug2024 +++ b/ChangeLog.Aug2024 @@ -1,6 +1,9 @@ # ChangeLog file for devel # This file is updated with Maddlog +* Tue Jun 25 2024 Sjoerd Mullender <sjo...@acm.org> +- Removed upgrade code for versions before Jul2021. + * Wed May 8 2024 Sjoerd Mullender <sjo...@acm.org> - The shared library (.dll aka .so files) now have the version number as part of the name. This should allow the building of compatibility diff --git a/gdk/CMakeLists.txt b/gdk/CMakeLists.txt --- a/gdk/CMakeLists.txt +++ b/gdk/CMakeLists.txt @@ -72,7 +72,6 @@ target_sources(bat gdk_value.c gdk_posix.c gdk_logger.c gdk_logger.h - gdk_logger_old.c gdk_sample.c xoshiro256starstar.h gdk_private.h diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -747,7 +747,6 @@ typedef struct { /* assert that atom width is power of 2, i.e., width == 1<<shift */ #define assert_shift_width(shift,width) assert(((shift) == 0 && (width) == 0) || ((unsigned)1<<(shift)) == (unsigned)(width)) -#define GDKLIBRARY_MINMAX_POS 061042U /* first in Nov2019: no min/max position; no BBPinfo value */ #define GDKLIBRARY_TAILN 061043U /* first in Jul2021: str offset heaps names don't take width into account */ #define GDKLIBRARY_HASHASH 061044U /* first in Jul2021: hashash bit in string heaps */ #define GDKLIBRARY_HSIZE 061045U /* first in Jan2022: heap "size" values */ diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -482,20 +482,9 @@ heapinit(BAT *b, const char *buf, (void) bbpversion; /* could be used to implement compatibility */ - minpos = maxpos = (uint64_t) oid_nil; /* for GDKLIBRARY_MINMAX_POS case */ size = 0; /* for GDKLIBRARY_HSIZE case */ storage = STORE_INVALID; /* for GDKLIBRARY_HSIZE case */ - if (bbpversion <= GDKLIBRARY_MINMAX_POS ? - sscanf(buf, - " %10s %" SCNu16 " %" SCNu16 " %" SCNu16 " %" SCNu64 - " %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64 - " %" SCNu64 " %" SCNu64 " %" SCNu16 - "%n", - type, &width, &var, &properties, &nokey0, - &nokey1, &nosorted, &norevsorted, &base, - &free, &size, &storage, - &n) < 12 : - bbpversion <= GDKLIBRARY_HSIZE ? + if (bbpversion <= GDKLIBRARY_HSIZE ? sscanf(buf, " %10s %" SCNu16 " %" SCNu16 " %" SCNu16 " %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64 @@ -1027,8 +1016,7 @@ BBPheader(FILE *fp, int *lineno, bat *bb bbpversion != GDKLIBRARY_JSON && bbpversion != GDKLIBRARY_HSIZE && bbpversion != GDKLIBRARY_HASHASH && - bbpversion != GDKLIBRARY_TAILN && - bbpversion != GDKLIBRARY_MINMAX_POS) { + bbpversion != GDKLIBRARY_TAILN) { TRC_CRITICAL(GDK, "incompatible BBP version: expected 0%o, got 0%o. " "This database was probably created by a %s version of MonetDB.", GDKLIBRARY, bbpversion, @@ -1074,19 +1062,15 @@ BBPheader(FILE *fp, int *lineno, bat *bb } if (sz > *bbpsize) *bbpsize = sz; - if (bbpversion > GDKLIBRARY_MINMAX_POS) { - if (fgets(buf, sizeof(buf), fp) == NULL) { - TRC_CRITICAL(GDK, "short BBP"); - return 0; - } - if (bbpversion <= GDKLIBRARY_STATUS ? - sscanf(buf, "BBPinfo=" LLSCN " %*d", logno) != 1 : - sscanf(buf, "BBPinfo=" LLSCN, logno) != 1) { - TRC_CRITICAL(GDK, "no info value found\n"); - return 0; - } - } else { - *logno = 0; + if (fgets(buf, sizeof(buf), fp) == NULL) { + TRC_CRITICAL(GDK, "short BBP"); + return 0; + } + if (bbpversion <= GDKLIBRARY_STATUS ? + sscanf(buf, "BBPinfo=" LLSCN " %*d", logno) != 1 : + sscanf(buf, "BBPinfo=" LLSCN, logno) != 1) { + TRC_CRITICAL(GDK, "no info value found\n"); + return 0; } return bbpversion; } @@ -1975,7 +1959,6 @@ BBPinit(bool allow_hge_upgrade) ATOMIC_SET(&GDKdebug, dbg); return GDK_FAIL; } - assert(bbpversion > GDKLIBRARY_MINMAX_POS || logno == 0); ATOMIC_SET(&BBPlogno, logno); } diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c --- a/gdk/gdk_logger.c +++ b/gdk/gdk_logger.c @@ -1500,7 +1500,7 @@ log_commit(logger *lg, logged_range *pen } static gdk_return -check_version(logger *lg, FILE *fp, const char *fn, const char *logdir, const char *filename, bool *needsnew) +check_version(logger *lg, FILE *fp, bool *needsnew) { int version = 0; @@ -1510,29 +1510,7 @@ check_version(logger *lg, FILE *fp, cons fclose(fp); return GDK_FAIL; } - if (version < 52300) { /* first CATALOG_VERSION for "new" log format */ - lg->catalog_bid = logbat_new(TYPE_int, BATSIZE, PERSISTENT); - lg->catalog_id = logbat_new(TYPE_int, BATSIZE, PERSISTENT); - lg->dcatalog = logbat_new(TYPE_oid, BATSIZE, PERSISTENT); - if (lg->catalog_bid == NULL || lg->catalog_id == NULL || lg->dcatalog == NULL) { - GDKerror("cannot create catalog bats"); - fclose(fp); - return GDK_FAIL; - } - /* old_logger_load always closes fp */ - if (old_logger_load(lg, fn, logdir, fp, version, filename) != GDK_SUCCEED) { - /*loads drop no longer needed catalog, snapshots bats */ - /*convert catalog_oid -> catalog_id (lng->int) */ - GDKerror("Incompatible database version %06d, " - "this server supports version %06d.\n%s", - version, lg->version, - 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 (version != lg->version) { if (lg->prefuncp == NULL || (*lg->prefuncp) (lg->funcdata, version, lg->version) != GDK_SUCCEED) { GDKerror("Incompatible database version %06d, " @@ -2019,7 +1997,7 @@ log_json_upgrade_finalize(void) * unless running in read-only mode * Load data and persist it in the BATs */ static gdk_return -log_load(const char *fn, const char *logdir, logger *lg, char filename[FILENAME_MAX]) +log_load(const char *fn, logger *lg, char filename[FILENAME_MAX]) { FILE *fp = NULL; char bak[FILENAME_MAX]; @@ -2151,7 +2129,7 @@ log_load(const char *fn, const char *log } if (fp != NULL) { /* check_version always closes fp */ - if (check_version(lg, fp, fn, logdir, filename, &needsnew) != GDK_SUCCEED) { + if (check_version(lg, fp, &needsnew) != GDK_SUCCEED) { fp = NULL; goto error; } @@ -2424,7 +2402,7 @@ log_new(int debug, const char *fn, const MT_lock_init(&lg->flush_lock, "flush_lock"); MT_cond_init(&lg->excl_flush_cv); - if (log_load(fn, logdir, lg, filename) == GDK_SUCCEED) { + if (log_load(fn, lg, filename) == GDK_SUCCEED) { return lg; } return NULL; diff --git a/gdk/gdk_logger.h b/gdk/gdk_logger.h --- a/gdk/gdk_logger.h +++ b/gdk/gdk_logger.h @@ -46,10 +46,6 @@ typedef int log_id; #define LOG_BATGROUP_ID 5 #define LOG_BATGROUP_END 6 -/* interface for the "old" logger */ -typedef struct old_logger old_logger; -gdk_export log_bid old_logger_find_bat(old_logger *lg, const char *name, char tpe, oid id); - gdk_export logger *log_create(int debug, const char *fn, const char *logdir, int version, preversionfix_fptr prefuncp, postversionfix_fptr postfuncp, void *funcdata); gdk_export void log_destroy(logger *lg); gdk_export gdk_return log_flush(logger *lg, ulng saved_id); /* try to flush a part of the logs, including the passed saved_id transaction id */ 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 @@ -93,37 +93,6 @@ struct logger { MT_Cond excl_flush_cv; }; -struct old_logger { - logger *lg; /* the new logger instance */ - const char *filename; /* name of log file */ - lng changes; - lng id; - int tid; - bool with_ids; - stream *log; - lng end; /* end of pre-allocated blocks for faster f(data)sync */ - /* Store log_bids (int) to circumvent trouble with reference counting */ - BAT *catalog_bid; /* int bid column */ - BAT *catalog_nme; /* str name column */ - BAT *catalog_tpe; /* type of column */ - BAT *catalog_oid; /* object identifier of column (the pair type,oid is unique) */ - BAT *dcatalog; /* deleted from catalog table */ - BAT *seqs_id; /* int id column */ - BAT *seqs_val; /* lng value column */ - BAT *dseqs; /* deleted from seqs table */ - BAT *snapshots_bid; /* int bid column */ - BAT *snapshots_tid; /* int tid column */ - BAT *dsnapshots; /* deleted from snapshots table */ - BAT *freed; /* snapshots can be created and destroyed, - in a single logger transaction. - These snapshot bats should be freed - directly (on transaction - commit). */ - BAT *add; /* bat ids of bats being added by upgrade */ - BAT *del; /* bat ids of bats being deleted by upgrade */ -}; - -gdk_return old_logger_load(logger *lg, const char *fn, const char *logdir, FILE *fp, int version, const char *filename); gdk_return log_create_types_file(logger *lg, const char *filename); #endif /* _LOGGER_INTERNALS_H_ */ diff --git a/gdk/gdk_logger_old.c b/gdk/gdk_logger_old.c deleted file mode 100644 --- a/gdk/gdk_logger_old.c +++ /dev/null @@ -1,2000 +0,0 @@ -/* - * SPDX-License-Identifier: MPL-2.0 - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Copyright 2024 MonetDB Foundation; - * Copyright August 2008 - 2023 MonetDB B.V.; - * Copyright 1997 - July 2008 CWI. - */ - -/* - * (author) N. J. Nes - * - * In the philosophy of MonetDB, transaction management overhead - * should only be paid when necessary. Transaction management is for - * this purpose implemented as a separate module and applications are - * required to obey the transaction policy, e.g. obtaining/releasing - * locks. - * - * This module is designed to support efficient logging of the SQL - * database. Once loaded, the SQL compiler will insert the proper - * calls at transaction commit to include the changes in the log file. - * - * The logger uses a directory to store its log files. One master log - * file stores information about the version of the logger and the - * transaction log files. This file is a simple ascii file with the - * following format: - * {6DIGIT-VERSION\n[log file number \n]*]*} - * The transaction log files have a binary format, which stores fixed - * size logformat headers (flag,nr,bid), where the flag is the type of - * update logged. The nr field indicates how many changes there were - * (in case of inserts/deletes). The bid stores the bid identifier. - * - * The key decision to be made by the user is the location of the log - * file. Ideally, it should be stored in fail-safe environment, or at - * least the log and databases should be on separate disk columns. - * - * This file system may reside on the same hardware as the database - * server and therefore the writes are done to the same disk, but - * could also reside on another system and then the changes are - * flushed through the network. The logger works under the assumption - * that it is called to safeguard updates on the database when it has - * an exclusive lock on the latest version. This lock should be - * guaranteed by the calling transaction manager first. - * - * Finding the updates applied to a BAT is relatively easy, because - * each BAT contains a delta structure. On commit these changes are - * written to the log file and the delta management is reset. Since - * each commit is written to the same log file, the beginning and end - * are marked by a log identifier. - * - * A server restart should only (re)process blocks which are - * completely written to disk. A log replay therefore ends in a commit - * or abort on the changed bats. Once all logs have been read, the - * changes to the bats are made persistent, i.e. a bbp sub-commit is - * done. - */ -#include "monetdb_config.h" -#include "gdk.h" -#include "gdk_private.h" -#include "gdk_logger.h" _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org