Skip to content

Commit 6d49eb5

Browse files
author
Jeffrey Charles
committed
Add Aurora errno to rejectReadOnly check
AWS Aurora returns a 1290 after failing over requiring the connection to be closed and opened again to be able to perform writes.
1 parent bf7f34f commit 6d49eb5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packets.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,8 @@ func (mc *mysqlConn) handleErrorPacket(data []byte) error {
563563
errno := binary.LittleEndian.Uint16(data[1:3])
564564

565565
// 1792: ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
566-
if errno == 1792 && mc.cfg.RejectReadOnly {
566+
// 1290: ER_OPTION_PREVENTS_STATEMENT (returned by Aurora during failover)
567+
if (errno == 1792 || errno == 1290) && mc.cfg.RejectReadOnly {
567568
// Oops; we are connected to a read-only connection, and won't be able
568569
// to issue any write statements. Since RejectReadOnly is configured,
569570
// we throw away this connection hoping this one would have write

0 commit comments

Comments
 (0)