7.1.1 tiflash 应用快照,检查范围时不通过后无法重启

【 TiDB 版本】
7.1.1

tiflash.log :

[2023/09/08 02:24:28.699 +08:00] [INFO] [ApplySnapshot.cpp:425] ["Begin apply snapshot, new_region=[region 4903467509, applied: term 9 index 32513]"] [thread_id=780]
[2023/09/08 02:24:28.706 +08:00] [DEBUG] [KVStore.cpp:401] ["[region 4742192293] approx mem cache info: rows 1, bytes 0"] [thread_id=599]
[2023/09/08 02:24:28.706 +08:00] [DEBUG] [KVStore.cpp:419] ["[region 4742192293] flush region due to tryFlushRegionData, index 103757 term 12"] [thread_id=599]
[2023/09/08 02:24:28.706 +08:00] [DEBUG] [DeltaValueSpace.cpp:305] ["Flush start, delta=MemTableSet: 0 column files, 0 rows, 0 bytes, 0 deletes. ColumnFilePersistedSet [390]: 4 column files, 702 rows, 414630 bytes, 0 deletes."] [source="keyspace_id=4294967295 table_id=31069 segment_id=389 epoch=3"] [thread_id=599]
[2023/09/08 02:24:28.706 +08:00] [DEBUG] [DeltaValueSpace.cpp:329] ["Flush cancel because nothing to flush, delta=<delta_id=390>"] [source="keyspace_id=4294967295 table_id=31069 segment_id=389 epoch=3"] [thread_id=599]
[2023/09/08 02:24:28.706 +08:00] [INFO] [KVStore.cpp:342] ["Start to persist [region 4742192293, applied: term 12 index 103757], cache size: 0 bytes for `tryFlushRegionData`"] [thread_id=599]
[2023/09/08 02:24:28.707 +08:00] [DEBUG] [KVStore.cpp:344] ["Persist [region 4742192293] done"] [thread_id=599]
[2023/09/08 02:24:28.707 +08:00] [DEBUG] [KVStore.cpp:468] ["[region 4742192293] handle ignorable admin command CompactLog at [term: 12, index: 103757]"] [thread_id=599]
[2023/09/08 02:24:28.731 +08:00] [ERROR] [Exception.cpp:90] ["Code: 49, e.displayText() = DB::Exception: Check compare(range.getStart(), ext_file.range.getStart()) <= 0 && compare(range.getEnd(), ext_file.range.getEnd()) >= 0 failed: Detected illegal region boundary: range=[92706914,92782688) file_range=[92706914,92782689) . TiFlash will exit to prevent data inconsistency. If you accept data inconsistency and want to continue the service, set profiles.default.dt_enable_ingest_check=false ., e.what() = DB::Exception, Stack trace:\n\n\n       0x1bff13e\tDB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) [tiflash+29356350]\n                \tdbms/src/Common/Exception.h:46\n       0x73a309e\tDB::DM::DeltaMergeStore::ingestFiles(std::__1::shared_ptr<DB::DM::DMContext> const&, DB::DM::RowKeyRange const&, std::__1::vector<DB::DM::ExternalDTFileInfo, std::__1::allocator<DB::DM::ExternalDTFileInfo> > const&, bool) [tiflash+121254046]\n                \tdbms/src/Storages/DeltaMerge/DeltaMergeStore_Ingest.cpp:562\n       0x7e675c4\tDB::DM::DeltaMergeStore::ingestFiles(DB::Context const&, DB::Settings const&, DB::DM::RowKeyRange const&, std::__1::vector<DB::DM::ExternalDTFileInfo, std::__1::allocator<DB::DM::ExternalDTFileInfo> > const&, bool) [tiflash+132543940]\n                \tdbms/src/Storages/DeltaMerge/DeltaMergeStore.h:305\n       0x7f14f29\tvoid DB::KVStore::checkAndApplyPreHandledSnapshot<DB::RegionPtrWithSnapshotFiles>(DB::RegionPtrWithSnapshotFiles const&, DB::TMTContext&) [tiflash+133254953]\n                \tdbms/src/Storages/Transaction/ApplySnapshot.cpp:139\n       0x7f136b6\tvoid DB::KVStore::applyPreHandledSnapshot<DB::RegionPtrWithSnapshotFiles>(DB::RegionPtrWithSnapshotFiles const&, DB::TMTContext&) [tiflash+133248694]\n                \tdbms/src/Storages/Transaction/ApplySnapshot.cpp:430\n       0x7f8bf21\tApplyPreHandledSnapshot [tiflash+133742369]\n                \tdbms/src/Storages/Transaction/ProxyFFI.cpp:664\n  0x7faf3e24494f\t_$LT$engine_store_ffi..observer..TiFlashObserver$LT$T$C$ER$GT$$u20$as$u20$raftstore..coprocessor..ApplySnapshotObserver$GT$::post_apply_snapshot::h45b5cf6375ecda11 [libtiflash_proxy.so+24660303]\n  0x7faf3f25f10d\traftstore::store::worker::region::Runner$LT$EK$C$R$C$T$GT$::handle_pending_applies::h66e8650a4e2f7216 [libtiflash_proxy.so+41545997]\n  0x7faf3e86cdd8\tyatp::task::future::RawTask$LT$F$GT$::poll::hfd0a0f20e3e64844 [libtiflash_proxy.so+31116760]\n  0x7faf401aeabb\t_$LT$yatp..task..future..Runner$u20$as$u20$yatp..pool..runner..Runner$GT$::handle::hd372ccde2195d44f [libtiflash_proxy.so+57600699]\n  0x7faf3e353014\tstd::sys_common::backtrace::__rust_begin_short_backtrace::ha3dd0c9d9c69ba31 [libtiflash_proxy.so+25767956]\n  0x7faf3e39b748\tcore::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::h85ba517211ce55aa [libtiflash_proxy.so+26064712]\n  0x7faf3f8dc515\tstd::sys::unix::thread::Thread::new::thread_start::hd2791a9cabec1fda [libtiflash_proxy.so+48350485]\n                \t/rustc/96ddd32c4bfb1d78f0cd03eb068b1710a8cebeef/library/std/src/sys/unix/thread.rs:108\n  0x7faf3c3a1e65\tstart_thread [libpthread.so.0+32357]\n  0x7faf3bcb088d\tclone [libc.so.6+1042573]"] [source="void DB::ApplyPreHandledSnapshot(DB::EngineStoreServerWrap *, PreHandledSnapshot *) [PreHandledSnapshot = DB::PreHandledSnapshotWithFiles]"] [thread_id=780]

查了 region 4903467509 的大小是 54M,set profiles.default.dt_enable_ingest_check=false,设置这个后除了不检查外,如果有数据不一致的问题会自动修复吗?或者是否有别的解决方法?

因为TiFlash是作为Learner同步上游TiKV的数据的,所以如果想重建TiFlash某个region的数据,最简单方法就在上游触发一下split操作

tiup ctl:v7.1.1 pd operator add split-region 4742192293

另外,这个可能是之前一直遗留的问题,出问题的那个region是不是通过tidb-lightning工具的物理导入方式写入的啊?

这个应该是bug,设置这个参数只是保证tiflash进程不宕机,实际还是可能有数据不一致的问题,这个暂时处理不了。等升级7.1.2版本试试。。。

不想重建,现在这个问题导致节点起不来了,我们没有使用tidb-lightning,使用 insert into 写入的

那可以起来tiflash后,在上游TiKV上主动触发一下错误region的split,旧的region应该会直接被废弃掉

现在也是在考虑这个参数导致的不一致问题是否会被同步,不然再遇到还得做缩扩容

节点已经起不来了,这个region才54M呢

而且这样做的方式避免不了这个问题的产生吧~

现在就是要不设置这个参数,但是有数据不一致的风险,要不找到对应region对应的表,把哪个表的tiflash副本先给删除了

可能我删除副本还没缩容好使,因为我是两副本的,只有一个节点有问题的情况下至少还有其他副本可以正常使用

github.com/pingcap/tiflash/pull/6519 应该是在这个 pr 里面被 fix 了

看完放弃调整 dt_enable_ingest_check 了 :face_exhaling:

这个是 tikv 在某些条件下 split 的 region 边界,会导致 tiflash 通过 apply snapshot 同步数据后丢失部分行,因此加上了一个显式的检查,避免静默情况下数据不一致问题的发生。

7.1.1 版本遇到了这个问题需要重建 tiflash 节点;或者通过 profiles.default.dt_enable_ingest_check 暂时禁用这个检查,让 tiflash 节点启动后,清理 tiflash 副本。不过暂时无法避免这个情况再次发生。

后面我们在 tiflash 兼容处理了这样的 region 边界,现在修改已经合并到 release-7.1 分支。等待下一个 patch 版本 v7.1.2 出来后就不会出现这个问题了。
https://github.com/pingcap/tiflash/pull/7912

2 个赞

好的,谢谢老师

此话题已在最后回复的 60 天后被自动关闭。不再允许新回复。