提交 99c5e80f 编写于 作者: L lihongjian 提交者: mergify[bot]

fix(tianmu):Remove excess log printing and add some code comments(#1545)

上级 09f0e402
......@@ -51,9 +51,6 @@ void CombinedIterator::Next() {
}
} else {
base_iter_->Next();
if (base_iter_->Valid()) {
TIANMU_LOG(LogCtl_Level::ERROR, "base pos: %d", base_iter_->Position());
}
}
}
......@@ -85,8 +82,8 @@ bool CombinedIterator::Valid() const { return Position() != -1; }
bool CombinedIterator::IsBase() const { return is_base_; }
bool CombinedIterator::BaseCurrentRowIsInvalid() const {
if (base_iter_->CurrentRowIsDeleted() || InDeltaDeletedRow.find(base_iter_->Position()) != InDeltaDeletedRow.end() ||
InDeltaUpdateRow.find(base_iter_->Position()) != InDeltaUpdateRow.end()) {
if (InDeltaDeletedRow.find(base_iter_->Position()) != InDeltaDeletedRow.end() ||
InDeltaUpdateRow.find(base_iter_->Position()) != InDeltaUpdateRow.end() || base_iter_->CurrentRowIsDeleted()) {
return true;
}
return false;
......
......@@ -1259,8 +1259,10 @@ int ha_tianmu::fill_row(uchar *buf) {
std::memcpy(buffer.get(), table->record[0], table->s->reclength);
}
if (iterator_->IsBase()) {
// judge whether this line has been deleted.
// if this line has been deleted, data will not be copied.
/*
Determine whether the current row is invalid in the base layer,
If it is invalid, directly return to the SQL layer that the current row has been deleted
*/
if (iterator_->BaseCurrentRowIsInvalid()) {
current_position_ = iterator_->Position();
iterator_->Next();
......@@ -1275,6 +1277,7 @@ int ha_tianmu::fill_row(uchar *buf) {
if (!delta_record.empty()) {
switch (core::DeltaRecordHead::GetRecordType(delta_record.data())) {
case core::RecordType::kInsert:
// If the function change fails, it will be considered that the row change has been deleted.
if (!core::Engine::DecodeInsertRecordToField(delta_record.data(), table->field)) {
current_position_ = iterator_->Position();
iterator_->Next();
......@@ -1283,6 +1286,11 @@ int ha_tianmu::fill_row(uchar *buf) {
}
break;
case core::RecordType::kUpdate:
/*
Merge data from the base layer and delta layer.
At the same time, record the status of switching to the delta layer
When iterating the base layer data, it is judged as invalid for changing rows
*/
current_txn_->GetTableByPath(table_name_)->FillRowByRowid(table, iterator_->Position());
core::Engine::DecodeUpdateRecordToField(delta_record.data(), table->field);
iterator_->InDeltaUpdateRow.insert(
......@@ -1290,6 +1298,11 @@ int ha_tianmu::fill_row(uchar *buf) {
break;
case core::RecordType::kDelete:
current_position_ = iterator_->Position();
/*
If there is deleted data with a new row in the delta layer,
Just record it down,
When iterating the base layer data, it is judged as invalid for changing rows
*/
iterator_->InDeltaDeletedRow.insert(std::unordered_map<int64_t, bool>::value_type(current_position_, true));
iterator_->Next();
dbug_tmp_restore_column_map(table->write_set, org_bitmap);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册