[CP] [OBCDC] Fix the computational logic of the safety checkpoint

This commit is contained in:
obdev
2022-11-15 06:38:10 +00:00
committed by wangzelin.wzl
parent 2599b6fb70
commit d813d37a37
2 changed files with 15 additions and 11 deletions

View File

@ -733,16 +733,20 @@ void ObLogCommitter::heartbeat_routine()
} }
} }
int64_t output_checkpoint = OB_INVALID_TIMESTAMP;
// periodically send a heartbeat binlog record // periodically send a heartbeat binlog record
// checkpoint timestamp is invalid for the first time, here ensure that the heartbeat is sent as soon as the checkpoint timestamp is valid // checkpoint timestamp is invalid for the first time, here ensure that the heartbeat is sent as soon as the checkpoint timestamp is valid
if (OB_FAIL(ret)) { if (OB_SUCC(ret)) {
} else if (OB_FAIL(calculate_output_checkpoint_(output_checkpoint))) { if (REACH_TIME_INTERVAL(g_output_heartbeat_interval)) {
LOG_ERROR("calculate_output_checkpoint_ failed", KR(ret), K(output_checkpoint)); int64_t output_checkpoint = OB_INVALID_TIMESTAMP;
} else if (OB_LIKELY(OB_INVALID_TIMESTAMP != output_checkpoint) && REACH_TIME_INTERVAL(g_output_heartbeat_interval)) {
if (OB_FAIL(dispatch_heartbeat_binlog_record_(output_checkpoint))) { if (OB_FAIL(calculate_output_checkpoint_(output_checkpoint))) {
if (OB_IN_STOP_STATE != ret) { LOG_ERROR("calculate_output_checkpoint_ failed", KR(ret), K(output_checkpoint));
LOG_ERROR("dispatch_heartbeat_binlog_record_ fail", KR(ret), K(output_checkpoint)); } else if (OB_INVALID_TIMESTAMP != output_checkpoint) {
if (OB_FAIL(dispatch_heartbeat_binlog_record_(output_checkpoint))) {
if (OB_IN_STOP_STATE != ret) {
LOG_ERROR("dispatch_heartbeat_binlog_record_ fail", KR(ret), K(output_checkpoint));
}
}
} }
} }
} }

View File

@ -238,9 +238,9 @@ int ObExprToOutfileRow::print_field(char *buf, const int64_t buf_len, int64_t &p
OZ(out_info.enclose_.print_plain_str_literal(buf, buf_len, pos, out_info.print_params_)); OZ(out_info.enclose_.print_plain_str_literal(buf, buf_len, pos, out_info.print_params_));
} }
if (0 == out_info.wchar_escape_) { if (0 == out_info.wchar_escape_) {
OZ(obj.print_plain_str_literal(buf, buf_len, pos, out_info.print_params_)); OZ(obj.print_plain_str_literal(buf, buf_len, pos, out_info.print_params_));
} else if (obj.is_null()) { } else if (obj.is_null()) {
OZ(out_info.escape_.print_plain_str_literal(buf, buf_len, pos, out_info.print_params_)); OZ(out_info.escape_.print_plain_str_literal(buf, buf_len, pos, out_info.print_params_));
OZ(print_wchar_to_buf(buf, buf_len, pos, 'N', out_info.print_params_.cs_type_)); OZ(print_wchar_to_buf(buf, buf_len, pos, 'N', out_info.print_params_.cs_type_));
} else if (obj.is_string_or_lob_locator_type() && obj.get_collation_type() == CS_TYPE_BINARY) { } else if (obj.is_string_or_lob_locator_type() && obj.get_collation_type() == CS_TYPE_BINARY) {
OZ(obj.print_plain_str_literal(buf, buf_len, pos, out_info.print_params_)); OZ(obj.print_plain_str_literal(buf, buf_len, pos, out_info.print_params_));