Skip to content

Commit

Permalink
Merge branch 'next-major' into feature/string-compression
Browse files Browse the repository at this point in the history
  • Loading branch information
nicola-cab committed Jul 12, 2024
2 parents 1afc39e + 18e5d20 commit d35c8fc
Show file tree
Hide file tree
Showing 20 changed files with 62 additions and 295 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,27 @@

----------------------------------------------

# 14.10.4 Release notes

### Enhancements
* None.

### Fixed
* When a public name is defined on a property, calling `realm::Results::sort()` or `realm::Results::distinct()` with the internal name could throw an error like `Cannot sort on key path 'NAME': property 'PersonObject.NAME' does not exist`. ([realm/realm-js#6779](https://github.com/realm/realm-js/issues/6779), since v12.12.0)

### Breaking changes
* 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.

-----------

### Internals
* Fix a thread sanitizer failure in the "unregister connection change listener during callback" test ([PR #7871](https://github.com/realm/realm-core/pull/7871)).

----------------------------------------------

# 14.10.3 Release notes

### Enhancements
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import PackageDescription
import Foundation

let versionStr = "14.10.3"
let versionStr = "14.10.4"
let versionPieces = versionStr.split(separator: "-")
let versionCompontents = versionPieces[0].split(separator: ".")
let versionExtra = versionPieces.count > 1 ? versionPieces[1] : ""
Expand Down
6 changes: 3 additions & 3 deletions dependencies.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PACKAGE_NAME: realm-core
VERSION: 14.10.3
VERSION: 14.10.4
OPENSSL_VERSION: 3.2.0
ZLIB_VERSION: 1.2.13
# https://github.com/10gen/baas/commits
# 9d1b4d6 is 2024 May 8
BAAS_VERSION: 9d1b4d628babadfb606ebcadb93b1e5cae3c9565
# 2f308db is 2024 July 10
BAAS_VERSION: 2f308db6f65333728a101d1fecbb792f9659a5ce
34 changes: 0 additions & 34 deletions src/realm/array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1068,40 +1068,6 @@ bool QueryStateFindAll<IntegerColumn>::match(size_t index) noexcept
return (m_limit > m_match_count);
}

void Array::typed_print(std::string prefix) const
{
std::cout << "Generic Array " << header_to_string(get_header()) << " @ " << m_ref;
if (!is_attached()) {
std::cout << " Unattached";
return;
}
if (size() == 0) {
std::cout << " Empty" << std::endl;
return;
}
std::cout << " size = " << size() << " {";
if (has_refs()) {
std::cout << std::endl;
for (unsigned n = 0; n < size(); ++n) {
auto pref = prefix + " " + to_string(n) + ":\t";
RefOrTagged rot = get_as_ref_or_tagged(n);
if (rot.is_ref() && rot.get_as_ref()) {
Array a(m_alloc);
a.init_from_ref(rot.get_as_ref());
std::cout << pref;
a.typed_print(pref);
}
else if (rot.is_tagged()) {
std::cout << pref << rot.get_as_int() << std::endl;
}
}
std::cout << prefix << "}" << std::endl;
}
else {
std::cout << " Leaf of unknown type }" << std::endl;
}
}

ref_type ArrayPayload::typed_write(ref_type ref, _impl::ArrayWriterBase& out, Allocator& alloc)
{
Array arr(alloc);
Expand Down
2 changes: 0 additions & 2 deletions src/realm/array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,6 @@ class Array : public Node, public ArrayParent {
/// log2. Possible results {0, 1, 2, 4, 8, 16, 32, 64}
static uint8_t bit_width(int64_t value);

void typed_print(std::string prefix) const;

protected:
friend class NodeTree;
void copy_on_write();
Expand Down
31 changes: 0 additions & 31 deletions src/realm/bplustree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -867,37 +867,6 @@ ref_type BPlusTreeBase::typed_write(ref_type ref, _impl::ArrayWriterBase& out, A
return written_node.write(out);
}

void BPlusTreeBase::typed_print(std::string prefix, Allocator& alloc, ref_type root, ColumnType col_type)
{
char* header = alloc.translate(root);
Array a(alloc);
a.init_from_ref(root);
if (NodeHeader::get_is_inner_bptree_node_from_header(header)) {
std::cout << "{" << std::endl;
REALM_ASSERT(a.has_refs());
for (unsigned j = 0; j < a.size(); ++j) {
auto pref = prefix + " " + std::to_string(j) + ":\t";
RefOrTagged rot = a.get_as_ref_or_tagged(j);
if (rot.is_ref() && rot.get_as_ref()) {
if (j == 0) {
std::cout << pref << "BPTree offsets as ArrayUnsigned as ";
Array a(alloc);
a.init_from_ref(rot.get_as_ref());
a.typed_print(prefix);
}
else {
std::cout << pref << "Subtree beeing ";
BPlusTreeBase::typed_print(pref, alloc, rot.get_as_ref(), col_type);
}
}
}
}
else {
std::cout << "BPTree Leaf[" << col_type << "] as ";
a.typed_print(prefix);
}
}

size_t BPlusTreeBase::size_from_header(const char* header)
{
auto node_size = Array::get_size_from_header(header);
Expand Down
2 changes: 0 additions & 2 deletions src/realm/bplustree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,6 @@ class BPlusTreeBase {
}

static ref_type typed_write(ref_type, _impl::ArrayWriterBase&, Allocator&, TypedWriteFunc);
static void typed_print(std::string prefix, Allocator& alloc, ref_type root, ColumnType col_type);


protected:
template <class U>
Expand Down
72 changes: 0 additions & 72 deletions src/realm/cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1700,76 +1700,4 @@ ref_type Cluster::typed_write(ref_type ref, _impl::ArrayWriterBase& out) const
}
return written_cluster.write(out);
}

void Cluster::typed_print(std::string prefix) const
{
REALM_ASSERT_DEBUG(!get_is_inner_bptree_node_from_header(get_header()));
std::cout << "Cluster of size " << size() << " " << header_to_string(get_header()) << std::endl;
const auto table = get_owning_table();
for (unsigned j = 0; j < size(); ++j) {
RefOrTagged rot = get_as_ref_or_tagged(j);
auto pref = prefix + " " + std::to_string(j) + ":\t";
if (rot.is_ref() && rot.get_as_ref()) {
if (j == 0) {
std::cout << pref << "Keys as ArrayUnsigned as ";
Array a(m_alloc);
a.init_from_ref(rot.get_as_ref());
a.typed_print(pref);
}
else {
auto col_key = table->m_leaf_ndx2colkey[j - 1];
auto col_type = col_key.get_type();
auto col_attr = col_key.get_attrs();
std::string attr_string;
if (col_attr.test(col_attr_Dictionary))
attr_string = "Dict:";
if (col_attr.test(col_attr_List))
attr_string = "List:";
if (col_attr.test(col_attr_Set))
attr_string = "Set:";
if (col_attr.test(col_attr_Nullable))
attr_string += "Null:";
std::cout << pref << "Column[" << attr_string << col_type << "] as ";
// special cases for the types we want to compress
if (col_attr.test(col_attr_List) || col_attr.test(col_attr_Set)) {
// That is a single bplustree
// propagation of nullable missing here?
// handling of mixed missing here?
BPlusTreeBase::typed_print(pref, m_alloc, rot.get_as_ref(), col_type);
}
else if (col_attr.test(col_attr_Dictionary)) {
Array dict_top(m_alloc);
dict_top.init_from_ref(rot.get_as_ref());
if (dict_top.size() == 0) {
std::cout << "{ empty }" << std::endl;
continue;
}
std::cout << "{" << std::endl;
auto ref0 = dict_top.get_as_ref(0);
if (ref0) {
auto p = pref + " 0:\t";
std::cout << p;
BPlusTreeBase::typed_print(p, m_alloc, ref0, col_type);
}
if (dict_top.size() == 1) {
continue; // is this really possible? or should all dicts have both trees?
}
auto ref1 = dict_top.get_as_ref(1);
if (ref1) {
auto p = pref + " 1:\t";
std::cout << p;
BPlusTreeBase::typed_print(p, m_alloc, dict_top.get_as_ref(1), col_type);
}
}
else {
// handle all other cases as generic arrays
Array a(m_alloc);
a.init_from_ref(rot.get_as_ref());
a.typed_print(pref);
}
}
}
}
}

} // namespace realm
8 changes: 0 additions & 8 deletions src/realm/cluster.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,6 @@ class ClusterNode : public Array {
}
virtual ref_type typed_write(ref_type ref, _impl::ArrayWriterBase& out) const = 0;

virtual void typed_print(std::string prefix) const
{
static_cast<void>(get_owning_table());
std::cout << "ClusterNode as ";
Array::typed_print(prefix);
}

protected:
#if REALM_MAX_BPNODE_SIZE > 256
static constexpr int node_shift_factor = 8;
Expand Down Expand Up @@ -328,7 +321,6 @@ class Cluster : public ClusterNode {
void verify() const;
void dump_objects(int64_t key_offset, std::string lead) const override;
virtual ref_type typed_write(ref_type ref, _impl::ArrayWriterBase& out) const override;
virtual void typed_print(std::string prefix) const override;
static void remove_backlinks(const Table* origin_table, ObjKey origin_key, ColKey col,
const std::vector<ObjKey>& keys, CascadeState& state);
static void remove_backlinks(const Table* origin_table, ObjKey origin_key, ColKey col,
Expand Down
37 changes: 0 additions & 37 deletions src/realm/cluster_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,43 +165,6 @@ class ClusterNodeInner : public ClusterNode {
return written_node.write(out);
}

virtual void typed_print(std::string prefix) const override
{
REALM_ASSERT(get_is_inner_bptree_node_from_header(get_header()));
REALM_ASSERT(has_refs());
std::cout << "ClusterNodeInner " << header_to_string(get_header()) << std::endl;
for (unsigned j = 0; j < size(); ++j) {
RefOrTagged rot = get_as_ref_or_tagged(j);
auto pref = prefix + " " + std::to_string(j) + ":\t";
if (rot.is_ref() && rot.get_as_ref()) {
if (j == 0) {
std::cout << pref << "Keys as ArrayUnsigned as ";
Array a(m_alloc);
a.init_from_ref(rot.get_as_ref());
a.typed_print(pref);
}
else {
auto header = m_alloc.translate(rot.get_as_ref());
MemRef m(header, rot.get_as_ref(), m_alloc);
if (get_is_inner_bptree_node_from_header(header)) {
ClusterNodeInner a(m_alloc, m_tree_top);
a.init(m);
std::cout << pref;
a.typed_print(pref);
}
else {
Cluster a(j, m_alloc, m_tree_top);
a.init(m);
std::cout << pref;
a.typed_print(pref);
}
}
}
// just ignore entries, which are not refs.
}
Array::typed_print(prefix);
}

private:
static constexpr size_t s_key_ref_index = 0;
static constexpr size_t s_sub_tree_depth_index = 1;
Expand Down
11 changes: 0 additions & 11 deletions src/realm/cluster_tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,17 +195,6 @@ class ClusterTree {
return m_root->typed_write(ref, out);
}

void typed_print(std::string prefix) const
{
if (m_root) {
std::cout << prefix << "ClusterTree as ";
m_root->typed_print(prefix);
}
else {
std::cout << "Emtpy ClusterTree" << std::endl;
}
}

protected:
friend class Obj;
friend class Cluster;
Expand Down
42 changes: 0 additions & 42 deletions src/realm/group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -960,48 +960,6 @@ ref_type Group::typed_write_tables(_impl::ArrayWriterBase& out) const
}
return dest.write(out);
}
void Group::table_typed_print(std::string prefix, ref_type ref) const
{
REALM_ASSERT(m_top.get_as_ref(1) == ref);
Array a(m_alloc);
a.init_from_ref(ref);
REALM_ASSERT(a.has_refs());
for (unsigned j = 0; j < a.size(); ++j) {
auto pref = prefix + " " + to_string(j) + ":\t";
RefOrTagged rot = a.get_as_ref_or_tagged(j);
if (rot.is_tagged() || rot.get_as_ref() == 0)
continue;
auto table_accessor = do_get_table(j);
REALM_ASSERT(table_accessor);
table_accessor->typed_print(pref, rot.get_as_ref());
}
}
void Group::typed_print(std::string prefix) const
{
std::cout << "Group top array" << std::endl;
for (unsigned j = 0; j < m_top.size(); ++j) {
auto pref = prefix + " " + to_string(j) + ":\t";
RefOrTagged rot = m_top.get_as_ref_or_tagged(j);
if (rot.is_ref() && rot.get_as_ref()) {
if (j == 1) {
// Tables
std::cout << pref << "All Tables" << std::endl;
table_typed_print(pref, rot.get_as_ref());
}
else {
Array a(m_alloc);
a.init_from_ref(rot.get_as_ref());
std::cout << pref;
a.typed_print(pref);
}
}
else {
std::cout << pref << rot.get_as_int() << std::endl;
}
}
std::cout << "}" << std::endl;
}


ref_type Group::DefaultTableWriter::write_names(_impl::OutputStream& out)
{
Expand Down
6 changes: 0 additions & 6 deletions src/realm/group.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,6 @@ class Group : public ArrayParent {
}
#endif
ref_type typed_write_tables(_impl::ArrayWriterBase& out) const;
void table_typed_print(std::string prefix, ref_type ref) const;
void typed_print(std::string prefix) const;

protected:
static constexpr size_t s_table_name_ndx = 0;
Expand Down Expand Up @@ -1129,10 +1127,6 @@ class Group::TableWriter {
virtual ref_type write_names(_impl::OutputStream&) = 0;
virtual ref_type write_tables(_impl::OutputStream&) = 0;
virtual HistoryInfo write_history(_impl::OutputStream&) = 0;
void typed_print(std::string prefix)
{
m_group->typed_print(prefix);
}

virtual ~TableWriter() noexcept {}

Expand Down
5 changes: 0 additions & 5 deletions src/realm/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,6 @@ class Node : public NodeHeader {
}
}

void typed_print(int) const
{
std::cout << "Generic Node ERROR\n";
}

protected:
/// The total size in bytes (including the header) of a new empty
/// array. Must be a multiple of 8 (i.e., 64-bit aligned).
Expand Down
3 changes: 3 additions & 0 deletions src/realm/object-store/results.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,9 @@ static std::vector<ExtendedColumnKey> parse_keypath(StringData keypath, Schema c
begin = sep + (sep != end);

auto prop = object_schema->property_for_public_name(key);
if (!prop) {
prop = object_schema->property_for_name(key);
}
check(prop, "property '%1.%2' does not exist", object_schema->name, key);
if (is_dictionary(prop->type)) {
check(index.length(), "missing dictionary key");
Expand Down
Loading

0 comments on commit d35c8fc

Please sign in to comment.