algorand / algorand/go-algorand

algod fails to restart with separate HotDataDir/ColdDataDir: "destination file .../stateproof.sqlite already exists, not overwriting"

Đã đóng
#6,731 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
Go
Star
1.4k
Fork
537
Merge trung bình
1 ngày 7 giờ
Pull request đã merge (30 ngày)
18

Mô tả

### Subject of the issue

I started an archival node with a config like so:

```
{
"Archival": true,
"ColdDataDir": "/var/lib/algorand-cold",
"HotDataDir": "/var/lib/algorand",
}
```

After adding `EndpointAddress` to the config and restarting, the node errors out trying to move the state proof DB from cold to hot:

`couldn't initialize the node: error moving stateproof DB files from ColdDataDir /var/lib/algorand-cold/mainnet-v1.0 to HotDataDir /var/lib/algorand/mainnet-v1.0: destination file /var/lib/algorand/mainnet-v1.0/stateproof.sqlite already exists, not overwriting`

### Your environment

algod v5.0.1 stable
Ubuntu 26.04.1 x86_64

### Steps to reproduce

1. Set `HotDataDir` and `ColdDataDir` to different directories. Leave `StateproofDir` and `CrashDBDir` unset.
2. Start algod. It starts, and creates `stateproof.sqlite` and `crash.sqlite` in the hot genesis dir.
3. Stop algod.
4. Start algod again. It exits with the error above.

### Expected behaviour

Node starts

### Actual behaviour

Node does not start

### Logs

Logs
```
{"Context":"Agreement","Hash":"","ObjectPeriod":0,"ObjectRound":0,"ObjectStep":0,"Period":0,"Round":1716414,"Sender":"","Step":0,"Type":"RoundInterrupted","Weight":0,"WeightTotal":0,"file":"demux.go","function":"github.com/algorand/go-algorand/agreement.(*demux).next","level":"info","line":310,"msg":"agreement: round 1716414 ended early due to concurrent write; next round is 1716415","time":"2026-09-12T22:12:21.534829+02:00"}
{"Context":"Agreement","Hash":"","ObjectPeriod":0,"ObjectRound":0,"ObjectStep":0,"Period":0,"Round":1716415,"Sender":"","Step":0,"Type":"RoundInterrupted","Weight":0,"WeightTotal":0,"file":"demux.go","function":"github.com/algorand/go-algorand/agreement.(*demux).next","level":"info","line":310,"msg":"agreement: round 1716415 ended early due to concurrent write; next round is 1716416","time":"2026-09-12T22:12:21.538715+02:00"}
{"Context":"Agreement","Hash":"","ObjectPeriod":0,"ObjectRound":0,"ObjectStep":0,"Period":0,"Round":1716416,"Sender":"","Step":0,"Type":"RoundInterrupted","Weight":0,"WeightTotal":0,"file":"demux.go","function":"github.com/algorand/go-algorand/agreement.(*demux).next","level":"info","line":310,"msg":"agreement: round 1716416 ended early due to concurrent write; next round is 1716417","time":"2026-09-12T22:12:21.547048+02:00"}
{"Context":"Agreement","Hash":"","ObjectPeriod":0,"ObjectRound":0,"ObjectStep":0,"Period":0,"Round":1716417,"Sender":"","Step":0,"Type":"RoundInterrupted","Weight":0,"WeightTotal":0,"file":"demux.go","function":"github.com/algorand/go-algorand/agreement.(*demux).next","level":"info","line":310,"msg":"agreement: round 1716417 ended early due to concurrent write; next round is 1716418","time":"2026-09-12T22:12:21.552645+02:00"}
{"instanceName":"","level":"info","msg":"/ApplicationState/Shutdown","session":"","time":"2026-09-12T22:12:21.553653+02:00","v":"5.0.1"}
{"Context":"sync","file":"service.go","function":"github.com/algorand/go-algorand/catchup.(*Service).fetchAndWrite","level":"info","line":384,"msg":"fetchAndWrite(1716426): Aborted while waiting for lookback block to ledger","name":"","time":"2026-09-12T22:12:21.564064+02:00"}
{"Context":"sync","file":"service.go","function":"github.com/algorand/go-algorand/catchup.(*Service).fetchAndWrite","level":"info","line":384,"msg":"fetchAndWrite(1716428): Aborted while waiting for lookback block to ledger","name":"","time":"2026-09-12T22:12:21.564149+02:00"}
{"Context":"sync","file":"service.go","function":"github.com/algorand/go-algorand/catchup.(*Service).fetchAndWrite","level":"info","line":384,"msg":"fetchAndWrite(1716427): Aborted while waiting for lookback block to ledger","name":"","time":"2026-09-12T22:12:21.564553+02:00"}
{"Context":"sync","file":"service.go","function":"github.com/algorand/go-algorand/catchup.(*Service).fetchAndWrite","level":"info","line":384,"msg":"fetchAndWrite(1716432): Aborted while waiting for lookback block to ledger","name":"","time":"2026-09-12T22:12:21.564623+02:00"}
{"Context":"sync","file":"service.go","function":"github.com/algorand/go-algorand/catchup.(*Service).fetchAndWrite","level":"info","line":384,"msg":"fetchAndWrite(1716433): Aborted while waiting for lookback block to ledger","name":"","time":"2026-09-12T22:12:21.564633+02:00"}
{"Context":"sync","file":"service.go","function":"github.com/algorand/go-algorand/catchup.(*Service).fetchAndWrite","level":"info","line":384,"msg":"fetchAndWrite(1716434): Aborted while waiting for lookback block to ledger","name":"","time":"2026-09-12T22:12:21.565324+02:00"}
{"Context":"sync","details":{"StartRound":0,"EndRound":1716419,"Time":8506201680955,"InitSync":true},"file":"telemetry.go","function":"github.com/algorand/go-algorand/logging.(*telemetryState).logTelemetry","instanceName":"","level":"info","line":230,"msg":"/ApplicationState/CatchupStop","name":"","session":"","time":"2026-09-12T22:12:21.567284+02:00","v":"5.0.1"}
{"Context":"sync","file":"service.go","function":"github.com/algorand/go-algorand/catchup.(*Service).sync","level":"info","line":779,"msg":"Catchup Service: finished catching up, now at round 1716419 (previously 0). Total time catching up 2h21m46.201680955s (exit: catchup service stopping: context canceled).","name":"","time":"2026-09-12T22:12:21.567433+02:00"}
{"file":"server.go","function":"github.com/algorand/go-algorand/daemon/algod.(*Server).Initialize","level":"info","line":225,"msg":"++++++++++++++++++++++++++++++++++++++++","time":"2026-09-12T22:12:34.852714+02:00"}
{"file":"server.go","function":"github.com/algorand/go-algorand/daemon/algod.(*Server).Initialize","level":"info","line":226,"msg":"Logging Starting","time":"2026-09-12T22:12:34.852846+02:00"}
{"file":"server.go","function":"github.com/algorand/go-algorand/daemon/algod.(*Server).Initialize","level":"info","line":233,"msg":"Telemetry Disabled","time":"2026-09-12T22:12:34.852875+02:00"}
{"file":"server.go","function":"github.com/algorand/go-algorand/daemon/algod.(*Server).Initialize","level":"info","line":235,"msg":"++++++++++++++++++++++++++++++++++++++++","time":"2026-09-12T22:12:34.852903+02:00"}
{"file":"main.go","function":"main.run","level":"error","line":381,"msg":"[Stack] goroutine 1 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:26 +0x5e\ngithub.com/algorand/go-algorand/logging.logger.Error({0xc0005460e0?, 0xc000088058?}, {0xc0005cac50, 0x1, 0x1})\n\tgithub.com/algorand/go-algorand/logging/log.go:225 +0x4f\nmain.run()\n\tgithub.com/algorand/go-algorand/cmd/algod/main.go:381 +0x26f7\nmain.main()\n\tgithub.com/algorand/go-algorand/cmd/algod/main.go:71 +0x52\n","time":"2026-09-12T22:12:34.853582+02:00"}
{"file":"main.go","function":"main.run","level":"error","line":381,"msg":"couldn't initialize the node: error moving stateproof DB files from ColdDataDir /var/lib/algorand-cold/mainnet-v1.0 to HotDataDir /var/lib/algorand/mainnet-v1.0: destination file /var/lib/algorand/mainnet-v1.0/stateproof.sqlite already exists, not overwriting","time":"2026-09-12T22:12:34.853726+02:00"}
```

### Workaround

Explicitly defining stateproof dir in config bypasses the issue:

```
{
"Archival": true,
"ColdDataDir": "/var/lib/algorand-cold",
"HotDataDir": "/var/lib/algorand",
"StateproofDir": "/var/lib/algorand",
"CrashDBDir": "/var/lib/algorand",
}
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start at cmd/algod/main.go, where initialization reports the stateproof DB move failure, and trace how unset StateproofDir and CrashDBDir are resolved when HotDataDir and ColdDataDir differ. Reproduce the two-start sequence with the issue's configuration, then verify that a restart succeeds without explicit directory overrides.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
go, sqlite
Lĩnh vực
backend, databases
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
68/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.