fix: FixRawSize CanAccept SQL array cast typo#1035
Merged
Conversation
$1::[]bigint is Go slice syntax, not PostgreSQL. Should be $1::bigint[]. Causes 'syntax error at or near "["' on every poll cycle, preventing all FixRawSize tasks from being accepted. Introduced in #855 (improve canAccept() performance) — every other CanAccept rewrite in that PR uses the correct ::bigint[] form; this one file was missed.
snadrus
approved these changes
Feb 19, 2026
Reiers
added a commit
that referenced
this pull request
Feb 19, 2026
The sector_location join uses mpd.miner_id, but market_piece_deal has no miner_id column — it should be l.miner_id (sector_location.miner_id). This causes: column mpd.miner_id does not exist (SQLSTATE 42703) Matches the join pattern used by every other CanAccept (e.g. task_treed.go): INNER JOIN sector_location l ON p.sp_id = l.miner_id AND ... Follow-up to #1035. Both bugs introduced in #855.
Reiers
added a commit
that referenced
this pull request
Feb 19, 2026
Three SQL bugs in task_fix_rawSize.go, all using nonexistent columns: 1. CanAccept (line 132): mpd.miner_id → l.miner_id market_piece_deal has no miner_id column; the join should reference sector_location.miner_id. Caused: column mpd.miner_id does not exist (SQLSTATE 42703) 2. Do (line 43): mpd.sector_number → mpd.sector_num market_piece_deal column is sector_num, not sector_number. This bug was masked because CanAccept always fails first (task never accepted), so Do() was never reached. 3. Do (line 46) and CanAccept (line 132): same sector_number → sector_num fix in join conditions against sectors_meta and sector_location. Every other query against market_piece_deal in the codebase (task_commp.go, task_check_indexes.go, cachedreader.go, market.go) correctly uses sector_num. Full column audit performed against schema definitions in: - 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 queries in the file verified column-by-column. Follow-up to #1035 (array cast fix). All bugs introduced in #855.
Reiers
added a commit
that referenced
this pull request
Feb 19, 2026
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).
snadrus
pushed a commit
that referenced
this pull request
Feb 19, 2026
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).
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
Fix PostgreSQL syntax error in
FixRawSize.CanAccept()that breaks all FixRawSize task acceptance on v1.27.3-rc1.Problem
tasks/storage-market/task_fix_rawSize.go:134has:::[]is Go slice syntax, not valid PostgreSQL. The[after::triggers:This fires on every 3s poll cycle, rejecting all FixRawSize tasks. The scheduler (
IAmBored, 60s interval) keeps creating entries up to its cap of 100, none of which can ever be accepted.Fix
Every other
CanAcceptrewrite in the codebase already uses the correct::bigint[]form.Root Cause
Introduced in #855 (improve canAccept() performance) — all other files in that PR use the correct cast; this one was missed.