Skip to content

Commit bb126af

Browse files
committed
Bump file format version
1 parent e2f2200 commit bb126af

File tree

5 files changed

+16
-6
lines changed

5 files changed

+16
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* None.
1313

1414
### Compatibility
15-
* 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.
15+
* 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.
1616

1717
-----------
1818

src/realm/backup_restore.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,14 @@ using VersionList = BackupHandler::VersionList;
3434
using VersionTimeList = BackupHandler::VersionTimeList;
3535

3636
// Note: accepted versions should have new versions added at front
37-
const VersionList BackupHandler::accepted_versions_ = {24, 23, 22, 21, 20, 11, 10};
37+
const VersionList BackupHandler::accepted_versions_ = {25, 24, 23, 22, 21, 20, 11, 10};
3838

3939
// the pair is <version, age-in-seconds>
4040
// we keep backup files in 3 months.
4141
static constexpr int three_months = 3 * 31 * 24 * 60 * 60;
42-
const VersionTimeList BackupHandler::delete_versions_{{23, three_months}, {22, three_months}, {21, three_months},
43-
{20, three_months}, {11, three_months}, {10, three_months}};
42+
const VersionTimeList BackupHandler::delete_versions_{{24, three_months}, {23, three_months}, {22, three_months},
43+
{21, three_months}, {20, three_months}, {11, three_months},
44+
{10, three_months}};
4445

4546

4647
// helper functions

src/realm/group.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ int Group::read_only_version_check(SlabAlloc& alloc, ref_type top_ref, const std
419419
case 0:
420420
file_format_ok = (top_ref == 0);
421421
break;
422+
case 24:
422423
case g_current_file_format_version:
423424
file_format_ok = true;
424425
break;

src/realm/group.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,14 +764,17 @@ class Group : public ArrayParent {
764764
/// Backlinks in BPlusTree
765765
/// Sort order of Strings changed (affects sets and the string index)
766766
///
767+
/// 25 Enhanced layout of NodeHeader to support compression.
768+
/// Integer arrays are stored in a compressed format.
769+
///
767770
/// IMPORTANT: When introducing a new file format version, be sure to review
768771
/// the file validity checks in Group::open() and DB::do_open, the file
769772
/// format selection logic in
770773
/// Group::get_target_file_format_version_for_session(), and the file format
771774
/// upgrade logic in Group::upgrade_file_format(), AND the lists of accepted
772775
/// file formats and the version deletion list residing in "backup_restore.cpp"
773776

774-
static constexpr int g_current_file_format_version = 24;
777+
static constexpr int g_current_file_format_version = 25;
775778

776779
int get_file_format_version() const noexcept;
777780
void set_file_format_version(int) noexcept;

src/realm/transaction.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ void Transaction::upgrade_file_format(int target_file_format_version)
533533
// Be sure to revisit the following upgrade logic when a new file format
534534
// version is introduced. The following assert attempt to help you not
535535
// forget it.
536-
REALM_ASSERT_EX(target_file_format_version == 24, target_file_format_version);
536+
REALM_ASSERT_EX(target_file_format_version == 25, target_file_format_version);
537537

538538
// DB::do_open() must ensure that only supported version are allowed.
539539
// 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)
584584
t->migrate_col_keys();
585585
}
586586
}
587+
if (current_file_format_version < 25) {
588+
for (auto k : table_keys) {
589+
get_table(k);
590+
}
591+
}
587592
// NOTE: Additional future upgrade steps go here.
588593
}
589594

0 commit comments

Comments
 (0)