| 165 | } |
| 166 | |
| 167 | std::vector<std::pair<KeyRange, std::string>> decodeShardMapping(const RangeResult& result, StringRef prefix) { |
| 168 | std::vector<std::pair<KeyRange, std::string>> shards; |
| 169 | KeyRef endKey; |
| 170 | std::string name; |
| 171 | |
| 172 | for (const auto& kv : result) { |
| 173 | auto keyWithoutPrefix = kv.key.removePrefix(prefix); |
| 174 | if (name.size() > 0) { |
| 175 | shards.push_back({ KeyRange(KeyRangeRef(endKey, keyWithoutPrefix)), name }); |
| 176 | TraceEvent(SevDebug, "DecodeShardMapping") |
| 177 | .detail("BeginKey", endKey) |
| 178 | .detail("EndKey", keyWithoutPrefix) |
| 179 | .detail("Name", name); |
| 180 | } |
| 181 | endKey = keyWithoutPrefix; |
| 182 | name = kv.value.toString(); |
| 183 | } |
| 184 | return shards; |
| 185 | } |
| 186 | |
| 187 | void logRocksDBError(const rocksdb::Status& status, const std::string& method) { |
| 188 | auto level = status.IsTimedOut() ? SevWarn : SevError; |
no test coverage detected