Revert "retry on serialization errors"

This commit is contained in:
Stephan Renatus
2018-11-29 08:24:13 +01:00
committed by GitHub
parent f3acec0b1b
commit 8f3cca7ba4
20 changed files with 463 additions and 1355 deletions

29
vendor/github.com/lib/pq/copy.go generated vendored
View File

@@ -13,7 +13,6 @@ var (
errBinaryCopyNotSupported = errors.New("pq: only text format supported for COPY")
errCopyToNotSupported = errors.New("pq: COPY TO is not supported")
errCopyNotSupportedOutsideTxn = errors.New("pq: COPY is only allowed inside a transaction")
errCopyInProgress = errors.New("pq: COPY in progress")
)
// CopyIn creates a COPY FROM statement which can be prepared with
@@ -97,13 +96,13 @@ awaitCopyInResponse:
err = parseError(r)
case 'Z':
if err == nil {
ci.setBad()
cn.bad = true
errorf("unexpected ReadyForQuery in response to COPY")
}
cn.processReadyForQuery(r)
return nil, err
default:
ci.setBad()
cn.bad = true
errorf("unknown response for copy query: %q", t)
}
}
@@ -122,7 +121,7 @@ awaitCopyInResponse:
cn.processReadyForQuery(r)
return nil, err
default:
ci.setBad()
cn.bad = true
errorf("unknown response for CopyFail: %q", t)
}
}
@@ -143,7 +142,7 @@ func (ci *copyin) resploop() {
var r readBuf
t, err := ci.cn.recvMessage(&r)
if err != nil {
ci.setBad()
ci.cn.bad = true
ci.setError(err)
ci.done <- true
return
@@ -161,7 +160,7 @@ func (ci *copyin) resploop() {
err := parseError(&r)
ci.setError(err)
default:
ci.setBad()
ci.cn.bad = true
ci.setError(fmt.Errorf("unknown response during CopyIn: %q", t))
ci.done <- true
return
@@ -169,19 +168,6 @@ func (ci *copyin) resploop() {
}
}
func (ci *copyin) setBad() {
ci.Lock()
ci.cn.bad = true
ci.Unlock()
}
func (ci *copyin) isBad() bool {
ci.Lock()
b := ci.cn.bad
ci.Unlock()
return b
}
func (ci *copyin) isErrorSet() bool {
ci.Lock()
isSet := (ci.err != nil)
@@ -219,7 +205,7 @@ func (ci *copyin) Exec(v []driver.Value) (r driver.Result, err error) {
return nil, errCopyInClosed
}
if ci.isBad() {
if ci.cn.bad {
return nil, driver.ErrBadConn
}
defer ci.cn.errRecover(&err)
@@ -257,7 +243,7 @@ func (ci *copyin) Close() (err error) {
}
ci.closed = true
if ci.isBad() {
if ci.cn.bad {
return driver.ErrBadConn
}
defer ci.cn.errRecover(&err)
@@ -272,7 +258,6 @@ func (ci *copyin) Close() (err error) {
}
<-ci.done
ci.cn.inCopy = false
if ci.isErrorSet() {
err = ci.err