File tree Expand file tree Collapse file tree 24 files changed +61
-64
lines changed Expand file tree Collapse file tree 24 files changed +61
-64
lines changed Original file line number Diff line number Diff line change @@ -7,10 +7,9 @@ import (
77 nurl "net/url"
88 "strconv"
99 "strings"
10+ "sync/atomic"
1011 "time"
1112
12- "go.uber.org/atomic"
13-
1413 "github.com/gocql/gocql"
1514 "github.com/golang-migrate/migrate/v4/database"
1615 "github.com/golang-migrate/migrate/v4/database/multistmt"
@@ -199,14 +198,14 @@ func (c *Cassandra) Close() error {
199198}
200199
201200func (c * Cassandra ) Lock () error {
202- if ! c .isLocked .CAS (false , true ) {
201+ if ! c .isLocked .CompareAndSwap (false , true ) {
203202 return database .ErrLocked
204203 }
205204 return nil
206205}
207206
208207func (c * Cassandra ) Unlock () error {
209- if ! c .isLocked .CAS (true , false ) {
208+ if ! c .isLocked .CompareAndSwap (true , false ) {
210209 return database .ErrNotLocked
211210 }
212211 return nil
Original file line number Diff line number Diff line change 99 "strings"
1010 "time"
1111
12- "go.uber.org /atomic"
12+ "sync /atomic"
1313
1414 "github.com/golang-migrate/migrate/v4"
1515 "github.com/golang-migrate/migrate/v4/database"
@@ -291,14 +291,14 @@ func (ch *ClickHouse) Drop() (err error) {
291291}
292292
293293func (ch * ClickHouse ) Lock () error {
294- if ! ch .isLocked .CAS (false , true ) {
294+ if ! ch .isLocked .CompareAndSwap (false , true ) {
295295 return database .ErrLocked
296296 }
297297
298298 return nil
299299}
300300func (ch * ClickHouse ) Unlock () error {
301- if ! ch .isLocked .CAS (true , false ) {
301+ if ! ch .isLocked .CompareAndSwap (true , false ) {
302302 return database .ErrNotLocked
303303 }
304304
Original file line number Diff line number Diff line change @@ -9,12 +9,13 @@ import (
99 "regexp"
1010 "strconv"
1111
12+ "sync/atomic"
13+
1214 "github.com/cockroachdb/cockroach-go/v2/crdb"
1315 "github.com/golang-migrate/migrate/v4"
1416 "github.com/golang-migrate/migrate/v4/database"
1517 "github.com/hashicorp/go-multierror"
1618 "github.com/lib/pq"
17- "go.uber.org/atomic"
1819)
1920
2021func init () {
Original file line number Diff line number Diff line change @@ -9,11 +9,12 @@ import (
99 "io"
1010 nurl "net/url"
1111
12+ "sync/atomic"
13+
1214 "github.com/golang-migrate/migrate/v4"
1315 "github.com/golang-migrate/migrate/v4/database"
1416 "github.com/hashicorp/go-multierror"
1517 _ "github.com/nakagami/firebirdsql"
16- "go.uber.org/atomic"
1718)
1819
1920func init () {
@@ -107,14 +108,14 @@ func (f *Firebird) Close() error {
107108}
108109
109110func (f * Firebird ) Lock () error {
110- if ! f .isLocked .CAS (false , true ) {
111+ if ! f .isLocked .CompareAndSwap (false , true ) {
111112 return database .ErrLocked
112113 }
113114 return nil
114115}
115116
116117func (f * Firebird ) Unlock () error {
117- if ! f .isLocked .CAS (true , false ) {
118+ if ! f .isLocked .CompareAndSwap (true , false ) {
118119 return database .ErrNotLocked
119120 }
120121 return nil
Original file line number Diff line number Diff line change @@ -9,14 +9,15 @@ import (
99 "strconv"
1010 "time"
1111
12+ "sync/atomic"
13+
1214 "github.com/cenkalti/backoff/v4"
1315 "github.com/golang-migrate/migrate/v4/database"
1416 "github.com/hashicorp/go-multierror"
1517 "go.mongodb.org/mongo-driver/bson"
1618 "go.mongodb.org/mongo-driver/mongo"
1719 "go.mongodb.org/mongo-driver/mongo/options"
1820 "go.mongodb.org/mongo-driver/x/mongo/driver/connstring"
19- "go.uber.org/atomic"
2021)
2122
2223func init () {
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ import (
1515 "strings"
1616 "time"
1717
18- "go.uber.org /atomic"
18+ "sync /atomic"
1919
2020 "github.com/go-sql-driver/mysql"
2121 "github.com/golang-migrate/migrate/v4/database"
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import (
1313 "strings"
1414 "time"
1515
16- "go.uber.org /atomic"
16+ "sync /atomic"
1717
1818 "github.com/golang-migrate/migrate/v4"
1919 "github.com/golang-migrate/migrate/v4/database"
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import (
1313 "strings"
1414 "time"
1515
16- "go.uber.org /atomic"
16+ "sync /atomic"
1717
1818 "github.com/golang-migrate/migrate/v4"
1919 "github.com/golang-migrate/migrate/v4/database"
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import (
1313 "strings"
1414 "time"
1515
16- "go.uber.org /atomic"
16+ "sync /atomic"
1717
1818 "github.com/golang-migrate/migrate/v4"
1919 "github.com/golang-migrate/migrate/v4/database"
Original file line number Diff line number Diff line change 77 nurl "net/url"
88 "strings"
99
10+ "sync/atomic"
11+
1012 "github.com/hashicorp/go-multierror"
11- "go.uber.org/atomic"
1213
1314 "github.com/golang-migrate/migrate/v4"
1415 "github.com/golang-migrate/migrate/v4/database"
@@ -166,13 +167,13 @@ func (m *Ql) Drop() (err error) {
166167 return nil
167168}
168169func (m * Ql ) Lock () error {
169- if ! m .isLocked .CAS (false , true ) {
170+ if ! m .isLocked .CompareAndSwap (false , true ) {
170171 return database .ErrLocked
171172 }
172173 return nil
173174}
174175func (m * Ql ) Unlock () error {
175- if ! m .isLocked .CAS (true , false ) {
176+ if ! m .isLocked .CompareAndSwap (true , false ) {
176177 return database .ErrNotLocked
177178 }
178179 return nil
You can’t perform that action at this time.
0 commit comments