问题:Doris insert into 正常执行成功,select 查询也执行成功,但查不到该写入数据
原因:由于有其他 insert commit 事务待提交且该任务处于锁的状态,导致不断在回滚,进而造成其他的insert into 语句也执行成功,但是select不到写入的数据。一是集群性能太差的缘故,二是写入访问过多,导致查询tablet文件部分丢失,却回滚事务异常,Doris FE webui Log WARN日志打印初步判定是此原因,情况出现很少。
Doris FE webui WARN-Log 或者搜ERROR:
WARN (replayer|98) [BDBJournalCursor.next():148] Catch an exception when get next JournalEntity. key:12925859com.sleepycat.je.LockTimeoutException: (JE 18.3.12) Lock expired. Locker 1399794957 -1_replayer_ReplicaThreadLocker: waited for lock on database=12924945 LockAddr:1044707672 LSN=0x389/0xa5b46 type=READ grant=WAIT_NEW timeoutMillis=5000 startTime=1717660685364 endTime=1717660690364Owners: [
2024-06-06 16:09:17,902 WARN (mysql-nio-pool-13|355) [StmtExecutor.executeByLegacy():770] execute Exception. stmt[24765, 35fb3e655af74ffa-a62f0bbb830f6315]org.apache.doris.common.UserException: errCode = 2, detailMessage = (172.29.xxx.xx)[CANCELLED][INTERNAL_ERROR]failed to initialize storage reader. tablet=41483.2004477475.1d4d610d5642ea3b-9ac11667e188518b, res=[E-230]missed_versions is empty0. /root/src/doris-2.0/be/src/common/stack_trace.cpp:302: StackTrace::tryCapture() @ 0x000000000b86cf47 in /data/software/doris-1.2.4/be/lib/doris_be1. /root/src/doris-2.0/be/src/common/stack_trace.h:0: doris::get_stack_trace[abi:cxx11]() @ 0x000000000b86b5b5 in /data/software/doris-1.2.4/be/lib/doris_be2. /var/local/ldb-toolchain/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/basic_string.h:187: doris::Status doris::Status::Error
解决:
-- 会话窗执行变量配置,关闭 insert 事务
set enable_odbc_transcation = false;