Skip to content

Commit 7556b53

Browse files
Test FLX sync geospatial queries (#7042)
* add tests for FLX geospatial * update tests for new BAAS error messages * fix several hangs in tests download/upload/advance may have already happened by the time the test code gets to the wait_for_upload() line which results in the test hanging forever because there are no further changes. A fix is to do a timed wait for the expected state which will succeed immediately if the same race occurs. * revert polling waits in tests * fix an error if recovering schema changes in dev mode * add additional tests * don't overcomplicate the test * lint --------- Co-authored-by: Daniel Tabacaru <96778637+danieltabacaru@users.noreply.github.com>
1 parent 3571738 commit 7556b53

File tree

9 files changed

+163
-96
lines changed

9 files changed

+163
-96
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
### Fixed
88
* <How do the end-user experience this issue? what was the impact?> ([#????](https://github.com/realm/realm-core/issues/????), since v?.?.?)
99
* A crash at a very specific time during a DiscardLocal client reset on a FLX Realm could leave subscriptions in an invalid state ([#7110](https://github.com/realm/realm-core/pull/7110), since v12.3.0).
10+
* Fixed an error "Invalid schema change (UPLOAD): cannot process AddColumn instruction for non-existent table" when using automatic client reset with recovery in dev mode to recover schema changes made locally while offline. ([#7042](https://github.com/realm/realm-core/pull/7042) since the server introduced the feature that allows client to redefine the server's schema if the server is in dev mode - fall 2023)
1011

1112
### Breaking changes
1213
* None.

dependencies.list

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ PACKAGE_NAME=realm-core
22
VERSION=13.23.3
33
OPENSSL_VERSION=3.0.8
44
ZLIB_VERSION=1.2.13
5-
MDBREALM_TEST_SERVER_TAG=2023-08-11
5+
MDBREALM_TEST_SERVER_TAG=2023-10-20

evergreen/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ tasks:
887887
commands:
888888
- func: "launch remote baas"
889889
vars:
890-
baas_branch: 3f31617aacfe5d31b9057fc298b735b60acd6424
890+
baas_branch: 27f42f55a7944ed7d8ba9fad1854a4b22714cb8d
891891
- func: "compile"
892892
vars:
893893
target_to_build: ObjectStoreTests

evergreen/config_overrides.json

Lines changed: 0 additions & 16 deletions
This file was deleted.

evergreen/install_baas.sh

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ case $(uname -s) in
1717
Darwin)
1818
if [[ "$(uname -m)" == "arm64" ]]; then
1919
export GOARCH=arm64
20-
STITCH_SUPPORT_LIB_URL="https://s3.amazonaws.com/static.realm.io/stitch-support/stitch-support-macos-arm64-6.1.0-rc3-8-gb6e0525.tgz"
21-
STITCH_ASSISTED_AGG_URL="https://stitch-artifacts.s3.amazonaws.com/stitch-mongo-libs/stitch_mongo_libs_osx_patch_75b3f1896aaa2e344817795c8bfc5cb6b2f2c310_632211a5d1fe0757f8c416fa_22_09_14_17_38_46/assisted_agg"
22-
GO_URL="https://s3.amazonaws.com/static.realm.io/evergreen-assets/go1.19.3.darwin-arm64.tar.gz"
20+
STITCH_SUPPORT_LIB_URL="https://stitch-artifacts.s3.amazonaws.com/stitch-support/macos-arm64/stitch-support-6.1.0-alpha-527-g796351f.tgz"
21+
STITCH_ASSISTED_AGG_URL="https://stitch-artifacts.s3.amazonaws.com/stitch-mongo-libs/stitch_mongo_libs_osx_patch_1e7861d9b7462f01ea220fad334f10e00f0f3cca_6513254ad6d80abfffa5fbdc_23_09_26_18_39_06/assisted_agg"
22+
GO_URL="https://s3.amazonaws.com/static.realm.io/evergreen-assets/go1.21.1.darwin-arm64.tar.gz"
2323
MONGODB_DOWNLOAD_URL="https://downloads.mongodb.com/osx/mongodb-macos-arm64-enterprise-6.0.0-rc13.tgz"
2424
MONGOSH_DOWNLOAD_URL="https://downloads.mongodb.com/compass/mongosh-1.5.0-darwin-arm64.zip"
2525

@@ -34,21 +34,28 @@ case $(uname -s) in
3434
export GOMAXPROCS
3535
else
3636
export GOARCH=amd64
37-
STITCH_SUPPORT_LIB_URL="https://s3.amazonaws.com/static.realm.io/stitch-support/stitch-support-macos-4.4.17-rc1-2-g85de0cc.tgz"
38-
STITCH_ASSISTED_AGG_URL="https://stitch-artifacts.s3.amazonaws.com/stitch-mongo-libs/stitch_mongo_libs_osx_patch_75b3f1896aaa2e344817795c8bfc5cb6b2f2c310_632211a5d1fe0757f8c416fa_22_09_14_17_38_46/assisted_agg"
39-
GO_URL="https://s3.amazonaws.com/static.realm.io/evergreen-assets/go1.19.1.darwin-amd64.tar.gz"
37+
STITCH_SUPPORT_LIB_URL="https://stitch-artifacts.s3.amazonaws.com/stitch-support/macos-arm64/stitch-support-4.4.17-rc1-2-g85de0cc.tgz"
38+
STITCH_ASSISTED_AGG_URL="https://stitch-artifacts.s3.amazonaws.com/stitch-mongo-libs/stitch_mongo_libs_osx_patch_1e7861d9b7462f01ea220fad334f10e00f0f3cca_6513254ad6d80abfffa5fbdc_23_09_26_18_39_06/assisted_agg"
39+
GO_URL="https://s3.amazonaws.com/static.realm.io/evergreen-assets/go1.21.1.darwin-amd64.tar.gz"
4040
MONGODB_DOWNLOAD_URL="https://downloads.mongodb.com/osx/mongodb-macos-x86_64-enterprise-5.0.3.tgz"
4141
fi
4242

4343
NODE_URL="https://s3.amazonaws.com/static.realm.io/evergreen-assets/node-v14.17.0-darwin-x64.tar.gz"
4444
JQ_DOWNLOAD_URL="https://s3.amazonaws.com/static.realm.io/evergreen-assets/jq-1.6-darwin-amd64"
4545
;;
4646
Linux)
47-
GO_URL="https://s3.amazonaws.com/static.realm.io/evergreen-assets/go1.19.1.linux-amd64.tar.gz"
47+
GO_URL="https://s3.amazonaws.com/static.realm.io/evergreen-assets/go1.21.1.linux-amd64.tar.gz"
4848
JQ_DOWNLOAD_URL="https://s3.amazonaws.com/static.realm.io/evergreen-assets/jq-1.6-linux-amd64"
4949
NODE_URL="https://s3.amazonaws.com/static.realm.io/evergreen-assets/node-v14.17.0-linux-x64.tar.gz"
5050

51-
# Detect what distro/versionf of Linux we are running on to download the right version of MongoDB to download
51+
# Only x86_64 Linux machines are supported
52+
linux_arch="$(uname -m)"
53+
if [[ "${linux_arch}" != "x86_64" ]]; then
54+
echo "Error: only x86_64 Linux machines are supported: ${linux_arch}"
55+
exit 1
56+
fi
57+
58+
# Detect what distro/version of Linux we are running on to determine the right version of MongoDB to download
5259
# /etc/os-release covers debian/ubuntu/suse
5360
if [[ -e /etc/os-release ]]; then
5461
# Amazon Linux 2 comes back as 'amzn'
@@ -64,49 +71,49 @@ case $(uname -s) in
6471
case $DISTRO_NAME in
6572
ubuntu | linuxmint)
6673
MONGODB_DOWNLOAD_URL="http://downloads.10gen.com/linux/mongodb-linux-$(uname -m)-enterprise-ubuntu${DISTRO_VERSION_MAJOR}04-5.0.3.tgz"
67-
STITCH_ASSISTED_AGG_LIB_URL="https://stitch-artifacts.s3.amazonaws.com/stitch-mongo-libs/stitch_mongo_libs_ubuntu2004_x86_64_86b48e3cb2a8d5bbf3d18281c9f42c1835bbb83b_22_11_08_03_08_06/libmongo-ubuntu2004-x86_64.so"
74+
STITCH_ASSISTED_AGG_LIB_URL="https://stitch-artifacts.s3.amazonaws.com/stitch-mongo-libs/stitch_mongo_libs_ubuntu2004_x86_64_patch_1e7861d9b7462f01ea220fad334f10e00f0f3cca_65135b432fbabe741bd24429_23_09_26_22_29_24/libmongo-ubuntu2004-x86_64.so"
6875
STITCH_SUPPORT_LIB_URL="https://s3.amazonaws.com/static.realm.io/stitch-support/stitch-support-ubuntu2004-4.4.17-rc1-2-g85de0cc.tgz"
6976
;;
7077
rhel)
7178
case ${DISTRO_VERSION_MAJOR} in
7279
7)
7380
MONGODB_DOWNLOAD_URL="https://downloads.mongodb.com/linux/mongodb-linux-x86_64-enterprise-rhel70-5.0.3.tgz"
74-
STITCH_ASSISTED_AGG_LIB_URL="https://stitch-artifacts.s3.amazonaws.com/stitch-mongo-libs/stitch_mongo_libs_linux_64_86b48e3cb2a8d5bbf3d18281c9f42c1835bbb83b_22_11_08_03_08_06/libmongo.so"
75-
STITCH_SUPPORT_LIB_URL="https://s3.amazonaws.com/static.realm.io/stitch-support/stitch-support-rhel70-4.4.17-rc1-2-g85de0cc.tgz"
81+
STITCH_ASSISTED_AGG_LIB_URL="https://stitch-artifacts.s3.amazonaws.com/stitch-mongo-libs/stitch_mongo_libs_linux_64_patch_1e7861d9b7462f01ea220fad334f10e00f0f3cca_65135b432fbabe741bd24429_23_09_26_22_29_24/libmongo.so"
82+
STITCH_SUPPORT_LIB_URL="https://stitch-artifacts.s3.amazonaws.com/stitch-support/linux-x64/stitch-support-4.4.17-rc1-2-g85de0cc.tgz"
7683
;;
7784
*)
78-
echo "Unsupported version of RHEL ${DISTRO_VERSION}"
85+
echo "Error: unsupported version of RHEL ${DISTRO_VERSION}"
7986
exit 1
8087
;;
8188
esac
8289
;;
8390
*)
8491
if [[ -z "${MONGODB_DOWNLOAD_URL}" ]]; then
85-
echo "Missing MONGODB_DOWNLOAD_URL env variable to download mongodb from."
92+
echo "Error: missing MONGODB_DOWNLOAD_URL env variable to download mongodb from."
8693
exit 1
8794
fi
8895
if [[ -z "${STITCH_ASSISTED_AGG_LIB_PATH}" ]]; then
89-
echo "Missing STITCH_ASSISTED_AGG_LIB_PATH env variable to find assisted agg libmongo.so"
96+
echo "Error: missing STITCH_ASSISTED_AGG_LIB_PATH env variable to find assisted agg libmongo.so"
9097
exit 1
9198
fi
9299
if [[ -z "${STITCH_SUPPORT_LIB_PATH}" ]]; then
93-
echo "Missing STITCH_SUPPORT_LIB_PATH env variable to find the mongo stitch support library"
100+
echo "Error: missing STITCH_SUPPORT_LIB_PATH env variable to find the mongo stitch support library"
94101
exit 1
95102
fi
96103
;;
97104
esac
98105
;;
99106
*)
100107
if [[ -z "${MONGODB_DOWNLOAD_URL}" ]]; then
101-
echo "Missing MONGODB_DOWNLOAD_URL env variable to download mongodb from."
108+
echo "Error: missing MONGODB_DOWNLOAD_URL env variable to download mongodb from."
102109
exit 1
103110
fi
104111
if [[ -z "${STITCH_ASSISTED_AGG_LIB_PATH}" ]]; then
105-
echo "Missing STITCH_ASSISTED_AGG_LIB_PATH env variable to find assisted agg libmongo.so"
112+
echo "Error: missing STITCH_ASSISTED_AGG_LIB_PATH env variable to find assisted agg libmongo.so"
106113
exit 1
107114
fi
108115
if [[ -z "${STITCH_SUPPORT_LIB_PATH}" ]]; then
109-
echo "Missing STITCH_SUPPORT_LIB_PATH env variable to find the mongo stitch support library"
116+
echo "Error: missing STITCH_SUPPORT_LIB_PATH env variable to find the mongo stitch support library"
110117
exit 1
111118
fi
112119
exit 1
@@ -453,8 +460,9 @@ echo "Adding fake appid to skip baas server drop optimization"
453460
# Start the baas server on port *:9090 with the provided config JSON files
454461
echo "Starting baas app server"
455462

463+
# see config overrides at https://github.com/10gen/baas/blob/master/etc/configs/test_rcore_config.json
456464
"${WORK_PATH}/baas_server" \
457-
--configFile=etc/configs/test_config.json --configFile="${BASE_PATH}/config_overrides.json" > "${BAAS_SERVER_LOG}" 2>&1 &
465+
--configFile=etc/configs/test_config.json --configFile=etc/configs/test_rcore_config.json > "${BAAS_SERVER_LOG}" 2>&1 &
458466
echo $! > "${BAAS_PID_FILE}"
459467

460468
WAIT_BAAS_OPTS=()
@@ -472,7 +480,7 @@ ${CURL} 'http://localhost:9090/api/admin/v3.0/auth/providers/local-userpass/logi
472480
--silent \
473481
--fail \
474482
--output /dev/null \
475-
--data-raw '{"username":"unique_user@domain.com","password":"password"}'
483+
--data '{"username":"unique_user@domain.com","password":"password"}'
476484

477485
"${MONGO_BINARIES_DIR}/bin/${MONGOSH}" --quiet mongodb://localhost:26000/auth "${BASE_PATH}/add_admin_roles.js"
478486

@@ -483,4 +491,4 @@ echo "---------------------------------------------"
483491
echo "Baas server ready"
484492
echo "---------------------------------------------"
485493
wait
486-
popd > /dev/null # baas
494+
popd > /dev/null # baas

src/realm/sync/client.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,6 +1137,9 @@ SessionWrapper::SessionWrapper(ClientImpl& client, DBRef db, std::shared_ptr<Sub
11371137
REALM_ASSERT(m_db);
11381138
REALM_ASSERT(m_db->get_replication());
11391139
REALM_ASSERT(dynamic_cast<ClientReplication*>(m_db->get_replication()));
1140+
if (m_client_reset_config) {
1141+
m_session_reason = SessionReason::ClientReset;
1142+
}
11401143

11411144
update_subscription_version_info();
11421145
}

test/object-store/sync/flx_migration.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,12 @@ TEST_CASE("Test client migration and rollback with recovery", "[sync][flx][flx m
441441
// Migrate back to FLX - and keep the realm session open
442442
trigger_server_migration(session.app_session(), MigrateToFLX, logger_ptr);
443443

444-
REQUIRE(!wait_for_upload(*outer_realm));
445-
REQUIRE(!wait_for_download(*outer_realm));
444+
// wait for the subscription store to initialize after downloading
445+
timed_wait_for(
446+
[&outer_realm]() {
447+
return outer_realm->sync_session() && outer_realm->sync_session()->get_flx_subscription_store();
448+
},
449+
std::chrono::seconds(180));
446450

447451
// Verify data has been sync'ed and there is only 1 subscription for the Object table
448452
{

0 commit comments

Comments
 (0)