[BUG] add case for write only index of double update
This commit is contained in:
@ -1130,6 +1130,10 @@ int ObDMLService::init_dml_param(const ObDASDMLBaseCtDef &base_ctdef,
|
|||||||
if (base_ctdef.is_insert_up_) {
|
if (base_ctdef.is_insert_up_) {
|
||||||
dml_param.write_flag_.set_is_insert_up();
|
dml_param.write_flag_.set_is_insert_up();
|
||||||
}
|
}
|
||||||
|
if (dml_param.table_param_->get_data_table().is_storage_index_table()
|
||||||
|
&& !dml_param.table_param_->get_data_table().can_read_index()) {
|
||||||
|
dml_param.write_flag_.set_is_write_only_index();
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -133,6 +133,17 @@ int check_sequence_set_violation(const concurrent_control::ObWriteFlag write_fla
|
|||||||
&& blocksstable::ObDmlFlag::DF_UPDATE == writer_dml_flag
|
&& blocksstable::ObDmlFlag::DF_UPDATE == writer_dml_flag
|
||||||
&& blocksstable::ObDmlFlag::DF_UPDATE == locker_dml_flag) {
|
&& blocksstable::ObDmlFlag::DF_UPDATE == locker_dml_flag) {
|
||||||
// bypass the case
|
// bypass the case
|
||||||
|
// Case 9: For the case of the write only index, it may operate the same
|
||||||
|
// row more than once under the case that main table has two rows pointing
|
||||||
|
// to the same index which is building during the first stage(in which
|
||||||
|
// stage update and insert should consider index while the index is not
|
||||||
|
// readable). In the case, an update may update the same row on the index.
|
||||||
|
// So we need report the batched stmt warning according to this case.
|
||||||
|
} else if (write_flag.is_write_only_index()) {
|
||||||
|
ret = OB_ERR_PRIMARY_KEY_DUPLICATE;
|
||||||
|
TRANS_LOG(WARN, "write only index insert/update on the same row", K(ret),
|
||||||
|
K(writer_tx_id), K(writer_dml_flag), K(writer_seq_no),
|
||||||
|
K(locker_tx_id), K(locker_dml_flag), K(locker_seq_no));
|
||||||
} else {
|
} else {
|
||||||
// Others: It will never happen that two operaions on the same row for the
|
// Others: It will never happen that two operaions on the same row for the
|
||||||
// same txn except the above cases. So we should report unexpected error.
|
// same txn except the above cases. So we should report unexpected error.
|
||||||
|
|||||||
@ -29,6 +29,7 @@ struct ObWriteFlag
|
|||||||
#define OBWF_BIT_MDS 1
|
#define OBWF_BIT_MDS 1
|
||||||
#define OBWF_BIT_DML_BATCH_OPT 1
|
#define OBWF_BIT_DML_BATCH_OPT 1
|
||||||
#define OBWF_BIT_INSERT_UP 1
|
#define OBWF_BIT_INSERT_UP 1
|
||||||
|
#define OBWF_BIT_WRITE_ONLY_INDEX 1
|
||||||
#define OBWF_BIT_RESERVED 61
|
#define OBWF_BIT_RESERVED 61
|
||||||
|
|
||||||
static const uint64_t OBWF_MASK_TABLE_API = (0x1UL << OBWF_BIT_TABLE_API) - 1;
|
static const uint64_t OBWF_MASK_TABLE_API = (0x1UL << OBWF_BIT_TABLE_API) - 1;
|
||||||
@ -36,18 +37,20 @@ struct ObWriteFlag
|
|||||||
static const uint64_t OBWF_MASK_MDS = (0x1UL << OBWF_BIT_MDS) - 1;
|
static const uint64_t OBWF_MASK_MDS = (0x1UL << OBWF_BIT_MDS) - 1;
|
||||||
static const uint64_t OBWF_MASK_DML_BATCH_OPT = (0x1UL << OBWF_BIT_DML_BATCH_OPT) - 1;
|
static const uint64_t OBWF_MASK_DML_BATCH_OPT = (0x1UL << OBWF_BIT_DML_BATCH_OPT) - 1;
|
||||||
static const uint64_t OBWF_MASK_INSERT_UP = (0x1UL << OBWF_BIT_INSERT_UP) - 1;
|
static const uint64_t OBWF_MASK_INSERT_UP = (0x1UL << OBWF_BIT_INSERT_UP) - 1;
|
||||||
|
static const uint64_t OBWF_MASK_WRITE_ONLY_INDEX = (0x1UL << OBWF_BIT_WRITE_ONLY_INDEX) - 1;
|
||||||
|
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
uint64_t flag_;
|
uint64_t flag_;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
uint64_t is_table_api_ : OBWF_BIT_TABLE_API; // 0: false(default), 1: true
|
uint64_t is_table_api_ : OBWF_BIT_TABLE_API; // 0: false(default), 1: true
|
||||||
uint64_t is_table_lock_ : OBWF_BIT_TABLE_LOCK; // 0: false(default), 1: true
|
uint64_t is_table_lock_ : OBWF_BIT_TABLE_LOCK; // 0: false(default), 1: true
|
||||||
uint64_t is_mds_ : OBWF_BIT_MDS; // 0: false(default), 1: true
|
uint64_t is_mds_ : OBWF_BIT_MDS; // 0: false(default), 1: true
|
||||||
uint64_t is_dml_batch_opt_ : OBWF_BIT_DML_BATCH_OPT; // 0: false(default), 1: true
|
uint64_t is_dml_batch_opt_ : OBWF_BIT_DML_BATCH_OPT; // 0: false(default), 1: true
|
||||||
uint64_t is_insert_up_ : OBWF_BIT_INSERT_UP; // 0: false(default), 1: true
|
uint64_t is_insert_up_ : OBWF_BIT_INSERT_UP; // 0: false(default), 1: true
|
||||||
uint64_t reserved_ : OBWF_BIT_RESERVED;
|
uint64_t is_write_only_index_ : OBWF_BIT_WRITE_ONLY_INDEX; // 0: false(default), 1: true
|
||||||
|
uint64_t reserved_ : OBWF_BIT_RESERVED;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -63,13 +66,15 @@ struct ObWriteFlag
|
|||||||
inline void set_is_dml_batch_opt() { is_dml_batch_opt_ = true; }
|
inline void set_is_dml_batch_opt() { is_dml_batch_opt_ = true; }
|
||||||
inline bool is_insert_up() const { return is_insert_up_; }
|
inline bool is_insert_up() const { return is_insert_up_; }
|
||||||
inline void set_is_insert_up() { is_insert_up_ = true; }
|
inline void set_is_insert_up() { is_insert_up_ = true; }
|
||||||
|
inline bool is_write_only_index() const { return is_write_only_index_; }
|
||||||
|
inline void set_is_write_only_index() { is_write_only_index_ = true; }
|
||||||
|
|
||||||
TO_STRING_KV("is_table_api", is_table_api_,
|
TO_STRING_KV("is_table_api", is_table_api_,
|
||||||
"is_table_lock", is_table_lock_,
|
"is_table_lock", is_table_lock_,
|
||||||
"is_mds", is_mds_,
|
"is_mds", is_mds_,
|
||||||
"is_dml_batch_opt", is_dml_batch_opt_,
|
"is_dml_batch_opt", is_dml_batch_opt_,
|
||||||
"is_insert_up", is_insert_up_);
|
"is_insert_up", is_insert_up_,
|
||||||
|
"is_write_only_index", is_write_only_index_);
|
||||||
|
|
||||||
OB_UNIS_VERSION(1);
|
OB_UNIS_VERSION(1);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user