Compare commits

...

2 Commits

Author SHA1 Message Date
Max Radermacher
9c1ecb6910 Fix empty WAL file transfer during device transfer
Co-authored-by: Sasha Weiss <sasha@signal.org>
2026-05-28 11:30:08 -05:00
sashaweiss-signal
36184507a8 Feature flags for .beta. 2026-05-27 15:14:59 -07:00
5 changed files with 13 additions and 7 deletions

View File

@ -32,9 +32,6 @@ extension DeviceTransferService {
let wal: DeviceTransferProtoFile = try {
let file = SSKEnvironment.shared.databaseStorageRef.grdbStorage.databaseWALFilePath
let size = try OWSFileSystem.fileSize(ofPath: file)
guard size > 0 else {
throw OWSAssertionError("database wal is empty")
}
estimatedTotalSize += size
let fileBuilder = DeviceTransferProtoFile.builder(
identifier: DeviceTransferService.databaseWALIdentifier,

View File

@ -5,6 +5,7 @@
import CryptoKit
import Foundation
import GRDB
import MultipeerConnectivity
import SignalServiceKit
@ -366,7 +367,15 @@ class DeviceTransferService: NSObject, DeviceTransferServiceProtocol {
taskGroup.addTask {
// Make a copy of the database files within a write transaction so we can be confident
// they aren't mutated during the copy. We then transfer these copies.
let dbCopy = try await SSKEnvironment.shared.databaseStorageRef.awaitableWrite { _ in
let dbCopy = try await SSKEnvironment.shared.databaseStorageRef.awaitableWrite { tx in
// The MultipeerConnectivity framework stalls if we try to send an empty
// file. The receiver requires a non-empty file. We can't send garbage
// (because that would corrupt the database), so mutate the database, force
// it to be written to the WAL file, and then send that result to our peer.
let store = NewKeyValueStore(collection: "DeviceTransferWAL")
store.writeValue(Randomness.generateRandomBytes(32), forKey: "MustBeNonEmpty", tx: tx)
store.removeValue(forKey: "MustBeNonEmpty", tx: tx)
sqlite3_db_cacheflush(tx.database.sqliteConnection!)
do {
let dbCopy = try Self.makeLocalCopy(databaseFile: database.database)
let walCopy = try Self.makeLocalCopy(databaseFile: database.wal)

View File

@ -9,6 +9,6 @@ extension FeatureBuild {
#if DEBUG
static let current: FeatureBuild = .dev
#else
static let current: FeatureBuild = .internal
static let current: FeatureBuild = .beta
#endif
}

View File

@ -1 +1 @@
internal
beta

View File

@ -1 +1 @@
8.14.0.{build_number}-internal
8.14.0.{build_number}-beta