mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-19 11:45:12 +00:00
fix: connection handling in setup after migration steps 40, 64 and 70 (#12293)
# Which Problems Are Solved During the setup step we saw rare cases which caused setup to fail after executing steps 40, 64 and 70. # How the Problems Are Solved Close currently open database connections so that they fetch the correct type mapping for the `eventstore.command2` database type. # Additional Changes Ensure correct order of setup steps 64 and 70. # Additional Context None --------- Co-authored-by: Livio Spring <[email protected]>
This commit is contained in:
@@ -52,6 +52,12 @@ func (mig *InitPushFunc) Execute(ctx context.Context, _ eventstore.Event) (err e
|
||||
return fmt.Errorf("%s %s: %w", mig.String(), stmt.file, err)
|
||||
}
|
||||
}
|
||||
// close idle connections to prevent them from using the old prepared statement with the wrong type
|
||||
// and having wrong plan of `eventstore.command2`-type
|
||||
for _, conn := range mig.dbClient.Pool.AcquireAllIdle(ctx) {
|
||||
logging.OnError(ctx, conn.Conn().Close(ctx)).Debug("failed to close idle connection")
|
||||
conn.Release()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user