fix: FixRawSize SQL column name, join, and filetype bugs#1037
Merged
Conversation
277bc49 to
bbdc4cc
Compare
Four SQL bugs in task_fix_rawSize.go, all introduced in #855: 1. CanAccept: mpd.miner_id → l.miner_id market_piece_deal has no miner_id column; join should reference sector_location.miner_id. Error: column mpd.miner_id does not exist (SQLSTATE 42703) 2. Do + CanAccept: mpd.sector_number → mpd.sector_num market_piece_deal column is sector_num, not sector_number. Masked in Do() because CanAccept always fails first. 3. Do: same sector_number fix in sectors_meta join condition. 4. CanAccept: sector_filetype = 4 → sector_filetype = 1 Restored to FTUnsealed (original value before #855). The task reads piece data via ReadPiece() which requires unsealed sector data, not cache. The existing panic guard (storiface.FTUnsealed != 1) confirms the original intent. Changed to 4 (FTCache) during the #855 rewrite by copying the pattern from task_treed.go (which correctly uses FTCache for its own purposes). Every other query against market_piece_deal in the codebase correctly uses sector_num (task_check_indexes.go, cachedreader.go, market.go). Full column-by-column audit performed against schema definitions in: 20260211-fix-raw-size-table.sql, 20240731-market-migration.sql, 20240425-sector_meta.sql, 20230712-sector_index.sql. All 7 queries in the file verified. Follow-up to #1035 (array cast fix).
bbdc4cc to
0db0e95
Compare
snadrus
approved these changes
Feb 19, 2026
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.
Summary
Complete fix for all SQL bugs in
FixRawSize(task_fix_rawSize.go). Follow-up to #1035 (array cast fix). All bugs introduced in #855.Bugs Fixed (4)
1. CanAccept: wrong table alias in join
market_piece_dealhas nominer_idcolumn →column mpd.miner_id does not exist (SQLSTATE 42703)2. Do() + CanAccept: wrong column name
sector_numbermarket_piece_dealcolumn issector_num, notsector_number. Bug in Do() was masked because CanAccept() always fails first — task is never accepted, Do() is never reached.3. Do(): same column name bug in sectors_meta join
4. CanAccept: wrong sector_filetype constant
Restored to
FTUnsealed(1), which was the original value before #855. The task reads piece data viaReadPiece()which requires unsealed sector data, not cache. The existing panic guard (storiface.FTUnsealed != 1) on line 116 confirms the original intent. Changed to 4 (FTCache) during the #855 rewrite by copying the pattern fromtask_treed.go(which correctly uses FTCache for its own purposes).Verification
Every other query against
market_piece_dealin the codebase correctly usessector_num:tasks/indexing/task_check_indexes.golib/cachedreader/cachedreader.goweb/api/webrpc/market.goFull column-by-column audit against schema definitions:
20260211-fix-raw-size-table.sql(market_fix_raw_size)20240731-market-migration.sql(market_piece_deal)20240425-sector_meta.sql(sectors_meta)20230712-sector_index.sql(sector_location, storage_path)All 7 SQL queries in the file verified.