Skip to content

Commit

Permalink
PR nits
Browse files Browse the repository at this point in the history
  • Loading branch information
nbroyles committed Sep 3, 2020
1 parent 2436ac8 commit 8b9a5b1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ require (
github.com/stretchr/testify v1.6.1
github.com/subosito/gotenv v1.2.1-0.20190917103637-de67a6614a4d // indirect
github.com/twotwotwo/sorts v0.0.0-20160814051341-bf5c1f2b8553
github.com/uber-go/atomic v0.0.0-00010101000000-000000000000
github.com/uber-go/atomic v0.0.0-00010101000000-000000000000 // indirect
github.com/uber-go/tally v3.3.13+incompatible
github.com/uber/jaeger-client-go v2.25.0+incompatible
github.com/uber/jaeger-lib v2.2.0+incompatible
Expand Down
13 changes: 10 additions & 3 deletions src/dbnode/storage/bootstrap/bootstrapper/fs/migrator/migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ func (m *Migrator) Run(ctx context.Context) error {

// Start up workers.
var (
wg = &sync.WaitGroup{}
wg sync.WaitGroup
candidatesPerWorker = len(candidates) / numWorkers
candidateIdx = 0

completedMigrationsLock = &sync.Mutex{}
completedMigrationsLock sync.Mutex
completedMigrations = make([]completedMigration, 0, len(candidates))
)
for i, worker := range workers {
Expand Down Expand Up @@ -178,7 +178,14 @@ func (m *Migrator) Run(ctx context.Context) error {
}

func (m *Migrator) findMigrationCandidates() []migrationCandidate {
var candidates []migrationCandidate
maxCapacity := 0
for _, resultsByShard := range m.infoFilesByNamespace {
for _, results := range resultsByShard {
maxCapacity += len(results)
}
}

candidates := make([]migrationCandidate, 0, maxCapacity)
for md, resultsByShard := range m.infoFilesByNamespace {
for shard, results := range resultsByShard {
for _, info := range results {
Expand Down

0 comments on commit 8b9a5b1

Please sign in to comment.