|
@ -138,7 +138,7 @@ bool MemTable::Get(const LookupKey& key, std::string* value, Status* s) { |
|
|
uint32_t key_length; |
|
|
uint32_t key_length; |
|
|
const char* key_ptr = GetVarint32Ptr(entry, entry + 5, &key_length); |
|
|
const char* key_ptr = GetVarint32Ptr(entry, entry + 5, &key_length); |
|
|
|
|
|
|
|
|
std::cout << " get:" << ExtractUserKey(Slice(key_ptr, key_length)).ToString(); |
|
|
|
|
|
|
|
|
std::cout << " get:" << ExtractUserKey(Slice(key_ptr, key_length)).ToString() << std::endl; |
|
|
if (comparator_.comparator.user_comparator()->Compare( |
|
|
if (comparator_.comparator.user_comparator()->Compare( |
|
|
ExtractUserKey(Slice(key_ptr, key_length)), key.user_key()) == 0) { |
|
|
ExtractUserKey(Slice(key_ptr, key_length)), key.user_key()) == 0) { |
|
|
// Correct user key
|
|
|
// Correct user key
|
|
@ -151,7 +151,7 @@ bool MemTable::Get(const LookupKey& key, std::string* value, Status* s) { |
|
|
time(&nowTime); |
|
|
time(&nowTime); |
|
|
assert(nowTime > 0); |
|
|
assert(nowTime > 0); |
|
|
const uint64_t deadTime = DecodeFixed64(key_ptr + key_length - 16); |
|
|
const uint64_t deadTime = DecodeFixed64(key_ptr + key_length - 16); |
|
|
if(static_cast<uint64_t>(nowTime) > deadTime){ //过期了
|
|
|
|
|
|
|
|
|
if(static_cast<uint64_t>(nowTime) >= deadTime){ //过期了
|
|
|
std::cout << nowTime << "dead:" << deadTime << std::endl; |
|
|
std::cout << nowTime << "dead:" << deadTime << std::endl; |
|
|
*s = Status::NotFound(Slice()); |
|
|
*s = Status::NotFound(Slice()); |
|
|
return true; //todo:之前有没过期的key
|
|
|
return true; //todo:之前有没过期的key
|
|
|