mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-14 10:22:10 +00:00
fixed bugs
This commit is contained in:
parent
f1535c7226
commit
5fa84c79c3
@ -55,8 +55,15 @@ std::shared_ptr<RemoteCacheController> RemoteCacheController::recover(const std:
|
||||
LOG_INFO(log, "Recover cached file failed. local path:{}", local_path_.string());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
cache_controller->file_metadata_ptr = RemoteFileMetadataFactory::instance().get(cache_controller->metadata_class);
|
||||
try
|
||||
{
|
||||
cache_controller->file_metadata_ptr = RemoteFileMetadataFactory::instance().get(cache_controller->metadata_class);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
LOG_ERROR(log, "Get metadata class failed for {}", cache_controller->metadata_class);
|
||||
cache_controller->file_metadata_ptr = nullptr;
|
||||
}
|
||||
if (!cache_controller->file_metadata_ptr)
|
||||
{
|
||||
// do not load this invalid cached file and clear it. the clear action is in
|
||||
@ -96,6 +103,7 @@ RemoteCacheController::RemoteCacheController(
|
||||
// when we allocate a whole new file cache , file_metadata_ptr must not be null.
|
||||
if (file_metadata_ptr)
|
||||
{
|
||||
metadata_class = file_metadata_ptr->getName();
|
||||
auto metadata_file_writer = std::make_unique<WriteBufferFromFile>((local_path_ / "metadata.txt").string());
|
||||
auto str_buf = file_metadata_ptr->toString();
|
||||
metadata_file_writer->write(str_buf.c_str(), str_buf.size());
|
||||
@ -214,7 +222,7 @@ void RemoteCacheController::close()
|
||||
std::unique_ptr<ReadBufferFromFileBase> RemoteCacheController::allocFile()
|
||||
{
|
||||
ReadSettings settings;
|
||||
settings.local_fs_method = LocalFSReadMethod::read;
|
||||
//settings.local_fs_method = LocalFSReadMethod::read;
|
||||
auto file_buffer = createReadBufferFromFileBase((local_path / "data.bin").string(), settings);
|
||||
|
||||
if (file_buffer)
|
||||
@ -299,6 +307,7 @@ bool RemoteReadBuffer::nextImpl()
|
||||
auto start_offset = file_buffer->getPosition();
|
||||
auto end_offset = start_offset + file_buffer->internalBuffer().size();
|
||||
file_cache_controller->waitMoreData(start_offset, end_offset);
|
||||
//LOG_TRACE(&Poco::Logger::get("RemoteReadBuffer"), "nextImpl, {}->{}", start_offset, end_offset);
|
||||
|
||||
auto status = file_buffer->next();
|
||||
if (status)
|
||||
|
Loading…
Reference in New Issue
Block a user