Details
-
Bug
-
Resolution: Fixed
-
Major
-
core-10.0.8
-
None
-
1
Description
Getting failure on GET of travel_sample document, whose ID was just read in previous query.
- Install travel_sample
- Wait for def_inventory_airport_primary index to come online
- Collect all airport IDs with: select value(meta().id) from `travel-sample`.inventory.airport query
- For each airport ID collected above, get the document by ID, which intermittently fails with a KEY_ENOENT failure.
e.g.
com.couchbase.client.core.error.DocumentNotFoundException: Document with the given id not found {"completed":true,"coreId":"0xaff20d7300000001","idempotent":true,"lastChannelId":"AFF20D7300000001/000000002B106D1C","lastDispatchedFrom":"172.18.0.3:48012","lastDispatchedTo":"172.18.0.3:12004","requestId":158,"requestType":"GetRequest","retried":0,"service":{"bucket":"travel-sample","collection":"airport","documentId":"airport_8607","errorCode":{"description":"Not Found","name":"KEY_ENOENT"},"opaque":"0x97","scope":"inventory","type":"kv","vbucket":42},"status":"NOT_FOUND","timeoutMs":10000,"timings":{"dispatchMicros":655498,"totalDispatchMicros":655498,"totalServerMicros":650,"totalMicros":679427,"serverMicros":650}}
|
In the comments below we have found that this is due to the hash function. libcouchbase has:
static uint32_t hash_crc32(const char *key, size_t key_length)
|
{
|
uint64_t x;
|
uint32_t crc = UINT32_MAX;
|
|
|
for (x = 0; x < key_length; x++)
|
crc = (crc >> 8) ^ crc32tab[(crc ^ (uint64_t)key[x]) & 0xff];
|
|
|
return ((~crc) >> 16) & 0x7fff;
|
}
|
but we have:
func cbCrc(key []byte) uint32 {
|
crc := uint32(0xffffffff)
|
for x := 0; x < len(key); x++ {
|
crc = (crc >> 8) ^ crc32tab[(uint64(crc)^uint64(key[x]))&0xff]
|
}
|
return (^crc) >> 16
|
}
|