test(location): commit the track fixture once, not per fix - #562
Merged
Conversation
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 1 selected item(s). |
whes1015
force-pushed
the
fix/track-fixture-commit-storm
branch
from
August 31, 2026 23:30
2333d0e to
e88abb6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
這個 PR 做了什麼
把
location_track_test.dart的 fixture 寫入包進單一 transaction,讓兩萬列不再是兩萬次 fsync。相關 issue
怎麼驗
main的 CI 在 33449700473 掛掉,只紅一項:二十分鐘前的那次跑同樣的程式碼是綠的,而測試檔和
LocationTrack從寫出來到現在都沒有動過。所以不是壞掉,是本來就貼著上限。_writeFixture一次寫一列,因為原生的LocationTrackStore就是這樣寫的。但在 WAL 模式下每一列都是自己的 commit、自己的 fsync,而底下那個 compactness 測試要它寫兩萬列。本機 SSD 一次 fsync 幾十微秒,共用的 CI runner 磁碟一到兩毫秒,20000 乘上 1.5 毫秒剛好就是那三十秒。包成一個 transaction 只改變頁面什麼時候落盤,不改變裡面裝什麼。改前改後各量一次:
一個位元組都沒差,所以
lessThan(20)仍然在量編碼本身,有人把絕對值存回去時照樣會失敗。單獨跑該測試,暖機後各兩次(
flutter test啟動地板約 2.3 秒):測試本體從約 1.05 秒降到約 0.2 秒,縮掉的正是隨磁碟延遲放大的那一項。
順帶掃過整個 test 樹:只有這個檔案會開磁碟上的 sqlite,另一個
test/core/storage/memory_db.dart是純記憶體的 helper,沒有 fsync。全套 1779 項測試裡最慢的一項是 2.1 秒,離 30 秒還很遠,這類逾時目前沒有第二處。檢查清單
tool/check/commits.sh origin/main..HEAD通過tool/dev/analyze.sh與tool/dev/test.sh通過(tool/commit.sh全綠,1767 項)