diff --git a/syncstorage-mysql/src/batch.rs b/syncstorage-mysql/src/batch.rs index 3c3a9dfe19..88f284a256 100644 --- a/syncstorage-mysql/src/batch.rs +++ b/syncstorage-mysql/src/batch.rs @@ -135,18 +135,6 @@ pub fn delete(db: &MysqlDb, params: params::DeleteBatch) -> DbResult<()> { Ok(()) } -/// Cleans up uncommitted batch data for the user -pub fn delete_for_user(db: &MysqlDb, user_id: UserIdentifier) -> DbResult<()> { - let user_id = user_id.legacy_id as i64; - diesel::delete(batch_uploads::table) - .filter(batch_uploads::user_id.eq(&user_id)) - .execute(&mut *db.conn.write().unwrap())?; - diesel::delete(batch_upload_items::table) - .filter(batch_upload_items::user_id.eq(&user_id)) - .execute(&mut *db.conn.write().unwrap())?; - Ok(()) -} - /// Commits a batch to the bsos table, deleting the batch when succesful pub fn commit(db: &MysqlDb, params: params::CommitBatch) -> DbResult { let batch_id = decode_id(¶ms.batch.id)?; diff --git a/syncstorage-mysql/src/models.rs b/syncstorage-mysql/src/models.rs index 3212d3ae1a..d62aaa326f 100644 --- a/syncstorage-mysql/src/models.rs +++ b/syncstorage-mysql/src/models.rs @@ -302,16 +302,15 @@ impl MysqlDb { } fn delete_storage_sync(&self, user_id: UserIdentifier) -> DbResult<()> { - let user_id_i64 = user_id.legacy_id as i64; + let user_id = user_id.legacy_id as i64; // Delete user data. delete(bso::table) - .filter(bso::user_id.eq(user_id_i64)) + .filter(bso::user_id.eq(user_id)) .execute(&mut *self.conn.write().unwrap())?; // Delete user collections. delete(user_collections::table) - .filter(user_collections::user_id.eq(user_id_i64)) + .filter(user_collections::user_id.eq(user_id)) .execute(&mut *self.conn.write().unwrap())?; - batch::delete_for_user(self, user_id)?; Ok(()) } diff --git a/syncstorage-spanner/src/batch.rs b/syncstorage-spanner/src/batch.rs index 068731959f..9f312a8f23 100644 --- a/syncstorage-spanner/src/batch.rs +++ b/syncstorage-spanner/src/batch.rs @@ -167,25 +167,6 @@ pub async fn delete_async(db: &SpannerDb, params: params::DeleteBatch) -> DbResu Ok(()) } -pub async fn delete_for_user_async(db: &SpannerDb, user_id: UserIdentifier) -> DbResult<()> { - let (sqlparams, sqlparam_types) = params! { - "fxa_uid" => user_id.fxa_uid.clone(), - "fxa_kid" => user_id.fxa_kid.clone(), - }; - // Also deletes child batch_bsos rows (INTERLEAVE IN PARENT batches ON - // DELETE CASCADE) - db.sql( - "DELETE FROM batches - WHERE fxa_uid = @fxa_uid - AND fxa_kid = @fxa_kid", - )? - .params(sqlparams) - .param_types(sqlparam_types) - .execute_dml_async(&db.conn) - .await?; - Ok(()) -} - pub async fn commit_async( db: &SpannerDb, params: params::CommitBatch, diff --git a/syncstorage-spanner/src/models.rs b/syncstorage-spanner/src/models.rs index 733995805b..f270962b38 100644 --- a/syncstorage-spanner/src/models.rs +++ b/syncstorage-spanner/src/models.rs @@ -1011,8 +1011,8 @@ impl SpannerDb { // Also deletes child bsos/batch rows (INTERLEAVE IN PARENT // user_collections ON DELETE CASCADE) let (sqlparams, sqlparam_types) = params! { - "fxa_uid" => user_id.fxa_uid.clone(), - "fxa_kid" => user_id.fxa_kid.clone() + "fxa_uid" => user_id.fxa_uid, + "fxa_kid" => user_id.fxa_kid }; self.sql( "DELETE FROM user_collections @@ -1023,7 +1023,6 @@ impl SpannerDb { .param_types(sqlparam_types) .execute_dml_async(&self.conn) .await?; - batch::delete_for_user_async(self, user_id).await?; Ok(()) }