Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP #20124

Closed
wants to merge 1 commit into from
Closed

WIP #20124

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion cmd/influxd/upgrade/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package upgrade
import (
"context"
"fmt"
"github.com/dustin/go-humanize"
"os"
"path/filepath"
"strings"

"github.com/dustin/go-humanize"
"github.com/influxdata/influxdb/v2"
"github.com/influxdata/influxdb/v2/pkg/fs"
"github.com/influxdata/influxdb/v2/v1/services/meta"
Expand Down Expand Up @@ -105,6 +105,22 @@ func upgradeDatabases(ctx context.Context, v1 *influxDBv1, v2 *influxDBv2, v1opt

}

// we had a problem were in some cases bucket.ID wasn't being set by CreateBucket, this is to deal with that edge case
if bucket.ID == 0 {
// We have to look up the ID because `bucket` doesn't have the ID
//clone the objects, before we take the pointers
name := bucket.Name
orgID := orgID
newbucket, err := v2.bucketSvc.FindBucket(ctx, influxdb.BucketFilter{
Name: &name,
OrganizationID: &orgID,
})
if err != nil {
return nil, fmt.Errorf("unable to find bucket: %s: %w", bucket.Name, err)
}
bucket.ID = newbucket.ID
}

db2BucketIds[db.Name] = append(db2BucketIds[db.Name], bucket.ID)
if options.verbose {
log.Info("Creating database with retention policy",
Expand Down