fix(PROJ-35): hashMailID liefert int64 statt uint64
Manticore akzeptiert in `id`-bigint nur signed int64. Der mysql-Treiber serialisiert Parameter als Dezimal-String → uint64-Werte > int64.MaxValue führten zu "number ... is out of range". Fix: int64(h.Sum64()) verlustfreier Bit-Cast — bestehende Dokumente bleiben erreichbar. Auch: PROJ-35-Spec auf In Progress + Implementation Notes/Pitfalls/QA-Block, INDEX.md-Status-Update.
This commit is contained in:
@@ -368,11 +368,20 @@ func (idx *manticoreIndex) Close() error {
|
||||
|
||||
// ── helpers ────────────────────────────────────────────────────────────────
|
||||
|
||||
// hashMailID returns a stable uint64 row ID derived from the mail's SHA-256 string ID.
|
||||
func hashMailID(id string) uint64 {
|
||||
// hashMailID returns a stable signed int64 row ID derived from the mail's
|
||||
// SHA-256 string ID. Manticore's `id` column is bigint (signed int64); the
|
||||
// mysql driver formats parameters as decimal strings, and Manticore rejects
|
||||
// values outside the signed range with "number ... is out of range".
|
||||
//
|
||||
// We FNV-64a-hash the string and reinterpret the resulting uint64 as int64
|
||||
// (verlustfreier Bit-Cast). All bit patterns map 1:1, so already-indexed
|
||||
// documents stay reachable — values whose top bit was set previously
|
||||
// became negative IDs; their bit pattern is unchanged, only the SQL
|
||||
// rendering differs and now matches what Manticore expects.
|
||||
func hashMailID(id string) int64 {
|
||||
h := fnv.New64a()
|
||||
h.Write([]byte(id))
|
||||
return h.Sum64()
|
||||
return int64(h.Sum64())
|
||||
}
|
||||
|
||||
// manticoreTableName returns the RT table name for a given tenant.
|
||||
|
||||
Reference in New Issue
Block a user