Title: Handler Finalize() methods are never called, so intended indexes are never created · Issue #83 · Unity-Technologies/UnityDataTools · GitHub
Open Graph Title: Handler Finalize() methods are never called, so intended indexes are never created · Issue #83 · Unity-Technologies/UnityDataTools
X Title: Handler Finalize() methods are never called, so intended indexes are never created · Issue #83 · Unity-Technologies/UnityDataTools
Description: 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), ...
Open Graph Description: 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 onl...
X Description: 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 onl...
Opengraph URL: https://github.com/Unity-Technologies/UnityDataTools/issues/83
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Handler Finalize() methods are never called, so intended indexes are never created","articleBody":"## Summary\n\nThe `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.\n\nFor most handlers the method is an empty stub, but two of them create indexes that are therefore never created:\n\n- `AssetBundleHandler.Finalize` -\u003e `preload_dependencies_object`, `preload_dependencies_dependency`\n- `ShaderHandler.Finalize` -\u003e `shader_subprograms_shader_index`, `shader_subprogram_keywords_subprogram_id_index`\n\n(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.)\n\n## Impact\n\n- 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)`, and `shader_subprogram_keywords(subprogram_id)` do full scans. This is a performance issue only; results are still correct.\n- The empty `Finalize` stubs in the other handlers are dead code and misleadingly imply a finalization step exists.\n\n## Evidence\n\nAfter running `analyze` on `TestCommon/Data/LeadingEdgeBuilds/AssetBundles`:\n\n```\nsqlite\u003e SELECT name FROM sqlite_master WHERE type='index' AND name LIKE 'preload_%';\n-- (no rows)\n```\n\nThe `preload_dependencies` table and its data are present, but the indexes are not.\n\n## Affected files\n\n- `Analyzer/SQLite/Handlers/ISQLiteHandler.cs` - interface has no `Finalize`.\n- Non-empty bodies: `Analyzer/SQLite/Handlers/AssetBundleHandler.cs`, `Analyzer/SQLite/Handlers/ShaderHandler.cs`.\n- Empty stubs: `AnimationClipHandler.cs`, `AudioClipHandler.cs`, `BuildReportHandler.cs`, `MeshHandler.cs`, `MonoScriptHandler.cs`, `PackedAssetsHandler.cs`, `PreloadDataHandler.cs`, `Texture2DHandler.cs`.\n\n## Suggested fix\n\nEither:\n\n1. **Wire it up** - add `Finalize(SqliteConnection db)` to `ISQLiteHandler` and invoke it once per handler after all serialized files are processed (the handler lifecycle is owned by `SerializedFileSQLiteWriter`; `SQLiteWriter.End()` is the natural point at which finalization runs). Drop the now-redundant empty overrides where possible. This restores the four intended indexes.\n\n2. **Delete the dead code** - if the indexes are not wanted, remove all the `Finalize` methods.\n\nOption 1 is preferred since the indexes are clearly intended and benefit lookups on the dependency and shader-subprogram tables.\n\n## Notes\n\nThe 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.\n","author":{"url":"https://github.com/SkowronskiAndrew","@type":"Person","name":"SkowronskiAndrew"},"datePublished":"2026-07-06T01:21:06.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/83/UnityDataTools/issues/83"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0121c002-8e55-56cb-4e26-c47003291f48 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8506:2781A3:12CC088:198E060:6A5F1856 |
| html-safe-nonce | 721650c93057fe3edf7c8819f74b0f71b23c78577681917dc037894cf0e21ff9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NTA2OjI3ODFBMzoxMkNDMDg4OjE5OEUwNjA6NkE1RjE4NTYiLCJ2aXNpdG9yX2lkIjoiNzEwMjg5MTA0MzMwMjg3MzE3NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 272689545d862139d8095f3476b03ad1f1bbe69523f93dbadd53e8f9f19f0590 |
| hovercard-subject-tag | issue:4815222412 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/Unity-Technologies/UnityDataTools/83/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8a1a53b2924f182c0bf4531941c818bd35b4be5ffc8f30c5e40b87c6a2a5cb26/Unity-Technologies/UnityDataTools/issues/83 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8a1a53b2924f182c0bf4531941c818bd35b4be5ffc8f30c5e40b87c6a2a5cb26/Unity-Technologies/UnityDataTools/issues/83 |
| og:image:alt | 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 onl... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | SkowronskiAndrew |
| hostname | github.com |
| expected-hostname | github.com |
| None | bf8fa4b42b6d150def6175efb9b0f1ec8e9628d7229ee2bdf6e850e7bdad923e |
| turbo-cache-control | no-preview |
| go-import | github.com/Unity-Technologies/UnityDataTools git https://github.com/Unity-Technologies/UnityDataTools.git |
| octolytics-dimension-user_id | 426196 |
| octolytics-dimension-user_login | Unity-Technologies |
| octolytics-dimension-repository_id | 472365703 |
| octolytics-dimension-repository_nwo | Unity-Technologies/UnityDataTools |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 472365703 |
| octolytics-dimension-repository_network_root_nwo | Unity-Technologies/UnityDataTools |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7debc3c6cd5de09c6e22b47a1b9982acb2aabb7b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width