Description:
The dict_index_t::is_usable function relies on the dict_index_t::trx_id for determining index visibility. However, during the online DDL process, dict_index_t is elevated by Context::note_max_trx_id. In certain scenarios and timings, this elevation seems to lead to inconsistencies between the query results of secondary indexes and those of primary indexes.
How to repeat:
```
diff --git a/mysql-test/t/row_log_mvcc_error.test b/mysql-test/t/row_log_mvcc_error.test
new file mode 100644
index 00000000000..17a4a91ffc3
--- /dev/null
+++ b/mysql-test/t/row_log_mvcc_error.test
@@ -0,0 +1,47 @@
+--source include/have_debug.inc
+
+create table t1 (c1 int primary key, c2 int, c3 int);
+create table t2 (c1 int primary key, c2 int, c3 int);
+
+insert into t1 values (1, 10, 100);
+insert into t1 values (3, 30, 300);
+insert into t1 values (5, 50, 500);
+
+insert into t2 values (1, 10, 100);
+
+--connect(con1,localhost,root)
+--connect(con2,localhost,root)
+
+--connection con1
+SET DEBUG_SYNC = 'ddl_before_scan WAIT_FOR go';
+--send ALTER TABLE t1 ADD unique key (c2), ALGORITHM=INPLACE, LOCK=NONE;
+
+--connection con2
+sleep 1;
+insert into t1 values (7, 70, 700);
+
+--connection default
+begin;
+select * from t2;
+
+--connection con2
+delete from t1 where c1 = 5;
+set debug_sync = 'now signal go';
+
+--connection con1
+--reap
+
+--connection default
+select c1, c2 from t1 force index(primary);
+select c1, c2 from t1 force index(c2);
+
+select count(c2) from t1 force index(primary) into @pk_cnt;
+select count(c2) from t1 force index(c2) into @sec_cnt;
+commit;
+
+--let $assert_text = Query result should be same
+--let $assert_cond = @pk_cnt = @sec_cnt
+--source include/assert.inc
+
+drop table t1;
+drop table t2;
diff --git a/storage/innobase/ddl/ddl0loader.cc b/storage/innobase/ddl/ddl0loader.cc
index 667725fbe25..9237173d80e 100644
--- a/storage/innobase/ddl/ddl0loader.cc
+++ b/storage/innobase/ddl/ddl0loader.cc
@@ -433,6 +433,8 @@ dberr_t Loader::scan_and_build_indexes() noexcept {
auto err = m_ctx.read_init(cursor);
+ DEBUG_SYNC_C("ddl_before_scan");
+
if (err == DB_SUCCESS) {
cursor->open();
```
Then run MTR test:
./mtr row_log_mvcc_error