Skip reuse old file for slog open
This commit is contained in:

committed by
wangzelin.wzl

parent
65d30fe39f
commit
80194a9335
@ -70,6 +70,10 @@ public:
|
|||||||
{
|
{
|
||||||
return ATOMIC_LOAD(&min_using_file_id_);
|
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_min_file_id(const file_id_t file_id);
|
||||||
void update_max_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);
|
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;
|
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]));
|
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
|
} else if (enable_write && !is_tmp) {
|
||||||
if (OB_FAIL(disk_slots_[disk_id].get_file_pool()->get_fd((uint32_t)file_id, tmp_fd))) {
|
if (ObLogWritePoolType::CLOG_WRITE_POOL == disk_slots_[disk_id].get_file_pool()->get_pool_type()) {
|
||||||
COMMON_LOG(ERROR, "file pool get fd fail", K(ret), K(file_id));
|
// 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
|
} 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))) {
|
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;
|
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_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_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 int OPEN_MODE = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
|
||||||
static const int64_t MONITOR_TASK_INTERVAL_US = 1000 * 1000; // 1 seconds
|
static const int64_t MONITOR_TASK_INTERVAL_US = 1000 * 1000; // 1 seconds
|
||||||
|
Reference in New Issue
Block a user