Electric resume check puts a lagging tab in error when a peer deleted the row it updates
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 48/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- sqlite, typescript
Direção de pesquisa
Start with the pinned replay in packages/browser-db-sqlite-persistence/tests/multi-tab-electric-oracle.test.ts and run the Vitest command from the issue to confirm the failure. Then trace the resume check and shared durable row handling; the issue points to peer commits mixing with this tab's stream state. Done means the replay passes, the resumed tab avoids error, and tabs show the server rows after catching up.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Summary
Electric's resume check can put a persisted Collection in error when several tabs share one persisted database. A resumed tab that lags behind a peer receives an update for a row that the peer's commit already deleted from the shared durable rows. Electric treats the update as a row it never sent and fails with Electric resume state referenced an unseen row; a full snapshot is required.
The resume check assumes that the local rows came from this tab's own stream. With shared persistence, the local rows also reflect peers' commits, which can be ahead of this tab's stream.
main has the same behavior (checked at b8d8ee07c).
Reproduction
The generated multi-tab oracle in #2265 found this history and shrank it:
- Two eager tabs share one database. Both deliver the initial snapshot (rows 1 and 2).
- Tab B reloads. Its new stream resumes from the persisted position.
- The server updates row 2, deletes row 1, deletes row 2, and inserts row 1 again.
- Tab A's stream delivers all four changes and up-to-date. A commits them, so the durable rows hold only row 1.
- Tab B applies A's commit, so it no longer holds row 2.
- Tab B's stream delivers the same changes. The first message updates row 2. B fails with the error above.
The history is pinned as an it.fails replay in packages/browser-db-sqlite-persistence/tests/multi-tab-electric-oracle.test.ts:
cd packages/browser-db-sqlite-persistence
npx vitest run tests/multi-tab-electric-oracle.test.ts -t "keeps a resumed lagging tab out of error"
Expected
A tab whose own stream is legal does not enter error. After every stream catches up, every tab shows the server's rows.
Notes
- The generated campaigns leave this history out until a fix lands. The coverage map records the exclusion.
- A fix probably needs the resume check to use evidence from this stream only, not rows that peers' commits supplied. #2209 (ordering source writes by server position) is related, because both come from tabs sharing durable rows at different stream positions.
This issue was written by Isaac.
- Linguagem predominante
- TypeScript
- Estrelas
- 4k
- Forks
- 286
- Merge médio
- 1d 8h
- PRs com merge (30d)
- 105
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de TanStack/db
-
extractSimpleComparisons returns value: null when the right side of a comparison isn't a literalAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
Mantenedores costumam responder em até 1 dia
-
`avg`, `min`, `max` and `sum` treat `null` values as `0`Talvez já em andamento @oyobbeb assumiu há 11 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Mantenedores costumam responder em até 1 dia
-
`Collection.currentStateAsChanges` JSDoc examples don’t match `CurrentStateAsChangesOptions`Talvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 88/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
Two @tanstack/db tests time out under CPU load because a cold module import counts against the 5 s default timeoutTalvez já em andamento @jp-knj assumiu há 23 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
Mantenedores costumam responder em até 1 dia
Todas as issues de TanStack/db
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
fb55/htmlparser2#2579 ·
Mantenedores costumam responder em até 1 dia
-
bug good first issue needs-review
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 83/100
Mantenedores costumam responder em até 1 dia
-
Add Module DB RulesAbertadocumentation public
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 68/100
midnightntwrk/umbradb#65 ·
Mantenedores costumam responder em até 2 dias
-
area/channels kind/bug priority/medium
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
nanocoai/nanoclaw#4501 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
needs verification
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
Mantenedores costumam responder em até 13 dias