Changeset: bf00510420fe for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bf00510420fe Modified Files: gdk/gdk_logger_internals.h gdk/gdk_logger_old.c sql/storage/bat/bat_logger.c Branch: unlock Log Message:
Refactored upgrade code; we now produce the new catalog bats. They then get destroyed again, but then again, upgrades are currently still disabled. diffs (truncated from 1798 to 300 lines): 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 @@ -64,4 +64,32 @@ struct logger { size_t bufsize; }; +struct old_logger { + logger *lg; /* the new logger instance */ + lng changes; + lng id; + int tid; + bool with_ids; + char *local_dir; /* the directory in which the log is written */ + 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). */ +}; + #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 @@ -61,35 +61,6 @@ #include "mutils.h" #include <string.h> -struct old_logger { - logger *lg; /* the new logger instance */ - lng changes; - lng id; - int tid; - bool with_ids; - char *local_dir; /* the directory in which the log is written */ - 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). */ -}; - - /* * The log record encoding is geared at reduced storage space, but at * the expense of readability. A user can not easily inspect the log a diff --git a/sql/storage/bat/bat_logger.c b/sql/storage/bat/bat_logger.c --- a/sql/storage/bat/bat_logger.c +++ b/sql/storage/bat/bat_logger.c @@ -186,340 +186,1286 @@ tabins(void *lg, bool first, int tt, con } #endif -struct item { - const char *name; +struct table { + const char *schema; + const char *table; + const char *column; + const char *fullname; int newid; - int oldid; -}; - -struct item schemas[] = { - {.name = "sys", .newid = 2000, }, - {.name = "tmp", .newid = 2114, }, - {0} -}; - -struct item tables[] = { - {.name = "schemas", .newid = 2001, }, - {.name = "types", .newid = 2007, }, - {.name = "functions", .newid = 2016, }, - {.name = "args", .newid = 2028, }, - {.name = "sequences", .newid = 2037, }, - {.name = "table_partitions", .newid = 2047, }, - {.name = "range_partitions", .newid = 2053, }, - {.name = "value_partitions", .newid = 2059, }, - {.name = "dependencies", .newid = 2063, }, - {.name = "_tables", .newid = 2067, }, - {.name = "_columns", .newid = 2076, }, - {.name = "keys", .newid = 2087, }, - {.name = "idxs", .newid = 2094, }, - {.name = "triggers", .newid = 2099, }, - {.name = "objects", .newid = 2110, }, - {0}, - {.name = "_tables", .newid = 2115, }, - {.name = "_columns", .newid = 2124, }, - {.name = "keys", .newid = 2135, }, - {.name = "idxs", .newid = 2142, }, - {.name = "triggers", .newid = 2147, }, - {.name = "objects", .newid = 2158, }, - {0}, + bool hasids; +} tables[] = { + { + .schema = "sys", + .newid = 2000, + }, + { + .schema = "sys", + .table = "schemas", + .fullname = "D_sys_schemas", + .newid = 2001, + }, + { + .schema = "sys", + .table = "schemas", + .column = "id", + .fullname = "sys_schemas_id", + .newid = 2002, + .hasids = true, + }, + { + .schema = "sys", + .table = "schemas", + .column = "name", + .fullname = "sys_schemas_name", + .newid = 2003, + }, + { + .schema = "sys", + .table = "schemas", + .column = "authorization", + .fullname = "sys_schemas_authorization", + .newid = 2004, + }, + { + .schema = "sys", + .table = "schemas", + .column = "owner", + .fullname = "sys_schemas_owner", + .newid = 2005, + }, + { + .schema = "sys", + .table = "schemas", + .column = "system", + .fullname = "sys_schemas_system", + .newid = 2006, + }, + { + .schema = "sys", + .table = "types", + .fullname = "D_sys_types", + .newid = 2007, + }, + { + .schema = "sys", + .table = "types", + .column = "id", + .fullname = "sys_types_id", + .newid = 2008, + }, + { + .schema = "sys", + .table = "types", + .column = "systemname", + .fullname = "sys_types_systemname", + .newid = 2009, + }, + { + .schema = "sys", + .table = "types", + .column = "sqlname", + .fullname = "sys_types_sqlname", + .newid = 2010, + }, + { + .schema = "sys", + .table = "types", + .column = "digits", + .fullname = "sys_types_digits", + .newid = 2011, + }, + { + .schema = "sys", + .table = "types", + .column = "scale", + .fullname = "sys_types_scale", + .newid = 2012, + }, + { + .schema = "sys", + .table = "types", + .column = "radix", + .fullname = "sys_types_radix", + .newid = 2013, + }, + { + .schema = "sys", + .table = "types", + .column = "eclass", + .fullname = "sys_types_eclass", + .newid = 2014, + }, + { + .schema = "sys", + .table = "types", + .column = "schema_id", + .fullname = "sys_types_schema_id", + .newid = 2015, + .hasids = true, + }, + { + .schema = "sys", + .table = "functions", + .fullname = "D_sys_functions", + .newid = 2016, + }, + { + .schema = "sys", + .table = "functions", + .column = "id", + .fullname = "sys_functions_id", + .newid = 2017, + }, + { + .schema = "sys", + .table = "functions", + .column = "name", + .fullname = "sys_functions_name", + .newid = 2018, + }, + { + .schema = "sys", + .table = "functions", + .column = "func", + .fullname = "sys_functions_func", + .newid = 2019, + }, + { + .schema = "sys", + .table = "functions", + .column = "mod", + .fullname = "sys_functions_mod", + .newid = 2020, + }, + { + .schema = "sys", + .table = "functions", + .column = "language", + .fullname = "sys_functions_language", + .newid = 2021, + }, + { + .schema = "sys", + .table = "functions", + .column = "type", + .fullname = "sys_functions_type", + .newid = 2022, + }, + { + .schema = "sys", + .table = "functions", + .column = "side_effect", + .fullname = "sys_functions_side_effect", + .newid = 2023, + }, + { + .schema = "sys", + .table = "functions", + .column = "varres", + .fullname = "sys_functions_varres", + .newid = 2024, + }, + { + .schema = "sys", + .table = "functions", + .column = "vararg", _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list