Report bootstrap batch progress · Entire

Report bootstrap batch progress

1a25922→main·

Sessions

4adfd6c1e723View transcript

Changes

2

456 unmodified lines

457
458
459
460
461
462
463
464
465
466
467
468
80 unmodified lines

549
550
551
552
553
554
555
556
557
558
559
560

456 unmodified lines

if result.BatchCount < 2 {
                    
t.Fatalf("expected multiple bootstrap batches, got %+v", result)
    }
    if result.PlannedBatchCount != result.BatchCount {
                    
t.Fatalf("expected fresh batched bootstrap to complete all planned batches, got %+v", result)
    }
    if len(result.TempRefs) != 1 || result.TempRefs[0] != bootstrapTempRef(plumbing.NewBranchReferenceName(testBranch)).String() {
                    
t.Fatalf("unexpected temp refs in batched bootstrap result: %+v", result)
    }

assertGitRefEqual(t, sourceBare, targetBare, plumbing.NewBranchReferenceName(testBranch))
    assertGitRefAbsent(t, targetBare, bootstrapTempRef(plumbing.NewBranchReferenceName(testBranch)))
80 unmodified lines

if result.BatchCount >= len(checkpoints) {
                    
t.Fatalf("expected resume to execute fewer batches than full run, got %+v checkpoints=%d", result, len(checkpoints))
    }
    if result.PlannedBatchCount != len(checkpoints) {
                    
t.Fatalf("expected resume result to report planned checkpoint count, got %+v checkpoints=%d", result, len(checkpoints))
    }
    if len(result.TempRefs) != 1 || result.TempRefs[0] != tempRef.String() {
                    
t.Fatalf("unexpected temp refs in batched resume result: %+v", result)
    }

assertGitRefEqual(t, sourceBare, targetBare, plumbing.NewBranchReferenceName(testBranch))
    assertGitRefAbsent(t, targetBare, tempRef)

Minternal/syncer/git_http_backend_test.go+12

105 unmodified lines

106
107
108
109
110
111
112
113
129 unmodified lines

243
244
245
244
245
246
247
248
249
250
24 unmodified lines

275
276
277
278
279
280
281
282
283
284
654 unmodified lines

939
940
941
942
943
944
945
946

105 unmodified lines

RelayReason string    `json:"relay_reason"`
    Batching bool         `json:"batching"`
    BatchCount int        `json:"batch_count"`
    PlannedBatchCount int `json:"planned_batch_count"`
    TempRefs []string     `json:"temp_refs"`
    BootstrapSuggested bool `json:"bootstrap_suggested"`
    Stats    Stats        `json:"stats"`
    Measurement Measurement `json:"measurement"`
129 unmodified lines

}

summary := fmt.Sprintf(
        "summary: pushed=%d deleted=%d skipped=%d blocked=%d protocol=%s relay=%t relay-mode=%s relay-reason=%s batching=%t batch-count=%d",
        r.Pushed, r.Deleted, r.Skipped, r.Blocked, r.Protocol, r.Relay, r.RelayMode, r.RelayReason, r.Batching, r.BatchCount,
        "summary: pushed=%d deleted=%d skipped=%d blocked=%d protocol=%s relay=%t relay-mode=%s relay-reason=%s batching=%t batch-count=%d planned-batches=%d",
        r.Pushed, r.Deleted, r.Skipped, r.Blocked, r.Protocol, r.Relay, r.RelayMode, r.RelayReason, r.Batching, r.BatchCount, r.PlannedBatchCount,
    )
    if r.DryRun {
        summary += " dry-run=true"
24 unmodified lines

lines = append(lines, "hint: target refs are absent; bootstrap can seed them without local object storage")
    }

if r.Batching && len(r.TempRefs) > 0 {
        lines = append(lines, fmt.Sprintf("batching: temp-refs=%s", strings.Join(r.TempRefs, ",")))
    }

return lines
}

654 unmodified lines

}

for _, batch := range batches {
        result.PlannedBatchCount += len(batch.Checkpoints)
        result.TempRefs = append(result.TempRefs, batch.TempRef.String())
        current := batch.ResumeHash
        startIdx, err := bootstrapResumeIndex(batch.Checkpoints, batch.ResumeHash)
        if err != nil {