Bug: Migration step 06 fails on incomplete stamp metadata, causing total data loss
メンテナーはふだん 3 日以内に返信
@gacevicljubisa がすでに取り組んでいます。
2025年9月22日 から。
評価
この issue はまだ評価されていません。
説明
Summary
Migration step 06 can fail during upgrade to 2.6.0+ when any chunk lacks complete postage stamp metadata, leaving the database in an inconsistent state where all chunks become unreachable despite remaining in storage.
Expected Behavior
- Migration should handle missing or incomplete stamp metadata gracefully
- Failed migration should not leave database in broken state
- Users should be warned about potential data issues before migration runs
- Rollback mechanism should exist for failed migrations
Current Behavior
Migration fails with recommendation to "nuke" the database when:
- Any
BatchRadiusItemV1chunk cannot compute stampHash chunkstamp.LoadWithBatchID()fails for any chunk- Database left with deleted old indexes but no new indexes created
- All data becomes unreachable (both pinned and regular chunks)
Root Cause
Migration step 06 (pkg/storer/migration/step_06.go:112-118) uses atomic approach:
stamp, err := chunkstamp.LoadWithBatchID(idxStore, "reserve", batchRadiusItemV1.Address, batchRadiusItemV1.BatchID)
if err != nil {
return err // MIGRATION FAILS - database inconsistent
}
// Old item already deleted at line 122, new item creation fails
The migration deletes old schema items before ensuring new schema items can be created successfully.
Steps to Reproduce
- Run bee node with incomplete stamp metadata (common in older versions)
- Upgrade to 2.6.0+
- Migration step 06 fails on first chunk with missing stamp data
- Observe error: "It's recommended that the nuke cmd is run to reset the node"
- Verify chunks exist in storage but cannot be retrieved via any API
Impact
- Critical: Total data loss requiring database reset
- Affects: Nodes upgrading from pre-2.6.0 versions
- User experience: Forced to choose between upgrade and data preservation
Proposed Solutions
Option 1: Graceful Degradation
- Skip chunks with missing stamp metadata during migration
- Log warnings for problematic chunks
- Allow migration to complete with partial data
Option 2: Two-Phase Migration
- Phase 1: Validate all chunks can be migrated successfully
- Phase 2: Only proceed with atomic migration if Phase 1 succeeds
- Provide clear error reporting on validation failures
Option 3: Stamp Reconstruction
- Attempt to reconstruct missing stamp metadata from available data
- Use chunk content and batch information to rebuild stamps
- Fall back to graceful degradation if reconstruction fails
Required Changes
- Modify
pkg/storer/migration/step_06.gomigration logic - Add pre-migration validation checks
- Improve error handling and rollback mechanisms
- Update migration failure messaging with recovery options
- Add telemetry to track migration success rates
Additional Context
This issue has caused recurring data loss during bee upgrades, particularly affecting nodes with customer data where database reset is not acceptable. The current "nuke database" recommendation is inadequate for production deployments.
Related Issues
- Pin eviction protection issue (chunks lost due to eviction) #5215
- Migration should coordinate with pinning system to prioritize preserving pinned data
- 主要言語
- Go
- スター
- 1.5k
- フォーク
- 390
- 平均マージ
- 2日 22時間
- マージ済み PR(30日)
- 24
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ethersphere/bee のほかの issue
-
Chequebook deployment uses a fixed 175,000 gas limit; it needs about 630,000 under Glamsterdam (live on Sepolia since 2026-10-06)再び着手できるかも @sbackend123 が 30 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
ethersphere/bee#5650 · 担当者 1 名 ·
メンテナーはふだん 3 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
ethersphere/bee#5682 ·
メンテナーはふだん 3 日以内に返信
-
ENSv2 is not supported, `resolve failed`対応中かも @akrem-chabchoub が 9 日前に担当しました。 オープン
ethersphere/bee#5680 · 担当者 1 名 ·
メンテナーはふだん 3 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
ethersphere/bee#5678 ·
メンテナーはふだん 3 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
ethersphere/bee#5666 ·
メンテナーはふだん 3 日以内に返信
ethersphere/bee の issue をすべて見る
似ている issue
-
component/mesheryctl kind/bug language/go
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
meshery/meshery#22993 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
-
frontend size:S
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
shukiv/jabali-panel#2423 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100