提交 8c615943 编写于 作者: J JiahuaChen 提交者: wangzelin.wzl

Skip reuse old file for slog open

上级 6dd10291
......@@ -70,6 +70,10 @@ public:
{
return ATOMIC_LOAD(&min_using_file_id_);
}
ObLogWritePoolType get_pool_type() const
{
return type_;
}
void update_min_file_id(const file_id_t file_id);
void update_max_file_id(const file_id_t file_id);
void update_min_using_file_id(const file_id_t file_id);
......
......@@ -308,9 +308,16 @@ int ObLogDiskManager::sync_system_fd(const int64_t file_id, const int64_t disk_i
ret = OB_ERR_UNEXPECTED;
COMMON_LOG(ERROR, "unexpected scenario", K(ret), K(disk_id), K(file_id), K(fd_info), K(disk_slots_[disk_id]));
}
} else if (enable_write && !is_tmp) { // clog write, may reuse old log file
if (OB_FAIL(disk_slots_[disk_id].get_file_pool()->get_fd((uint32_t)file_id, tmp_fd))) {
COMMON_LOG(ERROR, "file pool get fd fail", K(ret), K(file_id));
} else if (enable_write && !is_tmp) {
if (ObLogWritePoolType::CLOG_WRITE_POOL == disk_slots_[disk_id].get_file_pool()->get_pool_type()) {
// clog write, may reuse old log file
if (OB_FAIL(disk_slots_[disk_id].get_file_pool()->get_fd((uint32_t)file_id, tmp_fd))) {
COMMON_LOG(ERROR, "file pool get fd fail", K(ret), K(file_id));
}
} else {
if (OB_FAIL(inner_open_fd(disk_id, file_id, OPEN_FLAG_WRITE, is_tmp, tmp_fd))) {
COMMON_LOG(ERROR, "open fd fail", K(ret), K(enable_write), K(is_tmp));
}
}
} else if (enable_write && is_tmp) { // ilog write tmp file
if (OB_FAIL(inner_open_fd(disk_id, file_id, OPEN_FLAG_WRITE, is_tmp, tmp_fd))) {
......
......@@ -501,7 +501,7 @@ private:
int get_total_disk_space_(int64_t& total_space) const;
static const int OPEN_FLAG_READ = O_RDONLY | O_DIRECT;
static const int OPEN_FLAG_WRITE = O_WRONLY | O_DIRECT | O_SYNC | O_CREAT;
static const int OPEN_FLAG_WRITE = O_RDWR | O_DIRECT | O_SYNC | O_CREAT;
static const int OPEN_FLAG_WRITE_WITHOUT_CREATE = O_WRONLY | O_DIRECT | O_SYNC;
static const int OPEN_MODE = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
static const int64_t MONITOR_TASK_INTERVAL_US = 1000 * 1000; // 1 seconds
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册