SQLite Forum

FTS5: Hashmap bug?

FTS5: Hashmap bug?

(1) By Martijn on 2020-09-16 18:52:57 [link] [source]

Hello Devs!

I found something strange in the FTS5 hashmap implementation.
Assuming that member "int *pnByte" holds a pointer to the total number
of pending data bytes of all entries.

Then these line:

309: nIncr += p->nData;  // Example: + 10B for new entry
383: nIncr += p->nData;  // Example: + 10B + Row + Col + Pos

On: https://github.com/mackyle/sqlite/blob/master/ext/fts5/fts5_hash.c

Seems strange to me because the number of data bytes
for a new entry seems to be counted twice.
If that is true, then line 309 probably needs to be removed.

Have a nice day,

(2) By Dan Kennedy (dan) on 2020-09-17 15:20:20 in reply to 1 [source]

Thanks for this. You're correct of course. Now fixed here: