Skip to content

Commit

Permalink
Remove support for upgrading from pre core-6 (v10) (#6090)
Browse files Browse the repository at this point in the history
  • Loading branch information
jedelbo authored Dec 13, 2022
1 parent ffccf4d commit 46f5e8a
Show file tree
Hide file tree
Showing 39 changed files with 12 additions and 1,546 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
* None.

### Breaking changes
* None.
* Support for upgrading from Realm files produced by RealmCore v5.23.9 or earlier is no longer supported.

### Compatibility
* Fileformat: Generates files with format v23. Reads and automatically upgrade from fileformat v5.
* 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.

-----------

Expand Down
2 changes: 1 addition & 1 deletion doc/CHANGELOG_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* None.

### Compatibility
* Fileformat: Generates files with format v23. Reads and automatically upgrade from fileformat v5.
* 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.

-----------

Expand Down
7 changes: 3 additions & 4 deletions src/realm/backup_restore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,13 @@ using VersionList = BackupHandler::VersionList;
using VersionTimeList = BackupHandler::VersionTimeList;

// Note: accepted versions should have new versions added at front
const VersionList BackupHandler::accepted_versions_ = {23, 22, 21, 20, 11, 10, 9, 8, 7, 6, 5, 0};
const VersionList BackupHandler::accepted_versions_ = {24, 23, 22, 21, 20, 11, 10};

// the pair is <version, age-in-seconds>
// we keep backup files in 3 months.
static constexpr int three_months = 3 * 31 * 24 * 60 * 60;
const VersionTimeList BackupHandler::delete_versions_{
{22, three_months}, {21, three_months}, {20, three_months}, {11, three_months}, {10, three_months},
{9, three_months}, {8, three_months}, {7, three_months}, {6, three_months}, {5, three_months}};
const VersionTimeList BackupHandler::delete_versions_{{23, three_months}, {22, three_months}, {21, three_months},
{20, three_months}, {11, three_months}, {10, three_months}};


// helper functions
Expand Down
1 change: 1 addition & 0 deletions src/realm/group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,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 23:
case g_current_file_format_version:
file_format_ok = true;
break;
Expand Down
4 changes: 3 additions & 1 deletion src/realm/group.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -788,14 +788,16 @@ class Group : public ArrayParent {
///
/// 23 Layout of Set and Dictionary changed.
///
/// 24 Variable sized arrays for Decimal128.
///
/// 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
/// Group::get_target_file_format_version_for_session(), and the file format
/// 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 = 23;
static constexpr int g_current_file_format_version = 24;

int get_file_format_version() const noexcept;
void set_file_format_version(int) noexcept;
Expand Down
Loading

0 comments on commit 46f5e8a

Please sign in to comment.