token: Handle minimum token correctly in long_token

Fixes:

Exiting on unhandled exception of type 'runtime_exception': runtime
error: Invalid token. Should have size 8, has size 0
This commit is contained in:
Asias He
2015-11-03 10:33:21 +08:00
parent a060610347
commit 16596385ee

View File

@@ -75,6 +75,9 @@ token murmur3_partitioner::get_random_token() {
}
inline int64_t long_token(const token& t) {
if (t.is_minimum()) {
return std::numeric_limits<long>::min();
}
if (t._data.size() != sizeof(int64_t)) {
throw runtime_exception(sprint("Invalid token. Should have size %ld, has size %ld\n", sizeof(int64_t), t._data.size()));