Skip to content

BloomFilterPolicy not interoperable between ARM and x86 #243

Closed
@cmumford

Description

Original issue 237 created by laanwj on 2014-06-07T11:51:19.000Z:

We've been struggling with an elusive issue for a while in which LevelDB database files were not compatible between platforms. Copied databases were failing in subtle ways undetected by any checks.

After a slough of debugging this was narrowed down to use of BloomFilterPolicy. The bloom filter uses the Hash function that can return different output based on char signedness. To be specific: if the number of characters is not a multiple of four, and at least one of the trailing characters is >0x80.

Attached is a patch that:

  • Add casts to Hash() to treat chars as unsigned (I think this was intended)
  • Adds tests for Hash
  • Change name of algoritm in BloomFilterPolicy::Name to make sure that filters are recomputed; this provides forward and backward compatibility

Luckily, the use of Hash() in BloomFilterPolicy seems to be the only place where the result of that function affects what is written to disk.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions