diff --git a/CHANGELOG.md b/CHANGELOG.md index d6fe40279b6..59982c80027 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ### Fixed * ([#????](https://github.com/realm/realm-core/issues/????), since v?.?.?) * Support upgrading from file format 5. ([#7089](https://github.com/realm/realm-cocoa/issues/7089), since v6.0.0) +* On 32bit devices you may get exception with "No such object" when upgrading to v10.* ([#7314](https://github.com/realm/realm-java/issues/7314), since v10.0.0) ### Breaking changes * None. diff --git a/src/realm/cluster_tree.cpp b/src/realm/cluster_tree.cpp index eada177dc9f..37785b0e753 100644 --- a/src/realm/cluster_tree.cpp +++ b/src/realm/cluster_tree.cpp @@ -277,13 +277,13 @@ ref_type ClusterNodeInner::insert(ObjKey key, const FieldValues& init_values, Cl size_t new_ref_ndx = child_info.ndx + 1; int64_t split_key_value = state.split_key + child_info.offset; - size_t sz = node_size(); + uint64_t sz = node_size(); if (sz < cluster_node_size) { if (m_keys.is_attached()) { m_keys.insert(new_ref_ndx, split_key_value); } else { - if (size_t(split_key_value) != sz << m_shift_factor) { + if (uint64_t(split_key_value) != sz << m_shift_factor) { ensure_general_form(); m_keys.insert(new_ref_ndx, split_key_value); } @@ -527,7 +527,7 @@ void ClusterNodeInner::add(ref_type ref, int64_t key_value) m_keys.add(key_value); } else { - if (size_t(key_value) != (node_size() << m_shift_factor)) { + if (uint64_t(key_value) != (uint64_t(node_size()) << m_shift_factor)) { ensure_general_form(); m_keys.add(key_value); } diff --git a/test/test_table.cpp b/test/test_table.cpp index fcc45e73481..ae39f842cc5 100644 --- a/test/test_table.cpp +++ b/test/test_table.cpp @@ -5644,4 +5644,15 @@ TEST(Table_SortEncrypted) // std::cout << "time: " << duration_cast(t2 - t1).count() << " us" << std::endl; } +TEST(Table_RebuildTable) +{ + Group g; + auto t = g.add_table("foo"); + auto id = t->add_column(type_Int, "id"); + for (int64_t i = 1; i < 8; i++) { + t->create_object().set(id, i); + } + t->set_primary_key_column(id); +} + #endif // TEST_TABLE