Fix chown Input/output error on large file sets (#7996)
* Fix chown Input/output error on large file sets (Fixes #7911) Implemented retry logic for MySQL/MariaDB backend to handle transient errors like deadlocks and timeouts. * Fix syntax error: missing closing brace * Refactor: Use %w for error wrapping and errors.As for extraction * Fix: Disable retry logic inside transactions
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
@@ -67,6 +68,19 @@ func (store *MysqlStore) initialize(dsn string, upsertQuery string, enableUpsert
|
||||
UpsertQueryTemplate: upsertQuery,
|
||||
}
|
||||
|
||||
store.RetryableErrorCallback = func(err error) bool {
|
||||
var mysqlError *mysql.MySQLError
|
||||
if errors.As(err, &mysqlError) {
|
||||
if mysqlError.Number == 1213 { // ER_LOCK_DEADLOCK
|
||||
return true
|
||||
}
|
||||
if mysqlError.Number == 1205 { // ER_LOCK_WAIT_TIMEOUT
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
if enableTls {
|
||||
rootCertPool := x509.NewCertPool()
|
||||
pem, err := os.ReadFile(caCrtDir)
|
||||
|
||||
Reference in New Issue
Block a user