From 840b8847d9a126ed1c6f756c0d98d343f7853b2c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Jul 2022 23:07:00 +0000 Subject: [PATCH 1/7] Bump kotlinCoroutines from 1.6.3 to 1.6.4 Bumps `kotlinCoroutines` from 1.6.3 to 1.6.4. Updates `kotlinx-coroutines-core` from 1.6.3 to 1.6.4 - [Release notes](https://github.com/Kotlin/kotlinx.coroutines/releases) - [Changelog](https://github.com/Kotlin/kotlinx.coroutines/blob/master/CHANGES.md) - [Commits](https://github.com/Kotlin/kotlinx.coroutines/compare/1.6.3...1.6.4) Updates `kotlinx-coroutines-android` from 1.6.3 to 1.6.4 - [Release notes](https://github.com/Kotlin/kotlinx.coroutines/releases) - [Changelog](https://github.com/Kotlin/kotlinx.coroutines/blob/master/CHANGES.md) - [Commits](https://github.com/Kotlin/kotlinx.coroutines/compare/1.6.3...1.6.4) Updates `kotlinx-coroutines-test` from 1.6.3 to 1.6.4 - [Release notes](https://github.com/Kotlin/kotlinx.coroutines/releases) - [Changelog](https://github.com/Kotlin/kotlinx.coroutines/blob/master/CHANGES.md) - [Commits](https://github.com/Kotlin/kotlinx.coroutines/compare/1.6.3...1.6.4) --- updated-dependencies: - dependency-name: org.jetbrains.kotlinx:kotlinx-coroutines-core dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jetbrains.kotlinx:kotlinx-coroutines-android dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jetbrains.kotlinx:kotlinx-coroutines-test dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- dependencies.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies.gradle b/dependencies.gradle index 87031dec37..eb128645e6 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -13,7 +13,7 @@ ext.versions = [ def gradle = "7.1.3" // Ref: https://kotlinlang.org/releases.html def kotlin = "1.6.21" -def kotlinCoroutines = "1.6.3" +def kotlinCoroutines = "1.6.4" def dagger = "2.42" def retrofit = "2.9.0" def arrow = "0.8.2" From 4b7069f47c2c768a7af37183e5cbd81fd713177e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Jul 2022 23:07:14 +0000 Subject: [PATCH 2/7] Bump flipper from 0.153.0 to 0.154.0 Bumps `flipper` from 0.153.0 to 0.154.0. Updates `flipper` from 0.153.0 to 0.154.0 - [Release notes](https://github.com/facebook/flipper/releases) - [Commits](https://github.com/facebook/flipper/compare/v0.153.0...v0.154.0) Updates `flipper-network-plugin` from 0.153.0 to 0.154.0 - [Release notes](https://github.com/facebook/flipper/releases) - [Commits](https://github.com/facebook/flipper/compare/v0.153.0...v0.154.0) --- updated-dependencies: - dependency-name: com.facebook.flipper:flipper dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: com.facebook.flipper:flipper-network-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- dependencies.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies.gradle b/dependencies.gradle index 87031dec37..bbdb52d082 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -21,7 +21,7 @@ def markwon = "4.6.2" def moshi = "1.13.0" def lifecycle = "2.5.0" def flowBinding = "1.2.0" -def flipper = "0.153.0" +def flipper = "0.154.0" def epoxy = "4.6.2" def mavericks = "2.7.0" def glide = "4.13.2" From 069c0c7cb456ed52037b44437eca2996d577c6b6 Mon Sep 17 00:00:00 2001 From: Kat Gerasimova Date: Mon, 18 Jul 2022 15:14:34 +0100 Subject: [PATCH 3/7] Update issue automation for the design team (#6577) * Update issue automation for the design team The design team would like to see all of their issues on their board for triage now * Update triage-labelled.yml --- .github/workflows/triage-labelled.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/triage-labelled.yml b/.github/workflows/triage-labelled.yml index c49b33d582..d2aa72308d 100644 --- a/.github/workflows/triage-labelled.yml +++ b/.github/workflows/triage-labelled.yml @@ -42,20 +42,13 @@ jobs: column-name: "Need info" label-name: "X-Needs-Info" - add_priority_design_issues_to_project: - name: P1 X-Needs-Design to Design project board + add_design_issues_to_project: + name: X-Needs-Design to Design project board runs-on: ubuntu-latest # Skip in forks if: > github.repository == 'vector-im/element-android' && - contains(github.event.issue.labels.*.name, 'X-Needs-Design') && - (contains(github.event.issue.labels.*.name, 'S-Critical') && - (contains(github.event.issue.labels.*.name, 'O-Frequent') || - contains(github.event.issue.labels.*.name, 'O-Occasional')) || - contains(github.event.issue.labels.*.name, 'S-Major') && - contains(github.event.issue.labels.*.name, 'O-Frequent') || - contains(github.event.issue.labels.*.name, 'A11y') && - contains(github.event.issue.labels.*.name, 'O-Frequent')) + contains(github.event.issue.labels.*.name, 'X-Needs-Design') steps: - uses: octokit/graphql-action@v2.x id: add_to_project From ae8f977d6b8232848d15921d5ee6a3ccd12ad7e6 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 13 Jul 2022 13:55:22 +0200 Subject: [PATCH 4/7] Log the end of the migration and it's duration --- .../android/sdk/internal/util/database/RealmMigrator.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/database/RealmMigrator.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/database/RealmMigrator.kt index 8da1bed97e..1992d3b918 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/database/RealmMigrator.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/database/RealmMigrator.kt @@ -19,6 +19,7 @@ package org.matrix.android.sdk.internal.util.database import io.realm.DynamicRealm import io.realm.RealmObjectSchema import timber.log.Timber +import kotlin.system.measureTimeMillis internal abstract class RealmMigrator( private val realm: DynamicRealm, @@ -26,7 +27,10 @@ internal abstract class RealmMigrator( ) { fun perform() { Timber.d("Migrate ${realm.configuration.realmFileName} to $targetSchemaVersion") - doMigrate(realm) + val duration = measureTimeMillis { + doMigrate(realm) + } + Timber.d("Migrate ${realm.configuration.realmFileName} to $targetSchemaVersion took $duration ms.") } abstract fun doMigrate(realm: DynamicRealm) From 3f8cbd1b9c2b4fe4252615dc1b9491f43e4d38db Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 13 Jul 2022 14:11:24 +0200 Subject: [PATCH 5/7] Create a parent `MatrixRealmMigration` and improve the logs. --- .../internal/auth/db/AuthRealmMigration.kt | 14 +++---- .../store/db/RealmCryptoStoreMigration.kt | 23 ++++++------ .../database/RealmSessionStoreMigration.kt | 14 +++---- .../sdk/internal/raw/GlobalRealmMigration.kt | 14 +++---- .../db/RealmIdentityStoreMigration.kt | 14 +++---- .../util/database/MatrixRealmMigration.kt | 37 +++++++++++++++++++ 6 files changed, 73 insertions(+), 43 deletions(-) create mode 100644 matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/database/MatrixRealmMigration.kt diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/db/AuthRealmMigration.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/db/AuthRealmMigration.kt index 0bc7831f5c..c5b8eae3ff 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/db/AuthRealmMigration.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/db/AuthRealmMigration.kt @@ -17,16 +17,18 @@ package org.matrix.android.sdk.internal.auth.db import io.realm.DynamicRealm -import io.realm.RealmMigration import org.matrix.android.sdk.internal.auth.db.migration.MigrateAuthTo001 import org.matrix.android.sdk.internal.auth.db.migration.MigrateAuthTo002 import org.matrix.android.sdk.internal.auth.db.migration.MigrateAuthTo003 import org.matrix.android.sdk.internal.auth.db.migration.MigrateAuthTo004 import org.matrix.android.sdk.internal.auth.db.migration.MigrateAuthTo005 -import timber.log.Timber +import org.matrix.android.sdk.internal.util.database.MatrixRealmMigration import javax.inject.Inject -internal class AuthRealmMigration @Inject constructor() : RealmMigration { +internal class AuthRealmMigration @Inject constructor() : MatrixRealmMigration( + dbName = "Auth", + schemaVersion = 5L, +) { /** * Forces all AuthRealmMigration instances to be equal. * Avoids Realm throwing when multiple instances of the migration are set. @@ -34,11 +36,7 @@ internal class AuthRealmMigration @Inject constructor() : RealmMigration { override fun equals(other: Any?) = other is AuthRealmMigration override fun hashCode() = 4000 - val schemaVersion = 5L - - override fun migrate(realm: DynamicRealm, oldVersion: Long, newVersion: Long) { - Timber.d("Migrating Auth Realm from $oldVersion to $newVersion") - + override fun doMigrate(realm: DynamicRealm, oldVersion: Long) { if (oldVersion < 1) MigrateAuthTo001(realm).perform() if (oldVersion < 2) MigrateAuthTo002(realm).perform() if (oldVersion < 3) MigrateAuthTo003(realm).perform() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/RealmCryptoStoreMigration.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/RealmCryptoStoreMigration.kt index 4ca9d44f98..10f59e6429 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/RealmCryptoStoreMigration.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/RealmCryptoStoreMigration.kt @@ -17,7 +17,6 @@ package org.matrix.android.sdk.internal.crypto.store.db import io.realm.DynamicRealm -import io.realm.RealmMigration import org.matrix.android.sdk.internal.crypto.store.db.migration.MigrateCryptoTo001Legacy import org.matrix.android.sdk.internal.crypto.store.db.migration.MigrateCryptoTo002Legacy import org.matrix.android.sdk.internal.crypto.store.db.migration.MigrateCryptoTo003RiotX @@ -35,13 +34,22 @@ import org.matrix.android.sdk.internal.crypto.store.db.migration.MigrateCryptoTo import org.matrix.android.sdk.internal.crypto.store.db.migration.MigrateCryptoTo015 import org.matrix.android.sdk.internal.crypto.store.db.migration.MigrateCryptoTo016 import org.matrix.android.sdk.internal.crypto.store.db.migration.MigrateCryptoTo017 +import org.matrix.android.sdk.internal.util.database.MatrixRealmMigration import org.matrix.android.sdk.internal.util.time.Clock -import timber.log.Timber import javax.inject.Inject +/** + * Schema version history: + * 0, 1, 2: legacy Riot-Android + * 3: migrate to RiotX schema + * 4, 5, 6, 7, 8, 9: migrations from RiotX (which was previously 1, 2, 3, 4, 5, 6) + */ internal class RealmCryptoStoreMigration @Inject constructor( private val clock: Clock, -) : RealmMigration { +) : MatrixRealmMigration( + dbName = "Crypto", + schemaVersion = 17L, +) { /** * Forces all RealmCryptoStoreMigration instances to be equal. * Avoids Realm throwing when multiple instances of the migration are set. @@ -49,14 +57,7 @@ internal class RealmCryptoStoreMigration @Inject constructor( override fun equals(other: Any?) = other is RealmCryptoStoreMigration override fun hashCode() = 5000 - // 0, 1, 2: legacy Riot-Android - // 3: migrate to RiotX schema - // 4, 5, 6, 7, 8, 9: migrations from RiotX (which was previously 1, 2, 3, 4, 5, 6) - val schemaVersion = 17L - - override fun migrate(realm: DynamicRealm, oldVersion: Long, newVersion: Long) { - Timber.d("Migrating Realm Crypto from $oldVersion to $newVersion") - + override fun doMigrate(realm: DynamicRealm, oldVersion: Long) { if (oldVersion < 1) MigrateCryptoTo001Legacy(realm).perform() if (oldVersion < 2) MigrateCryptoTo002Legacy(realm).perform() if (oldVersion < 3) MigrateCryptoTo003RiotX(realm).perform() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/RealmSessionStoreMigration.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/RealmSessionStoreMigration.kt index 9be1717f32..b54aec26b2 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/RealmSessionStoreMigration.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/RealmSessionStoreMigration.kt @@ -17,7 +17,6 @@ package org.matrix.android.sdk.internal.database import io.realm.DynamicRealm -import io.realm.RealmMigration import org.matrix.android.sdk.internal.database.migration.MigrateSessionTo001 import org.matrix.android.sdk.internal.database.migration.MigrateSessionTo002 import org.matrix.android.sdk.internal.database.migration.MigrateSessionTo003 @@ -51,12 +50,15 @@ import org.matrix.android.sdk.internal.database.migration.MigrateSessionTo030 import org.matrix.android.sdk.internal.database.migration.MigrateSessionTo031 import org.matrix.android.sdk.internal.database.migration.MigrateSessionTo032 import org.matrix.android.sdk.internal.util.Normalizer -import timber.log.Timber +import org.matrix.android.sdk.internal.util.database.MatrixRealmMigration import javax.inject.Inject internal class RealmSessionStoreMigration @Inject constructor( private val normalizer: Normalizer -) : RealmMigration { +) : MatrixRealmMigration( + dbName = "Session", + schemaVersion = 32L, +) { /** * Forces all RealmSessionStoreMigration instances to be equal. * Avoids Realm throwing when multiple instances of the migration are set. @@ -64,11 +66,7 @@ internal class RealmSessionStoreMigration @Inject constructor( override fun equals(other: Any?) = other is RealmSessionStoreMigration override fun hashCode() = 1000 - val schemaVersion = 32L - - override fun migrate(realm: DynamicRealm, oldVersion: Long, newVersion: Long) { - Timber.d("Migrating Realm Session from $oldVersion to $newVersion") - + override fun doMigrate(realm: DynamicRealm, oldVersion: Long) { if (oldVersion < 1) MigrateSessionTo001(realm).perform() if (oldVersion < 2) MigrateSessionTo002(realm).perform() if (oldVersion < 3) MigrateSessionTo003(realm).perform() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/raw/GlobalRealmMigration.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/raw/GlobalRealmMigration.kt index a9dfd47b5a..575afa8494 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/raw/GlobalRealmMigration.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/raw/GlobalRealmMigration.kt @@ -17,12 +17,14 @@ package org.matrix.android.sdk.internal.raw import io.realm.DynamicRealm -import io.realm.RealmMigration import org.matrix.android.sdk.internal.raw.migration.MigrateGlobalTo001 -import timber.log.Timber +import org.matrix.android.sdk.internal.util.database.MatrixRealmMigration import javax.inject.Inject -internal class GlobalRealmMigration @Inject constructor() : RealmMigration { +internal class GlobalRealmMigration @Inject constructor() : MatrixRealmMigration( + dbName = "Global", + schemaVersion = 1L, +) { /** * Forces all GlobalRealmMigration instances to be equal. * Avoids Realm throwing when multiple instances of the migration are set. @@ -30,11 +32,7 @@ internal class GlobalRealmMigration @Inject constructor() : RealmMigration { override fun equals(other: Any?) = other is GlobalRealmMigration override fun hashCode() = 2000 - val schemaVersion = 1L - - override fun migrate(realm: DynamicRealm, oldVersion: Long, newVersion: Long) { - Timber.d("Migrating Global Realm from $oldVersion to $newVersion") - + override fun doMigrate(realm: DynamicRealm, oldVersion: Long) { if (oldVersion < 1) MigrateGlobalTo001(realm).perform() } } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/identity/db/RealmIdentityStoreMigration.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/identity/db/RealmIdentityStoreMigration.kt index e731f9f347..4756b41f4c 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/identity/db/RealmIdentityStoreMigration.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/identity/db/RealmIdentityStoreMigration.kt @@ -17,12 +17,14 @@ package org.matrix.android.sdk.internal.session.identity.db import io.realm.DynamicRealm -import io.realm.RealmMigration import org.matrix.android.sdk.internal.session.identity.db.migration.MigrateIdentityTo001 -import timber.log.Timber +import org.matrix.android.sdk.internal.util.database.MatrixRealmMigration import javax.inject.Inject -internal class RealmIdentityStoreMigration @Inject constructor() : RealmMigration { +internal class RealmIdentityStoreMigration @Inject constructor() : MatrixRealmMigration( + dbName = "Identity", + schemaVersion = 1L, +) { /** * Forces all RealmIdentityStoreMigration instances to be equal. * Avoids Realm throwing when multiple instances of the migration are set. @@ -30,11 +32,7 @@ internal class RealmIdentityStoreMigration @Inject constructor() : RealmMigratio override fun equals(other: Any?) = other is RealmIdentityStoreMigration override fun hashCode() = 3000 - val schemaVersion = 1L - - override fun migrate(realm: DynamicRealm, oldVersion: Long, newVersion: Long) { - Timber.d("Migrating Realm Identity from $oldVersion to $newVersion") - + override fun doMigrate(realm: DynamicRealm, oldVersion: Long) { if (oldVersion < 1) MigrateIdentityTo001(realm).perform() } } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/database/MatrixRealmMigration.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/database/MatrixRealmMigration.kt new file mode 100644 index 0000000000..4dff466de2 --- /dev/null +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/database/MatrixRealmMigration.kt @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 The Matrix.org Foundation C.I.C. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.matrix.android.sdk.internal.util.database + +import io.realm.DynamicRealm +import io.realm.RealmMigration +import timber.log.Timber +import kotlin.system.measureTimeMillis + +internal abstract class MatrixRealmMigration( + private val dbName: String, + val schemaVersion: Long, +) : RealmMigration { + final override fun migrate(realm: DynamicRealm, oldVersion: Long, newVersion: Long) { + Timber.d("Migrating Realm $dbName from $oldVersion to $newVersion") + val duration = measureTimeMillis { + doMigrate(realm, oldVersion) + } + Timber.d("Migrating Realm $dbName from $oldVersion to $newVersion took $duration ms.") + } + + abstract fun doMigrate(realm: DynamicRealm, oldVersion: Long) +} From 428942d4075ae0c910557d61fb0eb67c1c75ed84 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 13 Jul 2022 14:54:52 +0200 Subject: [PATCH 6/7] Changelog --- changelog.d/6538.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/6538.misc diff --git a/changelog.d/6538.misc b/changelog.d/6538.misc new file mode 100644 index 0000000000..ba6d4485b6 --- /dev/null +++ b/changelog.d/6538.misc @@ -0,0 +1 @@ +Log durations of DB migration and migration steps. From ade1b7be8cf9f3451b6b34663605c7187a8cc5d8 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 19 Jul 2022 09:49:34 +0200 Subject: [PATCH 7/7] Add some punctuation to please detekt. --- .../internal/crypto/store/db/RealmCryptoStoreMigration.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/RealmCryptoStoreMigration.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/RealmCryptoStoreMigration.kt index 10f59e6429..c36d572da6 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/RealmCryptoStoreMigration.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/RealmCryptoStoreMigration.kt @@ -40,9 +40,9 @@ import javax.inject.Inject /** * Schema version history: - * 0, 1, 2: legacy Riot-Android - * 3: migrate to RiotX schema - * 4, 5, 6, 7, 8, 9: migrations from RiotX (which was previously 1, 2, 3, 4, 5, 6) + * 0, 1, 2: legacy Riot-Android; + * 3: migrate to RiotX schema; + * 4, 5, 6, 7, 8, 9: migrations from RiotX (which was previously 1, 2, 3, 4, 5, 6). */ internal class RealmCryptoStoreMigration @Inject constructor( private val clock: Clock,