From 69985ac4ae928ebe762f47dcbebd31c63ea7b7c5 Mon Sep 17 00:00:00 2001 From: feng lv Date: Mon, 27 Sep 2021 02:27:24 +0000 Subject: [PATCH] fix --- src/Storages/FileLog/StorageFileLog.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Storages/FileLog/StorageFileLog.cpp b/src/Storages/FileLog/StorageFileLog.cpp index ca7df3c5e4b..b9e9566cddc 100644 --- a/src/Storages/FileLog/StorageFileLog.cpp +++ b/src/Storages/FileLog/StorageFileLog.cpp @@ -349,23 +349,23 @@ void StorageFileLog::openFilesAndSetPos() { for (const auto & file : file_infos.file_names) { - auto & context = file_infos.context_by_name.at(file); - if (context.status != FileStatus::NO_CHANGE) + auto & file_ctx = file_infos.context_by_name.at(file); + if (file_ctx.status != FileStatus::NO_CHANGE) { - context.reader = std::ifstream(getFullDataPath(file)); - if (!context.reader.good()) + file_ctx.reader = std::ifstream(getFullDataPath(file)); + if (!file_ctx.reader.good()) { throw Exception(ErrorCodes::FILE_STREAM_ERROR, "Open file {} failed.", file); } - context.reader.seekg(0, context.reader.end); - if (!context.reader.good()) + file_ctx.reader.seekg(0, file_ctx.reader.end); + if (!file_ctx.reader.good()) { throw Exception(ErrorCodes::FILE_STREAM_ERROR, "Seekg file {} failed.", file); } - auto file_end = context.reader.tellg(); - if (!context.reader.good()) + auto file_end = file_ctx.reader.tellg(); + if (!file_ctx.reader.good()) { throw Exception(ErrorCodes::FILE_STREAM_ERROR, "Tellg file {} failed.", file); } @@ -378,8 +378,8 @@ void StorageFileLog::openFilesAndSetPos() /// update file end at the monment, used in ReadBuffer and serialize meta.last_open_end = file_end; - context.reader.seekg(meta.last_writen_position); - if (!context.reader.good()) + file_ctx.reader.seekg(meta.last_writen_position); + if (!file_ctx.reader.good()) { throw Exception(ErrorCodes::FILE_STREAM_ERROR, "Seekg file {} failed.", file); }