Skip to content

Commit

Permalink
Merge branch 'master' into ni/sync_progress_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)
  • Loading branch information
nirinchev committed Mar 21, 2024
2 parents 934cb42 + 4d707c4 commit 24fd8d5
Show file tree
Hide file tree
Showing 32 changed files with 848 additions and 441 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
25 changes: 22 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

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

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

### Breaking changes
* None.
Expand All @@ -22,6 +21,26 @@

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

# 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
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.3.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
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.3.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
7 changes: 5 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
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
18 changes: 7 additions & 11 deletions src/realm/collection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,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 @@ -278,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
5 changes: 5 additions & 0 deletions src/realm/object-store/c_api/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ static inline bson::BsonArray parse_ejson_array(const char* serialized)
}
}

RLM_API const char* realm_app_get_default_base_url(void) noexcept
{
return app::App::default_base_url.data();
}

RLM_API realm_app_credentials_t* realm_app_credentials_new_anonymous(bool reuse_credentials) noexcept
{
return new realm_app_credentials_t(AppCredentials::anonymous(reuse_credentials));
Expand Down
14 changes: 5 additions & 9 deletions src/realm/object-store/c_api/logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,17 @@ static_assert(realm_log_level_e(Logger::Level::off) == RLM_LOG_LEVEL_OFF);

class CLogger : public realm::util::Logger {
public:
CLogger(UserdataPtr userdata, realm_log_func_t log_callback, Logger::Level level)
CLogger(UserdataPtr userdata, realm_log_func_t log_callback)
: Logger()
, m_userdata(std::move(userdata))
, m_log_callback(log_callback)
{
set_level_threshold(level);
}

protected:
void do_log(const util::LogCategory&, Logger::Level level, const std::string& message) final
void do_log(const util::LogCategory& category, Logger::Level level, const std::string& message) final
{

// FIXME use category
m_log_callback(m_userdata.get(), realm_log_level_e(level), message.c_str());
m_log_callback(m_userdata.get(), category.get_name().c_str(), realm_log_level_e(level), message.c_str());
}

private:
Expand All @@ -57,13 +54,12 @@ class CLogger : public realm::util::Logger {
};
} // namespace

RLM_API void realm_set_log_callback(realm_log_func_t callback, realm_log_level_e level, realm_userdata_t userdata,
RLM_API void realm_set_log_callback(realm_log_func_t callback, realm_userdata_t userdata,
realm_free_userdata_func_t userdata_free) noexcept
{
std::shared_ptr<util::Logger> logger;
if (callback) {
logger = std::make_shared<CLogger>(UserdataPtr{userdata, userdata_free}, callback,
realm::util::Logger::Level(level));
logger = std::make_shared<CLogger>(UserdataPtr{userdata, userdata_free}, callback);
}
util::Logger::set_default_logger(std::move(logger));
}
Expand Down
Loading

0 comments on commit 24fd8d5

Please sign in to comment.