Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consume monorepo core binaries #7241

Merged
merged 34 commits into from
Jan 8, 2021
Merged

Conversation

clementetb
Copy link
Collaborator

@clementetb clementetb commented Dec 9, 2020

This PR adds the option to consume prebuild realm-core monorepo release artifacts, with the intention of minimizing the CI timings.

  • Allow to consume realm-core release artifacts.
  • Update Jenkins file to consume binaries instead.
  • Update Readme with new build instructions.

Warning: This PR will fail to run due to an error in the CMake file distributed in the release artifacts.

fealebenpae and others added 6 commits November 9, 2020 13:08
* Use monorepo

* Use newer CMake

* use latest monorepo

* Point to right cmake version
Jenkins to use right cmake version
Fix imports and executables linking

* Fix cmake url

* Add ninja-build package to docker image

* Add new cmake instructions to readme

* don’t worry about realm-core’s command-line targets

* use latest monorepo

* Add support for LTO. It is enabled by default for release builds, but can be opted out of.

* Rename abiFilter to indicate it support multiple flags

* Set an optimization level, it is required when enabling LTO.

* Bump core commit

* Bump monorepo core version

* rollback mongodb realm server version

* Fix checkstyle step in Jenkins file

* remove the gradle logic to download core

this should be moved to CMake

Co-authored-by: Clemente Tort <clementetb@gmail.com>
Co-authored-by: Christian Melchior <christian@ilios.dk>
# Conflicts:
#	realm/realm-library/src/main/cpp/object-store
@clementetb clementetb self-assigned this Dec 9, 2020
Copy link
Member

@fealebenpae fealebenpae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, great job!

realm/realm-library/src/main/cpp/CMakeLists.txt Outdated Show resolved Hide resolved
realm/realm-library/src/main/cpp/CMakeLists.txt Outdated Show resolved Hide resolved
realm/realm-library/src/main/cpp/CMakeLists.txt Outdated Show resolved Hide resolved
@clementetb
Copy link
Collaborator Author

Sizes for generated JNI binaries:

// Unzip AAR and run 
// find . -name "*.so" -print0 | xargs -0 stat -f '%z %N'

~~ Consuming generated core artifacts ~~
Object server
5804092 ./armeabi-v7a/librealm-jni.so
8822288 ./x86/librealm-jni.so
8244096 ./arm64-v8a/librealm-jni.so
9096584 ./x86_64/librealm-jni.so
-----------

~~ Building core from source, LTO disabled ~~
Base
4342636 ./armeabi-v7a/librealm-jni.so
6516976 ./x86/librealm-jni.so
6132184 ./arm64-v8a/librealm-jni.so
6816712 ./x86_64/librealm-jni.so
-----------
Object server
5808188 ./armeabi-v7a/librealm-jni.so
8826384 ./x86/librealm-jni.so
8244096 ./arm64-v8a/librealm-jni.so
9096584 ./x86_64/librealm-jni.so
-----------

~~ Building core from source, LTO enabled ~~
Base
4313964 ./armeabi-v7a/librealm-jni.so
6275256 ./x86/librealm-jni.so
5780064 ./arm64-v8a/librealm-jni.so
6644552 ./x86_64/librealm-jni.so
-----------
Object server
5644348 ./armeabi-v7a/librealm-jni.so
8261064 ./x86/librealm-jni.so
7601168 ./arm64-v8a/librealm-jni.so
8637688 ./x86_64/librealm-jni.so
-----------

~~ Building core from source, query parser enabled, LTO disabled ~~
Base
4342636 ./armeabi-v7a/librealm-jni.so
6516976 ./x86/librealm-jni.so
6132184 ./arm64-v8a/librealm-jni.so
6816712 ./x86_64/librealm-jni.so
-----------
Object server
5808188 ./armeabi-v7a/librealm-jni.so
8826384 ./x86/librealm-jni.so
8244096 ./arm64-v8a/librealm-jni.so
9096584 ./x86_64/librealm-jni.so
-----------

Copy link
Contributor

@cmelchior cmelchior left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I'm a bit concerned about the number of ignored tests though. It could indicate we should wait with merging this until that has been fixed?

@@ -113,6 +114,7 @@
*/

@RunWith(Parameterized.class)
@Ignore("Tests crash due to bug in core, see https://jira.mongodb.org/browse/RCORE-435")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still a problem? At least the comments in the issue seems to indicate it has been fixed?

If it hasn't been fixed, how critical is it?

Copy link
Collaborator Author

@clementetb clementetb Dec 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has been fixed but hasn't been released yet. It is on the core develop branch.

The issue crashes the test process, and it would crash any app. We shouldn't release without fixing the issue.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, in that case, I would put this PR on hold until we can get a fix from Core. But otherwise I would say this PR is ready to be merge.

@@ -75,6 +75,7 @@
import static org.junit.Assume.assumeThat;

@RunWith(AndroidJUnit4.class)
@Ignore("Tests crash due to bug in core, see https://jira.mongodb.org/browse/RCORE-435")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still relevant?

@@ -68,6 +68,7 @@
import static org.junit.Assert.fail;

@RunWith(AndroidJUnit4.class)
@Ignore("Tests crash due to bug in core, see https://jira.mongodb.org/browse/RCORE-435")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same?

@@ -135,6 +135,7 @@


@RunWith(AndroidJUnit4.class)
@Ignore("Tests crash due to bug in core, see https://jira.mongodb.org/browse/RCORE-435")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same?

CHANGELOG.md Outdated
@@ -1,3 +1,25 @@
## 10.3.0 (YYYY-MM-DD)

### Deprecated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We normally leave this out if nothing here.

CHANGELOG.md Outdated
### Deprecated
* None.

### Breaking Changes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We normally leave this section out if nothing here.

CHANGELOG.md Outdated
* None.

### Compatibility
* None.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy the section from previous releases here.

Copy link
Contributor

@rorbech rorbech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had some minor comments.

@@ -91,6 +91,7 @@ try {
// But still build all ABI's and run all types of tests.
useEmulator = true
emulatorImage = "system-images;android-29;default;x86"
buildFlags = "-PenableLTO=true -PbuildCore=true"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For traceability/reproducability etc. I would assume that it safest to do release from the prebuilts. Is it safe to to the release from locally build cores? Or don't we get the benefits of optimizations unless we build it?

* Install CMake version 3.18.2 and build Ninja.
* Install the NDK (currently r21) from the SDK Manager in Android Studio or using the [website](https://developer.android.com/ndk/downloads). If downloaded
You may unzip the file wherever you choose. For macOS, a suggested location is `~/Library`. The download will unzip as the directory `android-ndk-r21`.
* Install the NDK (Side-by-side) **21.0.6113669** from the SDK Manager in Android Studio. Remember to check `☑ Show package details` in the manager to display all available versions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this download automatically when we specify the ndkVersion through the Android Gradle Plugin.

```

* If you'd like to specify the location in which to store the archives of Realm Core, define the `REALM_CORE_DOWNLOAD_DIR` environment variable. It enables you to keep Core's archive when executing `git clean -xfd`.
* If you'd like to specify the location in which to store the archives of Realm Core, define the `REALM_CORE_DOWNLOAD_DIR` environment variable. It enables caching core release artifacts.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* If you'd like to specify the location in which to store the archives of Realm Core, define the `REALM_CORE_DOWNLOAD_DIR` environment variable. It enables caching core release artifacts.
* If you'd like to specify the location in which to store the archives of Realm Core, define the `REALM_CORE_DOWNLOAD_DIR` environment variable. It enables caching of downloaded core release artifacts.

CHANGELOG.md Outdated
* None.

### Fixes
* None.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably add a comment about https://jira.mongodb.org/browse/HELP-21241. Maybe something like * [RealmApp] Sometimes getting Index out of range error when integrating a remote Sync changeset into the local Realm

It is a bit vague, but not sure I can come up with something more specific that doesn't involve writing 10s of lines of text.

Copy link
Contributor

@cmelchior cmelchior left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If CI is happy 🚀

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
clementetb and others added 3 commits January 8, 2021 15:40
Co-authored-by: Christian Melchior <christian@ilios.dk>
Co-authored-by: Christian Melchior <christian@ilios.dk>
* None.

### Fixes
* [RealmApp] Integrating a remote Sync changeset into the local Realm could result in an `Index out of range error`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the Core release has a few other fixes we should also mention. Sorry for not catching this earlier. https://github.com/realm/realm-core/blob/master/CHANGELOG.md#1033-release-notes

I would propose changing it to this:

* [RealmApp] Integrating a remote Sync changeset into the local Realm could result in an `Index out of range error`.
* Change notifications not firing when removing and adding an object with the same primary key within a transaction (Issue [#7098](https://github.com/realm/realm-java/issues/7098)).
* Race condition which would lead to "uncaught exception in notifier thread: N5realm15InvalidTableRefE: transaction_ended" and a crash when the source Realm was closed or invalidated at a very specific time during the first run of a collection notifier (Core issue [#3761](https://github.com/realm/realm-core/issues/3761), since v7.0.0).
* Deleting and recreating objects with embedded objects could fail (Core issue [#4240](https://github.com/realm/realm-core/pull/4240), since v10.0.0)

But feel free to do that after CI has run, no reason to retrigger it for a doc update.

@clementetb clementetb changed the base branch from core-monorepo to master January 8, 2021 16:19
# Conflicts:
#	CHANGELOG.md
#	realm/realm-library/src/main/cpp/object-store
@clementetb clementetb merged commit b23e73e into master Jan 8, 2021
@clementetb clementetb deleted the ct/consume-monorepo-binaries branch January 8, 2021 16:30
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RealmChangeListener not triggered, after object was deleted and replaced with same primary key.
5 participants