| 22 | typedef std::pair<TStringBuf, TStringBuf> TDescriptor; |
| 23 | |
| 24 | [[noreturn]] |
| 25 | void ReportRedefinitionError(const TStringBuf key, const TStringBuf data, const ui64 kk, const TDescriptor& prev) noexcept { |
| 26 | const auto& [prevKey, value] = prev; |
| 27 | Y_ABORT_UNLESS(key == prevKey, "Internal hash collision:" |
| 28 | " old key: %s," |
| 29 | " new key: %s," |
| 30 | " hash: %" PRIx64 ".", |
| 31 | TString{prevKey}.Quote().c_str(), |
| 32 | TString{key}.Quote().c_str(), |
| 33 | kk); |
| 34 | size_t vsize = GetCodec()->DecompressedLength(value); |
| 35 | size_t dsize = GetCodec()->DecompressedLength(data); |
| 36 | if (vsize + dsize < 1000) { |
| 37 | Y_ABORT_UNLESS(false, "Redefinition of key %s:\n" |
| 38 | " old value: %s,\n" |
| 39 | " new value: %s.", |
| 40 | TString{key}.Quote().c_str(), |
| 41 | Decompress(value).Quote().c_str(), |
| 42 | Decompress(data).Quote().c_str()); |
| 43 | } else { |
| 44 | Y_ABORT_UNLESS(false, "Redefinition of key %s," |
| 45 | " old size: %zu," |
| 46 | " new size: %zu.", |
| 47 | TString{key}.Quote().c_str(), vsize, dsize); |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | struct TStore final: public IStore, public absl::flat_hash_map<ui64, TDescriptor*> { |
| 52 | static inline ui64 ToK(TStringBuf k) { |
no test coverage detected