Server crash (nil pointer in collationCompare) when filtering dolt_diff by a text primary key

Aperta
#3,980 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go, postgresql
Ambito
databases

Direzione di ricerca

Start by reproducing the setup SQL and the w.to_id <> 'r5' filter against dolt_diff on a text primary key. The nil dereference is in schema.collationCompare, reached from prolly.Range.belowStop and prolly.RangeDiffMaps in the diff iterator, so read how the collation is passed into those range checks. Done means the filter returns a count of 1 without the server exiting, and the uuid and cast-to-text cases still behave the same.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

customer issue

Doltgres version: 1.5.1

Setup, on a fresh database:

CREATE TABLE objects (id text PRIMARY KEY, body text);
INSERT INTO objects VALUES ('r5', 'a'), ('r6', 'b');
SELECT dolt_commit('-Am', 'base');
UPDATE objects SET body = 'c' WHERE id = 'r6';

Then, with <base> the hash of the commit above:

SELECT count(*) FROM dolt_diff('<base>', 'WORKING', 'objects') AS w WHERE w.to_id <> 'r5';

Expected: one row, with a count of 1.

Actual: the server process exits, and every open session is disconnected. The log shows a nil pointer dereference in schema.collationCompare, reached from prolly.Range.belowStop and prolly.RangeDiffMaps in the diff iterator.

Other shapes on the same table (for the commit-to-commit rows, also run SELECT dolt_commit('-Am', 'head'); after the update):

filter on dolt_diff(...) AS w result
none (LIMIT $1), WORKING, commit to commit, or STAGED served
w.to_id = 'r5', w.to_id = $1, w.from_id = 'r5' XX000 recovered panic; the server stays up
correlated NOT EXISTS (SELECT 1 FROM dolt_diff(...) d WHERE d.to_id = h.id) XX000 "DoltgresHandler caught panic: nil pointer dereference"
w.to_id <> 'r5', WORKING or commit to commit server process exits
w.diff_type <> 'removed' AND w.to_id NOT IN ($1) server process exits
w.to_id::text IS NOT DISTINCT FROM s.to_id::text (correlated) served
dolt_history_objects WHERE id = $1 served

With a uuid primary key, the same <>, = and NOT IN filters are served. Casting the key column to text before comparing avoids the panic.

Lingua principale
Go
Stelle
2.2k
Fork
93
Merge medio
19h 38m
PR unite (30g)
132

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di dolthub/doltgresql

Tutte le issue di dolthub/doltgresql

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.