[MDS] fix mds_ctx print LOG when destroy core-risk
This commit is contained in:
parent
71d19a316d
commit
13a7fbd360
@ -30,13 +30,21 @@ state_(TwoPhaseCommitState::STATE_INIT) {}
|
||||
|
||||
MdsCtx::~MdsCtx()
|
||||
{
|
||||
if (!write_list_.empty()) {
|
||||
MDS_LOG_RET(WARN, OB_ERR_UNEXPECTED, "nodes not commit or abort when mds ctx destroyed", K(*this));
|
||||
bool list_empty = false;
|
||||
{
|
||||
MdsWLockGuard lg(lock_);
|
||||
bool list_empty = write_list_.empty();
|
||||
if (!list_empty) {
|
||||
MDS_LOG_RET(INFO, OB_SUCCESS, "nodes not commit or abort when mds ctx destroyed", K(*this));
|
||||
}
|
||||
}
|
||||
if (!list_empty) {
|
||||
on_abort(share::SCN::max_scn());
|
||||
}
|
||||
}
|
||||
|
||||
int MdsCtx::assign(const MdsCtx &rhs) {
|
||||
MdsWLockGuard lg(lock_);
|
||||
writer_ = rhs.writer_;
|
||||
state_ = rhs.state_;
|
||||
return OB_SUCCESS;
|
||||
@ -46,6 +54,7 @@ const MdsWriter MdsCtx::get_writer() const { return writer_; }
|
||||
|
||||
void MdsCtx::set_writer(const MdsWriter &writer)
|
||||
{
|
||||
MdsWLockGuard lg(lock_);
|
||||
if (state_ != TwoPhaseCommitState::STATE_INIT) {
|
||||
MDS_LOG_RET(ERROR, OB_INVALID_ARGUMENT, "not allow set writer in non-init state", K(*this), K(writer));
|
||||
} else {
|
||||
@ -56,6 +65,7 @@ void MdsCtx::set_writer(const MdsWriter &writer)
|
||||
|
||||
bool MdsCtx::can_write() const
|
||||
{
|
||||
MdsRLockGuard lg(lock_);
|
||||
return state_ == TwoPhaseCommitState::STATE_INIT &&
|
||||
writer_.is_valid();
|
||||
}
|
||||
|
@ -490,7 +490,11 @@ int ObITabletMdsInterface::get_latest(OP &&read_op, bool &is_committed, const in
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
MDS_LOG_GET(WARN, "mds cannot be NULL");
|
||||
} else if (CLICK_FAIL(handle.get_latest<T>(read_op, is_committed, read_seq))) {
|
||||
MDS_LOG_GET(WARN, "failed to get_latest");
|
||||
if (OB_SNAPSHOT_DISCARDED != ret) {
|
||||
MDS_LOG_GET(WARN, "failed to get mds data");
|
||||
} else {
|
||||
MDS_LOG_GET(TRACE, "failed to get mds data");
|
||||
}
|
||||
}
|
||||
if (CLICK_FAIL(ret)) {
|
||||
if (OB_ENTRY_NOT_EXIST == ret || OB_SNAPSHOT_DISCARDED == ret) {
|
||||
@ -528,7 +532,9 @@ int ObITabletMdsInterface::get_snapshot(OP &&read_op,
|
||||
MDS_LOG_GET(WARN, "mds cannot be NULL");
|
||||
} else if (CLICK_FAIL(handle.get_snapshot<T>(read_op, snapshot, read_seq, timeout_us))) {
|
||||
if (OB_SNAPSHOT_DISCARDED != ret) {
|
||||
MDS_LOG_GET(WARN, "failed to get_snapshot");
|
||||
MDS_LOG_GET(WARN, "failed to get mds data");
|
||||
} else {
|
||||
MDS_LOG_GET(TRACE, "failed to get mds data");
|
||||
}
|
||||
}
|
||||
if (CLICK_FAIL(ret)) {
|
||||
@ -566,7 +572,11 @@ int ObITabletMdsInterface::get_snapshot(const Key &key,
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
MDS_LOG_GET(WARN, "mds cannot be NULL");
|
||||
} else if (CLICK() && OB_SUCCESS != (ret = handle.get_snapshot<Key, Value>(key, read_op, snapshot, read_seq, timeout_us))) {
|
||||
MDS_LOG_GET(WARN, "failed to get_snapshot");
|
||||
if (OB_SNAPSHOT_DISCARDED != ret) {
|
||||
MDS_LOG_GET(WARN, "failed to get mds data");
|
||||
} else {
|
||||
MDS_LOG_GET(TRACE, "failed to get mds data");
|
||||
}
|
||||
}
|
||||
if (CLICK_FAIL(ret)) {
|
||||
if (OB_ENTRY_NOT_EXIST == ret || OB_SNAPSHOT_DISCARDED == ret) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user