Transaction log data is stored by the FoundationDB core in the "backupLogKeys" (i.e., \xff\x02/blog/) keyspace in a funny order for performance reasons. Returns the ranges of keys that contain the data for the given range of versions. assert CLIENT_KNOBS->LOG_RANGE_BLOCK_SIZE % blocksize = 0. Otherwise calculation of hash will be incorrect
| 167 | // of versions. |
| 168 | // assert CLIENT_KNOBS->LOG_RANGE_BLOCK_SIZE % blocksize = 0. Otherwise calculation of hash will be incorrect |
| 169 | Standalone<VectorRef<KeyRangeRef>> getLogRanges(Version beginVersion, |
| 170 | Version endVersion, |
| 171 | Key destUidValue, |
| 172 | int blockSize) { |
| 173 | Standalone<VectorRef<KeyRangeRef>> ret; |
| 174 | |
| 175 | Key baLogRangePrefix = destUidValue.withPrefix(backupLogKeys.begin); |
| 176 | |
| 177 | //TraceEvent("GetLogRanges").detail("DestUidValue", destUidValue).detail("Prefix", baLogRangePrefix); |
| 178 | |
| 179 | for (int64_t vblock = beginVersion / blockSize; vblock < (endVersion + blockSize - 1) / blockSize; ++vblock) { |
| 180 | int64_t tb = vblock * blockSize / CLIENT_KNOBS->LOG_RANGE_BLOCK_SIZE; |
| 181 | uint64_t bv = bigEndian64(std::max(beginVersion, vblock * blockSize)); |
| 182 | uint64_t ev = bigEndian64(std::min(endVersion, (vblock + 1) * blockSize)); |
| 183 | uint32_t data = tb & 0xffffffff; |
| 184 | uint8_t hash = (uint8_t)hashlittle(&data, sizeof(uint32_t), 0); |
| 185 | |
| 186 | Key vblockPrefix = StringRef(&hash, sizeof(uint8_t)).withPrefix(baLogRangePrefix); |
| 187 | |
| 188 | ret.push_back_deep(ret.arena(), |
| 189 | KeyRangeRef(StringRef((uint8_t*)&bv, sizeof(uint64_t)).withPrefix(vblockPrefix), |
| 190 | StringRef((uint8_t*)&ev, sizeof(uint64_t)).withPrefix(vblockPrefix))); |
| 191 | } |
| 192 | |
| 193 | return ret; |
| 194 | } |
| 195 | |
| 196 | Standalone<VectorRef<KeyRangeRef>> getApplyRanges(Version beginVersion, Version endVersion, Key backupUid) { |
| 197 | Standalone<VectorRef<KeyRangeRef>> ret; |
no test coverage detected