diff --git a/src/Storages/RemoteReadBufferCache.cpp b/src/Storages/RemoteReadBufferCache.cpp index 99dc91eec3b..05cf2127a24 100644 --- a/src/Storages/RemoteReadBufferCache.cpp +++ b/src/Storages/RemoteReadBufferCache.cpp @@ -55,8 +55,15 @@ std::shared_ptr 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((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 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)