[FEAT MERGE] log4100 branch
Co-authored-by: tino247 <tino247@126.com> Co-authored-by: BinChenn <binchenn.bc@gmail.com> Co-authored-by: HaHaJeff <jeffzhouhhh@gmail.com>
This commit is contained in:
@ -45,9 +45,7 @@ ObStorageLogWriter::ObStorageLogWriter()
|
||||
file_size_(0), write_offset_(0), cursor_(),
|
||||
retry_write_policy_(ObLogRetryWritePolicy::INVALID_RETRY_WRITE),
|
||||
log_write_policy_(ObLogWritePolicy::INVALID_WRITE), nop_log_(),
|
||||
nop_data_param_(), is_ok_(false), write_failed_times_(0),
|
||||
file_handler_(), batch_write_buf_(),
|
||||
slog_write_runner_()
|
||||
nop_data_param_(), file_handler_(), batch_write_buf_(), slog_write_runner_()
|
||||
{
|
||||
}
|
||||
|
||||
@ -74,7 +72,6 @@ int ObStorageLogWriter::init(
|
||||
int64_t buf_size = max_log_size + ObLogConstants::LOG_FILE_ALIGN_SIZE;
|
||||
write_align_size_ = ObLogConstants::LOG_FILE_ALIGN_SIZE;
|
||||
file_size_ = log_file_size;
|
||||
write_failed_times_ = 0;
|
||||
|
||||
if (OB_UNLIKELY(is_inited_)) {
|
||||
ret = OB_INIT_TWICE;
|
||||
@ -102,7 +99,6 @@ int ObStorageLogWriter::init(
|
||||
} else if (OB_SERVER_TENANT_ID != tenant_id && OB_FAIL(slog_write_runner_.init(this))) {
|
||||
STORAGE_REDO_LOG(WARN, "Fail to init slog write runner.", K(ret));
|
||||
} else {
|
||||
set_ok(true);
|
||||
is_inited_ = true;
|
||||
STORAGE_REDO_LOG(INFO, "Successfully init slog writer", K(ret), KP(log_dir),
|
||||
K(log_file_size), K(max_log_size), K(log_file_spec));
|
||||
@ -148,8 +144,6 @@ void ObStorageLogWriter::destroy()
|
||||
file_size_ = 0;
|
||||
write_offset_ = 0;
|
||||
cursor_.reset();
|
||||
set_ok(false);
|
||||
write_failed_times_ = 0;
|
||||
file_handler_.destroy();
|
||||
ObBaseLogWriter::destroy();
|
||||
nop_log_.destroy();
|
||||
@ -512,15 +506,6 @@ int ObStorageLogWriter::write_logs(
|
||||
if (duration > TIME_THRESHOLD) {
|
||||
STORAGE_REDO_LOG(INFO, "Slow write", K(duration), K(write_len));
|
||||
}
|
||||
if (--write_failed_times_ <= 0) {
|
||||
write_failed_times_ = 0;
|
||||
set_ok(true);
|
||||
}
|
||||
} else {
|
||||
if (++write_failed_times_ >= 10) {
|
||||
write_failed_times_ = 10;
|
||||
set_ok(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
|
||||
@ -51,8 +51,7 @@ public:
|
||||
|
||||
int delete_log_file(const int64_t file_id);
|
||||
int get_using_disk_space(int64_t &using_space) const;
|
||||
OB_INLINE bool is_ok() const { return ATOMIC_LOAD(&is_ok_); }
|
||||
OB_INLINE void set_ok(const bool ok) { ATOMIC_STORE(&is_ok_, ok); }
|
||||
inline int64_t get_pwrite_ts() const { return file_handler_.get_pwrite_ts(); }
|
||||
|
||||
int start_log(const common::ObLogCursor &start_cursor);
|
||||
|
||||
@ -144,10 +143,6 @@ private:
|
||||
ObStorageLogNopLog nop_log_;
|
||||
ObStorageLogParam nop_data_param_;
|
||||
|
||||
// indicate whether slog writer is ok for outside checking
|
||||
bool is_ok_;
|
||||
int64_t write_failed_times_;
|
||||
|
||||
common::ObLogFileHandler file_handler_;
|
||||
ObStorageLogWriteBuffer batch_write_buf_;
|
||||
ObSLogWriteRunner slog_write_runner_;
|
||||
@ -156,4 +151,4 @@ private:
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -184,25 +184,6 @@ int ObStorageLogger::start_log(const ObLogCursor &start_cursor)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int ObStorageLogger::is_logger_ok(bool &is_ok)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
is_ok = true;
|
||||
|
||||
if (OB_UNLIKELY(!is_inited_)) {
|
||||
ret = OB_NOT_INIT;
|
||||
STORAGE_REDO_LOG(WARN, "The ObStorageLogger has not been inited.", K(ret));
|
||||
} else {
|
||||
is_ok = log_writer_->is_ok();
|
||||
if (!is_ok) {
|
||||
STORAGE_REDO_LOG(WARN, "Storage log writer is not ok.");
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObStorageLogger::get_active_cursor(ObLogCursor &log_cursor)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
||||
@ -53,7 +53,10 @@ public:
|
||||
int write_log(ObIArray<ObStorageLogParam> ¶m_arr);
|
||||
const char *get_dir() { return tnt_slog_dir_; }
|
||||
|
||||
int is_logger_ok(bool &is_ok);
|
||||
inline int64_t get_pwrite_ts() const
|
||||
{
|
||||
return nullptr == log_writer_ ? 0 : log_writer_->get_pwrite_ts();
|
||||
}
|
||||
int get_active_cursor(common::ObLogCursor &log_cursor);
|
||||
int remove_useless_log_file(const int64_t end_file_id, const uint64_t tenant_id);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user