From 0862454e6418b277665238e61e3f4bc90e462965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Edelbo?= Date: Mon, 12 Aug 2024 10:56:36 +0200 Subject: [PATCH] Bump file format version --- CHANGELOG.md | 2 +- src/realm/backup_restore.cpp | 7 ++++--- src/realm/group.cpp | 1 + src/realm/group.hpp | 5 ++++- src/realm/transaction.cpp | 7 ++++++- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af0d058f5ea..dab8322b469 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ * None. ### Compatibility -* Fileformat: Generates files with format v24. Reads and automatically upgrade from fileformat v10. If you want to upgrade from an earlier file format version you will have to use RealmCore v13.x.y or earlier. +* Fileformat: Generates files with format v25. Reads and automatically upgrade from fileformat v10. If you want to upgrade from an earlier file format version you will have to use RealmCore v13.x.y or earlier. ----------- diff --git a/src/realm/backup_restore.cpp b/src/realm/backup_restore.cpp index 8070642af0d..164ece35907 100644 --- a/src/realm/backup_restore.cpp +++ b/src/realm/backup_restore.cpp @@ -34,13 +34,14 @@ using VersionList = BackupHandler::VersionList; using VersionTimeList = BackupHandler::VersionTimeList; // Note: accepted versions should have new versions added at front -const VersionList BackupHandler::accepted_versions_ = {24, 23, 22, 21, 20, 11, 10}; +const VersionList BackupHandler::accepted_versions_ = {25, 24, 23, 22, 21, 20, 11, 10}; // the pair is // we keep backup files in 3 months. static constexpr int three_months = 3 * 31 * 24 * 60 * 60; -const VersionTimeList BackupHandler::delete_versions_{{23, three_months}, {22, three_months}, {21, three_months}, - {20, three_months}, {11, three_months}, {10, three_months}}; +const VersionTimeList BackupHandler::delete_versions_{{24, three_months}, {23, three_months}, {22, three_months}, + {21, three_months}, {20, three_months}, {11, three_months}, + {10, three_months}}; // helper functions diff --git a/src/realm/group.cpp b/src/realm/group.cpp index b6703b3af53..05879f7a874 100644 --- a/src/realm/group.cpp +++ b/src/realm/group.cpp @@ -419,6 +419,7 @@ int Group::read_only_version_check(SlabAlloc& alloc, ref_type top_ref, const std case 0: file_format_ok = (top_ref == 0); break; + case 24: case g_current_file_format_version: file_format_ok = true; break; diff --git a/src/realm/group.hpp b/src/realm/group.hpp index 352c5bd25fb..945a28dd585 100644 --- a/src/realm/group.hpp +++ b/src/realm/group.hpp @@ -764,6 +764,9 @@ class Group : public ArrayParent { /// Backlinks in BPlusTree /// Sort order of Strings changed (affects sets and the string index) /// + /// 25 Enhanced layout of NodeHeader to support compression. + /// Integer arrays are stored in a compressed format. + /// /// IMPORTANT: When introducing a new file format version, be sure to review /// the file validity checks in Group::open() and DB::do_open, the file /// format selection logic in @@ -771,7 +774,7 @@ class Group : public ArrayParent { /// upgrade logic in Group::upgrade_file_format(), AND the lists of accepted /// file formats and the version deletion list residing in "backup_restore.cpp" - static constexpr int g_current_file_format_version = 24; + static constexpr int g_current_file_format_version = 25; int get_file_format_version() const noexcept; void set_file_format_version(int) noexcept; diff --git a/src/realm/transaction.cpp b/src/realm/transaction.cpp index 9e93875923f..8221d65aa3f 100644 --- a/src/realm/transaction.cpp +++ b/src/realm/transaction.cpp @@ -533,7 +533,7 @@ void Transaction::upgrade_file_format(int target_file_format_version) // Be sure to revisit the following upgrade logic when a new file format // version is introduced. The following assert attempt to help you not // forget it. - REALM_ASSERT_EX(target_file_format_version == 24, target_file_format_version); + REALM_ASSERT_EX(target_file_format_version == 25, target_file_format_version); // DB::do_open() must ensure that only supported version are allowed. // It does that by asking backup if the current file format version is @@ -584,6 +584,11 @@ void Transaction::upgrade_file_format(int target_file_format_version) t->migrate_col_keys(); } } + if (current_file_format_version < 25) { + for (auto k : table_keys) { + get_table(k); + } + } // NOTE: Additional future upgrade steps go here. }