Handling MySQL Read‑Only Errors During Master‑Slave Switch in Go: Extending the Driver and Using rejectReadOnly
When a MySQL master‑slave switch makes the old master read-only, Go connection pools keep reusing stale connections and cause prolonged write errors, but by extending the driver to return driver.ErrBadConn on error 1290 or using the DSN flag rejectReadOnly=true, the bad connections are discarded and the error disappears almost instantly.