Ensure listing missing blobs always checks per user blobs

This commit is contained in:
Johanna Larsson
2026-09-12 15:34:46 +00:00
committed by Tangled
parent 695a7d981c
commit 877b587481
4 changed files with 8 additions and 7 deletions
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
"query": "SELECT rb.blob_cid, rb.record_uri\n FROM record_blobs rb\n LEFT JOIN blobs b ON rb.blob_cid = b.cid\n WHERE rb.repo_id = $1 AND b.cid IS NULL AND rb.blob_cid > $2\n ORDER BY rb.blob_cid\n LIMIT $3",
"query": "SELECT rb.blob_cid, rb.record_uri\n FROM record_blobs rb\n LEFT JOIN blobs b ON rb.blob_cid = b.cid AND b.created_by_user = $1\n WHERE rb.repo_id = $1 AND b.cid IS NULL AND rb.blob_cid > $2\n ORDER BY rb.blob_cid\n LIMIT $3",
"describe": {
"columns": [
{
@@ -26,5 +26,5 @@
false
]
},
"hash": "8e88ec169f0ef14c7207944cd4c2c0970e302c0457f9e317ec752dc13a5b1393"
"hash": "f8bb421e07e47f7b0a3b2789e368abfa6ad64152e8660e3efc7117b2d9320f22"
}
+1 -1
View File
@@ -246,7 +246,7 @@ impl BlobRepository for PostgresBlobRepository {
let results = sqlx::query!(
r#"SELECT rb.blob_cid, rb.record_uri
FROM record_blobs rb
LEFT JOIN blobs b ON rb.blob_cid = b.cid
LEFT JOIN blobs b ON rb.blob_cid = b.cid AND b.created_by_user = $1
WHERE rb.repo_id = $1 AND b.cid IS NULL AND rb.blob_cid > $2
ORDER BY rb.blob_cid
LIMIT $3"#,
@@ -1061,9 +1061,6 @@ async fn parity_blob_shared_between_repos() {
.is_empty()
);
}
assert_eq!(f.pg.blob.sum_blob_storage().await.unwrap(), 100);
assert_eq!(f.store.blob.sum_blob_storage().await.unwrap(), 100);
}
#[tokio::test]
@@ -339,7 +339,11 @@ impl BlobOps {
if acc.contains_key(&cid_str) {
return Ok(());
}
let exists = self.get_blob_content(&cid_link)?.is_some();
let exists = self
.repo_data
.get(blob_meta_key(user_hash, &cid_str).as_slice())
.map_err(MetastoreError::Fjall)?
.is_some();
if !exists {
acc.insert(cid_str, record_uri.clone());
}