Don’t use readonly transactions for mysql
This commit is contained in:
parent
5c18ee20a7
commit
bb8c623f88
1 changed files with 1 additions and 7 deletions
|
@ -31,7 +31,7 @@ type DB struct {
|
|||
|
||||
func (db *DB) Begin(ctx context.Context, writable bool) (txn kvs.TX, err error) {
|
||||
var pntr *sql.Tx
|
||||
if pntr, err = db.pntr.BeginTx(ctx, db.opt(writable)); err != nil {
|
||||
if pntr, err = db.pntr.BeginTx(ctx, &sql.TxOptions{}); err != nil {
|
||||
log.WithPrefix("kvs").Errorln(err)
|
||||
err = &kvs.DBError{Err: err}
|
||||
return
|
||||
|
@ -50,9 +50,3 @@ func (db *DB) Export(w io.Writer) (err error) {
|
|||
func (db *DB) Close() (err error) {
|
||||
return db.pntr.Close()
|
||||
}
|
||||
|
||||
func (db *DB) opt(writable bool) *sql.TxOptions {
|
||||
return &sql.TxOptions{
|
||||
ReadOnly: !writable,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue