fix(library-db): name slow-write ops for macOS stall diagnosis (#1043)

* fix(library-db): name slow-write ops for macOS stall diagnosis (#1040)

Replace generic op=misc labels on production library-db write paths with
stable module.action names (sync_state.*, track.*, tombstone.*, cmd.*, …)
so SLOW write logs pinpoint the call site. Document the naming convention
on LibraryStore::with_conn.

Diagnostic step for #1040 — no behaviour change.

* docs: add CHANGELOG and credits for PR #1043

Library-db slow-write op naming diagnostic for issue #1040.
This commit is contained in:
cucadmuh
2026-06-09 11:03:22 +03:00
committed by GitHub
parent cfc9419de7
commit b2a5baa48d
11 changed files with 45 additions and 31 deletions
@@ -191,7 +191,7 @@ impl<'a> TrackRepository<'a> {
/// Next generation stamp for a full-resync orphan sweep on this server.
pub fn next_resync_gen(&self, server_id: &str) -> Result<i64, String> {
self.store.with_conn("misc", |c| {
self.store.with_conn("track.next_resync_gen", |c| {
c.query_row(
"SELECT COALESCE(MAX(resync_gen), 0) + 1 FROM track WHERE server_id = ?1",
params![server_id],
@@ -203,7 +203,7 @@ impl<'a> TrackRepository<'a> {
/// IS-7 — soft-delete live rows not re-stamped during the active resync.
pub fn sweep_resync_orphans(&self, server_id: &str, resync_gen: i64) -> Result<u32, String> {
let now = now_unix_ms();
let changed = self.store.with_conn_mut("misc", |c| {
let changed = self.store.with_conn_mut("track.sweep_resync_orphans", |c| {
c.execute(
"UPDATE track SET deleted = 1, synced_at = ?3 \
WHERE server_id = ?1 AND deleted = 0 AND resync_gen != ?2",
@@ -418,7 +418,7 @@ impl<'a> TrackRepository<'a> {
if rows.is_empty() {
return Ok(RemapStats::default());
}
self.store.with_conn_mut("misc", |conn| {
self.store.with_conn_mut("track.upsert_batch_remap", |conn| {
let tx = conn.transaction()?;
let mut remapped: Vec<RemapEntry> = Vec::new();
let mut upsert = tx.prepare_cached(UPSERT_SQL)?;