Skip to content

Commit

Permalink
Merge branch 'master' into ni/reuse_realm+master
Browse files Browse the repository at this point in the history
* master:
  update release note
  prepare v14.4.0
  sets not allowed at storage level inside mixed (#7502)
  🔄 Synced file(s) with realm/ci-actions (#7481)
  RCORE-1982 Opening realm with cached user while offline results in fatal error and session does not retry connection (#7469)
  RCORE-2008 Bump baas version (#7499)
  RCORE-2027: Setting log callback should not override existing log level hierarchy (#7494)
  Derive correct ubuntu version on linuxmint (#7471)
  Include nested path in 'OutOfBounds' error message (#7489)
  fix depth for nested collections set to 4 in debug mode (#7486)
  Set the minimum buffer size in Group::write() to be equal to the page size (#7492)
  Update the parent's content version when bumping it in a nested collection (#7470)
  release notes
  core v14.3.0 (#7482)
  RCORE-2007 Added Resumption delay configuration to SyncClientTimeouts (#7441)
  Improve performance of aggregate operations on empty dictionaries (#7418)
  • Loading branch information
nirinchev committed Mar 22, 2024
2 parents e95e4b4 + 4d707c4 commit 1dc5375
Show file tree
Hide file tree
Showing 44 changed files with 1,038 additions and 500 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/lock-threads.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 'Lock Threads'

on:
schedule:
- cron: '0 * * * *'
workflow_dispatch:

permissions:
issues: write
pull-requests: write
discussions: write

concurrency:
group: lock-threads

jobs:
action:
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v5
with:
issue-inactive-days: 30
pr-inactive-days: 30
log-output: true
45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,53 @@
# NEXT RELEASE

### Enhancements
* <New feature description> (PR [#????](https://github.com/realm/realm-core/pull/????))
* None.

### Fixed
* <How do the end-user experience this issue? what was the impact?> ([#????](https://github.com/realm/realm-core/issues/????), since v?.?.?)
* None.

### 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
* None.

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

# 14.4.0 Release notes

### Enhancements
* Nested path included in 'OutOfBoundsø error message ([#7438](https://github.com/realm/realm-core/issues/7438))
* Improve file compaction performance on platforms with page sizes greater than 4k (for example arm64 Apple platforms) for files less than 256 pages in size ([PR #7492](https://github.com/realm/realm-core/pull/7492)).

### Fixed
* Modifying nested collections left the accessor used to make the modification in a stale state, resulting in some unneccesary work being done when making multiple modifications via one accessor ([PR #7470](https://github.com/realm/realm-core/pull/7470), since v14.0.0).
* Fix depth level for nested collection in debug mode, set it to the same level as release ([#7484](https://github.com/realm/realm-core/issues/7484), since v14.0.0).
* Fix opening realm with cached user while offline results in fatal error and session does not retry connection. ([#7349](https://github.com/realm/realm-core/issues/7349), since v13.26.0)
* Fix disallow Sets in ArrayMixed. ([#7502](https://github.com/realm/realm-core/pull/7502), since v14.0.0)

### Breaking changes
* Update C-API log callback signature to include the log category, and `realm_set_log_callback` to not take a `realm_log_level_e`. ([PR #7494](https://github.com/realm/realm-core/pull/7494)

### 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.

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

# 14.3.0 Release notes

### Enhancements
* Add support to synchronize collections embedded in Mixed properties and other collections (except sets) ([PR #7353](https://github.com/realm/realm-core/pull/7353)).
* Improve performance of change notifications on nested collections somewhat ([PR #7402](https://github.com/realm/realm-core/pull/7402)).
* Improve performance of aggregate operations on Dictionaries of objects, particularly when the dictionaries are empty ([PR #7418](https://github.com/realm/realm-core/pull/7418))
* Added Resumption delay configuration to SyncClientTimeouts. ([PR #7441](https://github.com/realm/realm-core/pull/7441))

### Fixed
* Fixed conflict resolution bug which may result in an crash when the AddInteger instruction on Mixed properties is merged against updates to a non-integer type ([PR #7353](https://github.com/realm/realm-core/pull/7353)).
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.2.0"
let versionStr = "14.4.0"
let versionPieces = versionStr.split(separator: "-")
let versionCompontents = versionPieces[0].split(separator: ".")
let versionExtra = versionPieces.count > 1 ? versionPieces[1] : ""
Expand Down
18 changes: 18 additions & 0 deletions bindgen/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,21 @@ records:
before_notify: 'Nullable<util::UniqueFunction<(r: SharedRealm)>>'
schema_did_change: 'Nullable<util::UniqueFunction<(r: SharedRealm)>>' # new schema available as r.schema

ResumptionDelayInfo:
fields:
max_resumption_delay_interval:
type: std::chrono::milliseconds
default: 3000000
resumption_delay_interval:
type: std::chrono::milliseconds
default: 1000
resumption_delay_backoff_multiplier:
type: int
default: 2
delay_jitter_divisor:
type: int
default: 4

SyncClientTimeouts:
fields:
connect_timeout:
Expand All @@ -570,6 +585,9 @@ records:
fast_reconnect_limit:
type: uint64_t
default: 60000
reconnect_backoff_info:
type: ResumptionDelayInfo
default: {}

SyncClientConfig:
fields:
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.2.0
VERSION: 14.4.0
OPENSSL_VERSION: 3.2.0
ZLIB_VERSION: 1.2.13
# https://github.com/10gen/baas/commits
# acb71d0 is 2024 Mar 12
BAAS_VERSION: acb71d0183b33eb304bb496390567efcfb8a6e60
# 6bf5e1 is 2024 Mar 20
BAAS_VERSION: 6bf5e111499ba32d04224e2fc10acca3595edb20
13 changes: 13 additions & 0 deletions evergreen/install_baas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,19 @@ function setup_baas_dependencies() {
DISTRO_NAME="$(. /etc/os-release ; echo "${ID}")"
DISTRO_VERSION="$(. /etc/os-release ; echo "${VERSION_ID}")"
DISTRO_VERSION_MAJOR="$(cut -d. -f1 <<< "${DISTRO_VERSION}")"
if [[ "${DISTRO_NAME}" == "linuxmint" ]]; then
CODENAME="$(. /etc/os-release ; echo "${UBUNTU_CODENAME}")"
case "${CODENAME}" in
bionic) DISTRO_VERSION_MAJOR=18;;
focal) DISTRO_VERSION_MAJOR=20;;
jammy) DISTRO_VERSION_MAJOR=22;;
# noble) DISTRO_VERSION_MAJOR=24;;
*)
echo "Error: unsupported version of linuxmint ${DISTRO_VERSION}"
exit 1
;;
esac
fi
elif [[ -e /etc/redhat-release ]]; then
# /etc/redhat-release covers RHEL
DISTRO_NAME=rhel
Expand Down
2 changes: 1 addition & 1 deletion external/catch
Submodule catch updated 251 files
13 changes: 11 additions & 2 deletions src/realm.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ typedef bool (*realm_migration_func_t)(realm_userdata_t userdata, realm_t* old_r
typedef bool (*realm_data_initialization_func_t)(realm_userdata_t userdata, realm_t* realm);
typedef bool (*realm_should_compact_on_launch_func_t)(realm_userdata_t userdata, uint64_t total_bytes,
uint64_t used_bytes);

typedef enum realm_schema_mode {
RLM_SCHEMA_MODE_AUTOMATIC,
RLM_SCHEMA_MODE_IMMUTABLE,
Expand Down Expand Up @@ -594,12 +595,13 @@ typedef enum realm_log_level {
RLM_LOG_LEVEL_OFF = 8,
} realm_log_level_e;

typedef void (*realm_log_func_t)(realm_userdata_t userdata, realm_log_level_e level, const char* message);
typedef void (*realm_log_func_t)(realm_userdata_t userdata, const char* category, realm_log_level_e level,
const char* message);

/**
* Install the default logger
*/
RLM_API void realm_set_log_callback(realm_log_func_t, realm_log_level_e, realm_userdata_t userdata,
RLM_API void realm_set_log_callback(realm_log_func_t, realm_userdata_t userdata,
realm_free_userdata_func_t userdata_free) RLM_API_NOEXCEPT;
RLM_API void realm_set_log_level(realm_log_level_e) RLM_API_NOEXCEPT;
/**
Expand Down Expand Up @@ -2976,6 +2978,7 @@ RLM_API realm_auth_provider_e realm_auth_credentials_get_provider(realm_app_cred
RLM_API realm_app_config_t* realm_app_config_new(const char* app_id,
const realm_http_transport_t* http_transport) RLM_API_NOEXCEPT;

RLM_API const char* realm_app_get_default_base_url(void) RLM_API_NOEXCEPT;
RLM_API void realm_app_config_set_base_url(realm_app_config_t*, const char*) RLM_API_NOEXCEPT;
RLM_API void realm_app_config_set_default_request_timeout(realm_app_config_t*, uint64_t ms) RLM_API_NOEXCEPT;
RLM_API void realm_app_config_set_platform_version(realm_app_config_t*, const char*) RLM_API_NOEXCEPT;
Expand Down Expand Up @@ -3644,6 +3647,12 @@ RLM_API void realm_sync_client_config_set_pong_keepalive_timeout(realm_sync_clie
uint64_t) RLM_API_NOEXCEPT;
RLM_API void realm_sync_client_config_set_fast_reconnect_limit(realm_sync_client_config_t*,
uint64_t) RLM_API_NOEXCEPT;
RLM_API void realm_sync_client_config_set_resumption_delay_interval(realm_sync_client_config_t*,
uint64_t) RLM_API_NOEXCEPT;
RLM_API void realm_sync_client_config_set_max_resumption_delay_interval(realm_sync_client_config_t*,
uint64_t) RLM_API_NOEXCEPT;
RLM_API void realm_sync_client_config_set_resumption_delay_backoff_multiplier(realm_sync_client_config_t*,
int) RLM_API_NOEXCEPT;
RLM_API void realm_sync_client_config_set_sync_socket(realm_sync_client_config_t*,
realm_sync_socket_t*) RLM_API_NOEXCEPT;
RLM_API void realm_sync_client_config_set_default_binding_thread_observer(
Expand Down
2 changes: 1 addition & 1 deletion src/realm/array_mixed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ int64_t ArrayMixed::store(const Mixed& value)
break;
}
default:
REALM_ASSERT(type == type_List || type == type_Dictionary || type == type_Set);
REALM_ASSERT(type == type_List || type == type_Dictionary);
ensure_ref_array();
size_t ndx = m_refs.size();
m_refs.add(value.get_ref());
Expand Down
9 changes: 9 additions & 0 deletions src/realm/collection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,13 @@ UpdateStatus CollectionBase::do_init_from_parent(BPlusTreeBase* tree, ref_type r
return UpdateStatus::Updated;
}

void CollectionBase::out_of_bounds(const char* msg, size_t index, size_t size) const
{
auto path = get_short_path();
path.erase(path.begin());
throw OutOfBounds(util::format("%1 on %2 '%3.%4%5'", msg, collection_type_name(get_collection_type()),
get_table()->get_class_name(), get_property_name(), path),
index, size);
}

} // namespace realm
61 changes: 29 additions & 32 deletions src/realm/collection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class DummyParent : public CollectionParent {
{
return 0;
}
void update_content_version() const noexcept final {}

protected:
Obj m_obj;
Expand Down Expand Up @@ -175,6 +176,12 @@ class CollectionBase : public Collection {
return PathElement(ndx);
}

// Clone this collection if it contains objects, and return nullptr otherwise
virtual LinkCollectionPtr clone_as_obj_list() const
{
return nullptr;
}

/// Return true if the collection has changed since the last call to
/// `has_changed()`. Note that this function is not idempotent and updates
/// the internal state of the accessor if it has changed.
Expand Down Expand Up @@ -202,7 +209,7 @@ class CollectionBase : public Collection {
}

/// If this is a collection of links, get the target table.
virtual TableRef get_target_table() const final
TableRef get_target_table() const
{
return get_obj().get_target_table(get_col_key());
}
Expand Down Expand Up @@ -254,7 +261,13 @@ class CollectionBase : public Collection {
CollectionBase& operator=(const CollectionBase&) noexcept = default;
CollectionBase& operator=(CollectionBase&&) noexcept = default;

void validate_index(const char* msg, size_t index, size_t size) const;
void validate_index(const char* msg, size_t index, size_t size) const
{
if (index >= size) {
out_of_bounds(msg, index, size);
}
}
void out_of_bounds(const char* msg, size_t index, size_t size) const;
static UpdateStatus do_init_from_parent(BPlusTreeBase* tree, ref_type ref, bool allow_create);
};

Expand All @@ -271,16 +284,6 @@ inline std::string_view collection_type_name(CollectionType col_type, bool upper
return "";
}

inline void CollectionBase::validate_index(const char* msg, size_t index, size_t size) const
{
if (index >= size) {
throw OutOfBounds(util::format("%1 on %2 '%3.%4'", msg, collection_type_name(get_collection_type()),
get_table()->get_class_name(), get_property_name()),
index, size);
}
}


template <class T>
inline void check_column_type(ColKey col)
{
Expand Down Expand Up @@ -682,13 +685,14 @@ class CollectionBaseImpl : public Interface, protected ArrayParent {
return status == UpdateStatus::Updated;
}

void bump_content_version()
void bump_content_version() noexcept
{
REALM_ASSERT(m_alloc);
m_content_version = m_alloc->bump_content_version();
m_parent->update_content_version();
}

void update_content_version() const
void update_content_version() const noexcept
{
REALM_ASSERT(m_alloc);
m_content_version = m_alloc->get_content_version();
Expand All @@ -699,6 +703,7 @@ class CollectionBaseImpl : public Interface, protected ArrayParent {
REALM_ASSERT(m_alloc);
m_alloc->bump_content_version();
m_alloc->bump_storage_version();
m_parent->update_content_version();
}

Replication* get_replication() const
Expand Down Expand Up @@ -815,24 +820,12 @@ void update_unresolved(std::vector<size_t>& vec, const BPlusTree<ObjKey>* tree);

/// Clear the context flag on the tree if there are no more unresolved links.
void check_for_last_unresolved(BPlusTree<ObjKey>* tree);

/// Proxy class needed because the ObjList interface clobbers method names from
/// CollectionBase.
struct ObjListProxy : ObjList {
virtual TableRef proxy_get_target_table() const = 0;

TableRef get_target_table() const final
{
return proxy_get_target_table();
}
};

} // namespace _impl

/// Base class for collections of objects, where unresolved links (tombstones)
/// can occur.
template <class Interface>
class ObjCollectionBase : public Interface, public _impl::ObjListProxy {
class ObjCollectionBase : public Interface, public ObjList {
public:
static_assert(std::is_base_of_v<CollectionBase, Interface>);

Expand Down Expand Up @@ -868,7 +861,15 @@ class ObjCollectionBase : public Interface, public _impl::ObjListProxy {
return m_unresolved.size() != 0;
}

using Interface::get_target_table;
LinkCollectionPtr clone_as_obj_list() const final
{
return clone_obj_list();
}

TableRef get_target_table() const final
{
return Interface::get_target_table();
}

protected:
ObjCollectionBase() = default;
Expand Down Expand Up @@ -956,10 +957,6 @@ class ObjCollectionBase : public Interface, public _impl::ObjListProxy {
// Sorted set of indices containing unresolved links.
mutable std::vector<size_t> m_unresolved;

TableRef proxy_get_target_table() const final
{
return Interface::get_target_table();
}
bool matches(const ObjList& other) const final
{
return get_owning_obj().get_key() == other.get_owning_obj().get_key() &&
Expand Down
7 changes: 3 additions & 4 deletions src/realm/collection_parent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ class CollectionParent : public std::enable_shared_from_this<CollectionParent> {
virtual size_t find_index(const Index& ndx) const = 0;
/// Get table of owning object
virtual TableRef get_table() const noexcept = 0;
// Reread the content version from the allocator. Called when a child makes
// a write to mark the already up-to-date parent as still being up-to-date.
virtual void update_content_version() const noexcept = 0;

static LstBasePtr get_listbase_ptr(ColKey col_key, size_t level);
static SetBasePtr get_setbase_ptr(ColKey col_key, size_t level);
Expand All @@ -109,11 +112,7 @@ class CollectionParent : public std::enable_shared_from_this<CollectionParent> {
friend class CollectionBaseImpl;
friend class CollectionList;

#ifdef REALM_DEBUG
static constexpr size_t s_max_level = 4;
#else
static constexpr size_t s_max_level = 100;
#endif
uint8_t m_level = 0;

constexpr CollectionParent(uint8_t level = 0)
Expand Down
8 changes: 8 additions & 0 deletions src/realm/dictionary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,14 @@ void Dictionary::set_collection_ref(Index index, ref_type ref, CollectionType ty
m_values->set(ndx, Mixed(ref, type));
}

LinkCollectionPtr Dictionary::clone_as_obj_list() const
{
if (get_value_data_type() == type_Link) {
return std::make_unique<DictionaryLinkValues>(*this);
}
return nullptr;
}

/************************* DictionaryLinkValues *************************/

DictionaryLinkValues::DictionaryLinkValues(const Obj& obj, ColKey col_key)
Expand Down
Loading

0 comments on commit 1dc5375

Please sign in to comment.