enhance: prevent panic by adding null pointer check when clearing InsertRecord _pk2offset_ (#45281)

Signed-off-by: aoiasd <zhicheng.yue@zilliz.com>
This commit is contained in:
aoiasd 2025-11-10 11:37:35 +08:00 committed by GitHub
parent f19fb283c3
commit a38a0deb43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -593,7 +593,10 @@ class InsertRecordSealed {
clear() { clear() {
timestamps_.clear(); timestamps_.clear();
timestamp_index_ = TimestampIndex(); timestamp_index_ = TimestampIndex();
if (pk2offset_) {
pk2offset_->clear(); pk2offset_->clear();
}
reserved = 0; reserved = 0;
if (estimated_memory_size_ > 0) { if (estimated_memory_size_ > 0) {
cachinglayer::Manager::GetInstance().RefundLoadedResource( cachinglayer::Manager::GetInstance().RefundLoadedResource(
@ -753,7 +756,9 @@ class InsertRecordGrowing {
clear() { clear() {
timestamps_.clear(); timestamps_.clear();
timestamp_index_ = TimestampIndex(); timestamp_index_ = TimestampIndex();
if (pk2offset_) {
pk2offset_->clear(); pk2offset_->clear();
}
reserved = 0; reserved = 0;
data_.clear(); data_.clear();
ack_responder_.clear(); ack_responder_.clear();