Skip to content

Add aurora errno to rejectReadOnly check #634

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

Merged

Conversation

jeffcharles
Copy link
Contributor

@jeffcharles jeffcharles commented Jul 6, 2017

Description

Include errno 1290 in rejectReadOnly check. Aurora returns this because the database is running with the --read-only option.

Checklist

  • Code compiles correctly
  • Created tests which fail without the change (if possible)
  • All tests passing
  • Extended the README / documentation, if necessary
  • Added myself / the copyright holder to the AUTHORS file

(Not sure how to add a test for this easily w/o running another MySQL instance with a TCP reverse proxy, and even then it wouldn't necessarily reflect how Aurora runs in practice in the future)

@methane
Copy link
Member

methane commented Jul 8, 2017

1290 error can be used for other purpose.
In other words, there is danger about retrying.

err := db.Exec(`UPDATE version SET version=version+1;
LOAD DATA INFILE "/tmp/data.csv" INTO TABLE data;`)
// ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

If such query is retried, version number is incremented multiple times.
But I understand your requirement and RejectReadOnly option is for it. So I approve OK this change.

Please add note to RejectReadOnly option like:

NOTE: ERROR 1290 will be returned for `read-only` server and this option cause retry for the error.
But same error number is used for some other cases.  You should ensure your application
never cause ERROR 1290 except `read-only` mode.

@bryanpaluch
Copy link

Any movement on this?

@julienschmidt
Copy link
Member

Seems like our CI somehow hangs.
The easiest workaround would probably if you rebase on the current master or merge the current master to trigger another build.

@julienschmidt julienschmidt added this to the v1.4 milestone Oct 17, 2017
AWS Aurora returns a 1290 after failing over requiring the connection to
be closed and opened again to be able to perform writes.
@jeffcharles
Copy link
Contributor Author

Squashed and rebased on top of master

@jeffcharles jeffcharles force-pushed the add-aurora-errno-to-reject branch from 0963109 to 059c177 Compare October 17, 2017 15:54
Copy link
Member

@julienschmidt julienschmidt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks a lot!

@julienschmidt julienschmidt merged commit e52f190 into go-sql-driver:master Oct 17, 2017
bLamarche413 pushed a commit to bLamarche413/mysql that referenced this pull request Mar 23, 2018
AWS Aurora returns a 1290 after failing over requiring the connection to
be closed and opened again to be able to perform writes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants