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