Handler Finalize() methods are never called, so intended indexes are never created
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
從 Analyzer/SQLite/Handlers/ISQLiteHandler.cs 和 SerializedFileSQLiteWriter 中的處理器生命週期開始;檢查 SQLiteWriter.End(),將其作為建議的最終化進入點。追蹤處理器的處理方式,然後透過檢查預期的四個索引是否出現在 analyze 資料庫中,以及過時的空存根是否得到一致處理,來驗證完成情況。
由索引模型根據 Issue 內容生成。
描述
Summary
The ISQLiteHandler implementations each define a public void Finalize(SqliteConnection db) method, but nothing ever calls it. Finalize is not part of the ISQLiteHandler interface (which only declares Init, Process, and Dispose), and there is no dispatch site anywhere in the codebase. As a result, the finalization work in those methods never runs.
For most handlers the method is an empty stub, but two of them create indexes that are therefore never created:
AssetBundleHandler.Finalize->preload_dependencies_object,preload_dependencies_dependencyShaderHandler.Finalize->shader_subprograms_shader_index,shader_subprogram_keywords_subprogram_id_index
(Note: SQLiteWriter.End() runs Resources.Finalize / Finalize.sql, which creates the refs indexes. That is a separate, top-level mechanism and does run - it is unrelated to these per-handler Finalize methods.)
Impact
- The four indexes above are missing from every analyze database, so queries that filter/join on
preload_dependencies(object),preload_dependencies(dependency),shader_subprograms(shader), andshader_subprogram_keywords(subprogram_id)do full scans. This is a performance issue only; results are still correct. - The empty
Finalizestubs in the other handlers are dead code and misleadingly imply a finalization step exists.
Evidence
After running analyze on TestCommon/Data/LeadingEdgeBuilds/AssetBundles:
sqlite> SELECT name FROM sqlite_master WHERE type='index' AND name LIKE 'preload_%';
-- (no rows)
The preload_dependencies table and its data are present, but the indexes are not.
Affected files
Analyzer/SQLite/Handlers/ISQLiteHandler.cs- interface has noFinalize.- Non-empty bodies:
Analyzer/SQLite/Handlers/AssetBundleHandler.cs,Analyzer/SQLite/Handlers/ShaderHandler.cs. - Empty stubs:
AnimationClipHandler.cs,AudioClipHandler.cs,BuildReportHandler.cs,MeshHandler.cs,MonoScriptHandler.cs,PackedAssetsHandler.cs,PreloadDataHandler.cs,Texture2DHandler.cs.
Suggested fix
Either:
-
Wire it up - add
Finalize(SqliteConnection db)toISQLiteHandlerand invoke it once per handler after all serialized files are processed (the handler lifecycle is owned bySerializedFileSQLiteWriter;SQLiteWriter.End()is the natural point at which finalization runs). Drop the now-redundant empty overrides where possible. This restores the four intended indexes. -
Delete the dead code - if the indexes are not wanted, remove all the
Finalizemethods.
Option 1 is preferred since the indexes are clearly intended and benefit lookups on the dependency and shader-subprogram tables.
Notes
The two preload_dependencies_* index names were just updated in #82 (table rename); this bug predates that change - the indexes were never created under their old asset_dependencies_* names either.
- 主要語言
- C#
- 星號
- 829
- 分支
- 72
- 平均合併
- 23 小時 24 分鐘
- 30 天內合併 PR
- 14
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
Unity-Technologies/UnityDataTools 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 78/100
Unity-Technologies/UnityDataTools#146 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 75/100
Unity-Technologies/UnityDataTools#138 ·
維護者通常 1 天內回覆
-
enhancement
難度 2/5 1-3 小時 新手友好度 68/100
Unity-Technologies/UnityDataTools#116 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
Unity-Technologies/UnityDataTools#93 ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 52/100
Unity-Technologies/UnityDataTools#139 ·
維護者通常 1 天內回覆
查看 Unity-Technologies/UnityDataTools 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 66/100
MicrosoftLearning/PL-400_Microsoft-Power-Platform-Developer#231 ·
-
難度 2/5 1-3 小時 新手友好度 66/100
joinrpg/joinrpg-net#5313 ·
維護者通常 1 天內回覆
-
[12.x] FixIncorrectOwnerIdRelationships can delete legitimate library roots when UserView shares the same path可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 74/100
-
難度 2/5 1-3 小時 新手友好度 79/100
維護者通常 1 天內回覆