cmd/tools/migrate-segment-copies: fix placement scan from DB
Placement can be null in DB and we need adjust scanning this column from DB. Additionally this change sets application name for DB connection. Change-Id: I3c7d6294f4a3e5e441160b2fd4aeafffe705ec76
This commit is contained in:
parent
6e4044b245
commit
d9525a0f27
@ -81,7 +81,9 @@ func main() {
|
||||
func Migrate(ctx context.Context, log *zap.Logger, config Config) (err error) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
|
||||
db, err := metabase.Open(ctx, log, config.MetabaseDB, metabase.Config{})
|
||||
db, err := metabase.Open(ctx, log, config.MetabaseDB, metabase.Config{
|
||||
ApplicationName: "migrate-segment-copies",
|
||||
})
|
||||
if err != nil {
|
||||
return errs.New("unable to connect %q: %w", config.MetabaseDB, err)
|
||||
}
|
||||
@ -164,7 +166,7 @@ func MigrateSegments(ctx context.Context, log *zap.Logger, metabaseDB *metabase.
|
||||
RemoteAliasPieces []byte
|
||||
RootPieceID []byte
|
||||
RepairedAt *time.Time
|
||||
Placement int64
|
||||
Placement *int64
|
||||
}
|
||||
|
||||
updates := []Update{}
|
||||
@ -176,7 +178,7 @@ func MigrateSegments(ctx context.Context, log *zap.Logger, metabaseDB *metabase.
|
||||
var position int64
|
||||
var remoteAliasPieces, rootPieceID []byte
|
||||
var repairedAt *time.Time
|
||||
var placement int64
|
||||
var placement *int64
|
||||
err := rows.Scan(&ancestorStreamID, &position, &remoteAliasPieces, &rootPieceID, &repairedAt, &placement)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user