| 263 | } |
| 264 | |
| 265 | void PeekableReadBuffer::makeContinuousMemoryFromCheckpointToPos() |
| 266 | { |
| 267 | if (!checkpoint) |
| 268 | throw DB::Exception("There is no checkpoint", ErrorCodes::LOGICAL_ERROR); |
| 269 | checkStateCorrect(); |
| 270 | |
| 271 | if (!checkpointInOwnMemory() || currentlyReadFromOwnMemory()) |
| 272 | return; /// it's already continuous |
| 273 | |
| 274 | size_t bytes_to_append = pos - sub_buf.position(); |
| 275 | resizeOwnMemoryIfNecessary(bytes_to_append); |
| 276 | memcpy(memory.data() + peeked_size, sub_buf.position(), bytes_to_append); |
| 277 | sub_buf.position() = pos; |
| 278 | peeked_size += bytes_to_append; |
| 279 | BufferBase::set(memory.data(), peeked_size, peeked_size); |
| 280 | } |
| 281 | |
| 282 | PeekableReadBuffer::~PeekableReadBuffer() |
| 283 | { |
no test coverage detected