This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new cf18de14b5 [fix](writer) add _is_closed state to DeltaWriter and avoid
write/close core after close (#16453)
cf18de14b5 is described below
commit cf18de14b50e29b68c35308ae2ab0dfc71d81e0c
Author: Kang <[email protected]>
AuthorDate: Tue Feb 7 22:40:26 2023 +0800
[fix](writer) add _is_closed state to DeltaWriter and avoid write/close
core after close (#16453)
---
be/src/common/status.h | 2 ++
be/src/olap/delta_writer.cpp | 13 +++++++++++++
be/src/olap/delta_writer.h | 1 +
3 files changed, 16 insertions(+)
diff --git a/be/src/common/status.h b/be/src/common/status.h
index 71d16a8f1e..91cabd5885 100644
--- a/be/src/common/status.h
+++ b/be/src/common/status.h
@@ -105,6 +105,7 @@ E(TOO_MANY_VERSION, -235);
E(NOT_INITIALIZED, -236);
E(ALREADY_CANCELLED, -237);
E(TOO_MANY_SEGMENTS, -238);
+E(ALREADY_CLOSED, -239);
E(CE_CMD_PARAMS_ERROR, -300);
E(CE_BUFFER_TOO_SMALL, -301);
E(CE_CMD_NOT_VALID, -302);
@@ -266,6 +267,7 @@ static constexpr bool capture_stacktrace() {
&& code != ErrorCode::TOO_MANY_SEGMENTS
&& code != ErrorCode::TOO_MANY_VERSION
&& code != ErrorCode::ALREADY_CANCELLED
+ && code != ErrorCode::ALREADY_CLOSED
&& code != ErrorCode::PUSH_TRANSACTION_ALREADY_EXIST
&& code != ErrorCode::BE_NO_SUITABLE_VERSION
&& code != ErrorCode::CUMULATIVE_NO_SUITABLE_VERSION
diff --git a/be/src/olap/delta_writer.cpp b/be/src/olap/delta_writer.cpp
index 166ca5c46b..1f3cfe40e4 100644
--- a/be/src/olap/delta_writer.cpp
+++ b/be/src/olap/delta_writer.cpp
@@ -169,6 +169,12 @@ Status DeltaWriter::write(const vectorized::Block* block,
const std::vector<int>
return _cancel_status;
}
+ if (_is_closed) {
+ LOG(WARNING) << "write block after closed tablet_id=" << _req.tablet_id
+ << " load_id=" << _req.load_id << " txn_id=" <<
_req.txn_id;
+ return Status::Error<ALREADY_CLOSED>();
+ }
+
_total_received_rows += row_idxs.size();
_mem_table->insert(block, row_idxs);
@@ -284,8 +290,15 @@ Status DeltaWriter::close() {
return _cancel_status;
}
+ if (_is_closed) {
+ LOG(WARNING) << "close after closed tablet_id=" << _req.tablet_id
+ << " load_id=" << _req.load_id << " txn_id=" <<
_req.txn_id;
+ return Status::Error<ALREADY_CLOSED>();
+ }
+
auto s = _flush_memtable_async();
_mem_table.reset();
+ _is_closed = true;
if (OLAP_UNLIKELY(!s.ok())) {
return s;
} else {
diff --git a/be/src/olap/delta_writer.h b/be/src/olap/delta_writer.h
index f280be2392..82dd424564 100644
--- a/be/src/olap/delta_writer.h
+++ b/be/src/olap/delta_writer.h
@@ -125,6 +125,7 @@ private:
bool _is_init = false;
bool _is_cancelled = false;
+ bool _is_closed = false;
Status _cancel_status;
WriteRequest _req;
TabletSharedPtr _tablet;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]