posting: a dropped UID-warm publish re-arms immediately, so a read-hot and write-hot key loops on a discarded walk
I maintainer di solito rispondono entro 10 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
Inizia in posting/mvcc.go, in corrispondenza di warmCachedUids, tryStartUidWarm e needsUidWarm, quindi segui publishCalculatedUids in posting/list.go. Leggi TestPublishCalculatedUidsDropsAStaleWalk e il pattern di limitazione dei tentativi di doRollup. Il lavoro è completato quando le walk obsolete non possono essere ritentate indefinitamente in presenza di commit ripetuti, mentre le letture rimangono corrette e la coverage verifica il comportamento limitato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What
The UID-slice warm added in #9809 discards its work and immediately re-arms when a commit lands mid-walk, so a posting-list key that is both read-hot and write-hot can loop on a walk whose result is always thrown away.
Where
posting/mvcc.go, warmCachedUids:
- A reader elects itself with
tryStartUidWarm, walks a private copy, and callspublishCalculatedUids. publishCalculatedUids(posting/list.go) drops the result whenl.mutationMap.committedUidsTimehas moved since the copy was taken.- The
defer cached.finishUidWarm()then returns the list touidWarmIdle, andisUidsCalculatedon the published list is still false, soneedsUidWarm()is still true and the next reader walks again.
Every commit on a cached key moves committedUidsTime: updateItemInCache calls setMutationAfterCommit(..., refresh=true), which bumps it via x.Max and clears isUidsCalculated/calculatedUids.
TestPublishCalculatedUidsDropsAStaleWalk covers the drop. Nothing bounds the retry.
Cost
Each discarded walk is a full l.iterate, a readListPart Badger read per split for a multi-part list, and a make([]uint64, 0, l.approxLen()).
It is bounded to one walk in flight per key, not one per read: concurrent readers lose the CAS and serve their read unwarmed without walking. So the shape is a single goroutine walking that key continuously and achieving nothing, rather than a per-read tax.
For contrast, before #9809's non-blocking warm the walk held the published list's write lock, which serialized it against the commit path — so the result was always installed and walks per key were bounded by commits. The trade #9809 made was "no commit stall" in exchange for this, and the commit message only described the first half. Worth correcting the record here.
Why it is not a one-liner
Two approaches that look obvious and are not:
- Park the list on a dropped publish (reuse
uidWarmAbandoned). A drop means a commit already landed, and that commit'sCompareAndSwap(uidWarmAbandoned, uidWarmIdle)ran before the park, so nothing re-arms it. A key that stops being committed then stays unwarmed for the life of the cache entry — and an entry with few deltas may never be rolled up and evicted, so "for the life of the entry" can mean indefinitely. - A per-key attempt throttle, the shape
doRollupuses (posting/mvcc.go: amap[uint64]int64ofz.MemHash(key)to last-attempt seconds, skipping anything attempted within 10s). That bounds it correctly and would bound the failure log for free, butdoRollupruns on one goroutine while this would run on every posting read, so the mutex would serialize reads across all keys. It needs sharding or something cheaper.
Not urgent
Reads stay correct throughout — an unwarmed read walks the list in Uids() exactly as it did before the memoization existed. This is wasted work, not a wrong answer.
Introduced in #9809 (b90c1800, perf(posting): warm cached UID slices off the published list's write lock).
- Lingua principale
- Go
- Stelle
- 21.8k
- Fork
- 1.6k
- Merge medio
- 11g 7h
- PR unite (30g)
- 5
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di dgraph-io/dgraph
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 10 giorni
-
Broken links in the docsAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
I maintainer di solito rispondono entro 10 giorni
-
Stale
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
dgraph-io/dgraph#9811 · 1 commento ·
I maintainer di solito rispondono entro 10 giorni
-
Stale
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
dgraph-io/dgraph#9810 · 1 commento ·
I maintainer di solito rispondono entro 10 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 10 giorni
Tutte le issue di dgraph-io/dgraph
Issue simili
-
【文档错误】创建镜像空间步骤中的截图标注与文字描述不一致Apertaenhancement
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
DaoCloud/DaoCloud-docs#7839 ·
I maintainer di solito rispondono entro 1 giorno
-
Type: Enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
projectdiscovery/urlfinder#167 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
peterstace/simplefeatures#726 ·
-
area: import bug go good first issue priority: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
fukubie/StockLlama#69 ·
-
enhancement help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
cloverworks-hq/rumpty-cli#95 ·
I maintainer di solito rispondono entro 1 giorno