replication/driver: regulate per-filesystem step planning through stepQueue

before this patch, we'd have unbounded parallelism for ListFilesystemVersions RPCs
This commit is contained in:
Christian Schwarz 2020-01-02 14:29:02 +01:00
parent e35320f8ee
commit f8200a6386

View File

@ -371,9 +371,21 @@ func (a *attempt) do(ctx context.Context, prev *attempt) {
}
func (fs *fs) do(ctx context.Context, pq *stepQueue, prev *fs) {
psteps, err := fs.fs.PlanFS(ctx)
errTime := time.Now()
defer fs.l.Lock().Unlock()
// get planned steps from replication logic
var psteps []Step
var errTime time.Time
var err error
fs.l.DropWhile(func() {
// TODO hacky
// choose target time that is earlier than any snapshot, so fs planning is always prioritized
targetDate := time.Unix(0, 0)
defer pq.WaitReady(fs, targetDate)()
psteps, err = fs.fs.PlanFS(ctx) // no shadow
errTime = time.Now() // no shadow
})
debug := debugPrefix("fs=%s", fs.fs.ReportInfo().Name)
fs.planning.done = true
if err != nil {