@@ -21,8 +21,15 @@ import (
2121const (
2222 // cpListsTimeout is the timeout for fetching checkpoints from all nodes.
2323 cpListsTimeout = 30 * time .Second
24- // cpRestoreTimeout is the timeout for restoring a checkpoint chunk from the remote peer.
25- cpRestoreTimeout = 60 * time .Second
24+
25+ // cpRestoreChunkTimeout is the timeout for restoring a checkpoint chunk from the remote peer.
26+ cpRestoreChunkTimeout = 60 * time .Second
27+
28+ // cpRestoreTimeout is the timeout for restoring the whole checkpoint from the remote peers.
29+ //
30+ // As of now it takes ~10-30 min to restore the state from the checkpoint, however the timeout
31+ // should be significantly higher to account for the growing state.
32+ cpRestoreTimeout = 12 * time .Hour
2633
2734 checkpointStatusDone = 0
2835 checkpointStatusNext = 1
@@ -99,7 +106,7 @@ func (w *Worker) checkpointChunkFetcher(
99106 }
100107 }
101108
102- chunkCtx , cancel := context .WithTimeout (ctx , cpRestoreTimeout )
109+ chunkCtx , cancel := context .WithTimeout (ctx , cpRestoreChunkTimeout )
103110 defer cancel ()
104111
105112 // Fetch chunk from peers.
@@ -195,6 +202,7 @@ func (w *Worker) fetchChunk(ctx context.Context, chunk *chunk) ([]byte, rpc.Peer
195202}
196203
197204func (w * Worker ) handleCheckpoint (ctx context.Context , check * checkpointsync.Checkpoint , maxParallelRequests uint ) (cpStatus int , rerr error ) {
205+ ctx , _ = context .WithTimeout (ctx , cpRestoreTimeout )
198206 if err := w .localStorage .Checkpointer ().StartRestore (ctx , check .Metadata ); err != nil {
199207 // Any previous restores were already aborted by the driver up the call stack, so
200208 // things should have been going smoothly here; bail.
0 commit comments