File tree Expand file tree Collapse file tree 24 files changed +56
-77
lines changed Expand file tree Collapse file tree 24 files changed +56
-77
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 @@ -7,10 +7,9 @@ import (
77	"net/url" 
88	"strconv" 
99	"strings" 
10+ 	"sync/atomic" 
1011	"time" 
1112
12- 	"go.uber.org/atomic" 
13- 
1413	"github.com/golang-migrate/migrate/v4" 
1514	"github.com/golang-migrate/migrate/v4/database" 
1615	"github.com/golang-migrate/migrate/v4/database/multistmt" 
@@ -291,14 +290,14 @@ func (ch *ClickHouse) Drop() (err error) {
291290}
292291
293292func  (ch  * ClickHouse ) Lock () error  {
294- 	if  ! ch .isLocked .CAS (false , true ) {
293+ 	if  ! ch .isLocked .CompareAndSwap (false , true ) {
295294		return  database .ErrLocked 
296295	}
297296
298297	return  nil 
299298}
300299func  (ch  * ClickHouse ) Unlock () error  {
301- 	if  ! ch .isLocked .CAS (true , false ) {
300+ 	if  ! ch .isLocked .CompareAndSwap (true , false ) {
302301		return  database .ErrNotLocked 
303302	}
304303
Original file line number Diff line number Diff line change @@ -8,13 +8,13 @@ import (
88	nurl "net/url" 
99	"regexp" 
1010	"strconv" 
11+ 	"sync/atomic" 
1112
1213	"github.com/cockroachdb/cockroach-go/v2/crdb" 
1314	"github.com/golang-migrate/migrate/v4" 
1415	"github.com/golang-migrate/migrate/v4/database" 
1516	"github.com/hashicorp/go-multierror" 
1617	"github.com/lib/pq" 
17- 	"go.uber.org/atomic" 
1818)
1919
2020func  init () {
Original file line number Diff line number Diff line change @@ -8,12 +8,12 @@ import (
88	"fmt" 
99	"io" 
1010	nurl "net/url" 
11+ 	"sync/atomic" 
1112
1213	"github.com/golang-migrate/migrate/v4" 
1314	"github.com/golang-migrate/migrate/v4/database" 
1415	"github.com/hashicorp/go-multierror" 
1516	_ "github.com/nakagami/firebirdsql" 
16- 	"go.uber.org/atomic" 
1717)
1818
1919func  init () {
@@ -107,14 +107,14 @@ func (f *Firebird) Close() error {
107107}
108108
109109func  (f  * Firebird ) Lock () error  {
110- 	if  ! f .isLocked .CAS (false , true ) {
110+ 	if  ! f .isLocked .CompareAndSwap (false , true ) {
111111		return  database .ErrLocked 
112112	}
113113	return  nil 
114114}
115115
116116func  (f  * Firebird ) Unlock () error  {
117- 	if  ! f .isLocked .CAS (true , false ) {
117+ 	if  ! f .isLocked .CompareAndSwap (true , false ) {
118118		return  database .ErrNotLocked 
119119	}
120120	return  nil 
Original file line number Diff line number Diff line change 77	"net/url" 
88	"os" 
99	"strconv" 
10+ 	"sync/atomic" 
1011	"time" 
1112
1213	"github.com/cenkalti/backoff/v4" 
@@ -16,7 +17,6 @@ import (
1617	"go.mongodb.org/mongo-driver/mongo" 
1718	"go.mongodb.org/mongo-driver/mongo/options" 
1819	"go.mongodb.org/mongo-driver/x/mongo/driver/connstring" 
19- 	"go.uber.org/atomic" 
2020)
2121
2222func  init () {
Original file line number Diff line number Diff line change @@ -13,10 +13,9 @@ import (
1313	"os" 
1414	"strconv" 
1515	"strings" 
16+ 	"sync/atomic" 
1617	"time" 
1718
18- 	"go.uber.org/atomic" 
19- 
2019	"github.com/go-sql-driver/mysql" 
2120	"github.com/golang-migrate/migrate/v4/database" 
2221	"github.com/hashicorp/go-multierror" 
Original file line number Diff line number Diff line change @@ -11,10 +11,9 @@ import (
1111	"regexp" 
1212	"strconv" 
1313	"strings" 
14+ 	"sync/atomic" 
1415	"time" 
1516
16- 	"go.uber.org/atomic" 
17- 
1817	"github.com/golang-migrate/migrate/v4" 
1918	"github.com/golang-migrate/migrate/v4/database" 
2019	"github.com/golang-migrate/migrate/v4/database/multistmt" 
Original file line number Diff line number Diff line change @@ -11,10 +11,9 @@ import (
1111	"regexp" 
1212	"strconv" 
1313	"strings" 
14+ 	"sync/atomic" 
1415	"time" 
1516
16- 	"go.uber.org/atomic" 
17- 
1817	"github.com/golang-migrate/migrate/v4" 
1918	"github.com/golang-migrate/migrate/v4/database" 
2019	"github.com/golang-migrate/migrate/v4/database/multistmt" 
Original file line number Diff line number Diff line change @@ -11,10 +11,9 @@ import (
1111	"regexp" 
1212	"strconv" 
1313	"strings" 
14+ 	"sync/atomic" 
1415	"time" 
1516
16- 	"go.uber.org/atomic" 
17- 
1817	"github.com/golang-migrate/migrate/v4" 
1918	"github.com/golang-migrate/migrate/v4/database" 
2019	"github.com/golang-migrate/migrate/v4/database/multistmt" 
Original file line number Diff line number Diff line change 66	"io" 
77	nurl "net/url" 
88	"strings" 
9+ 	"sync/atomic" 
910
1011	"github.com/hashicorp/go-multierror" 
11- 	"go.uber.org/atomic" 
1212
1313	"github.com/golang-migrate/migrate/v4" 
1414	"github.com/golang-migrate/migrate/v4/database" 
@@ -166,13 +166,13 @@ func (m *Ql) Drop() (err error) {
166166	return  nil 
167167}
168168func  (m  * Ql ) Lock () error  {
169- 	if  ! m .isLocked .CAS (false , true ) {
169+ 	if  ! m .isLocked .CompareAndSwap (false , true ) {
170170		return  database .ErrLocked 
171171	}
172172	return  nil 
173173}
174174func  (m  * Ql ) Unlock () error  {
175- 	if  ! m .isLocked .CAS (true , false ) {
175+ 	if  ! m .isLocked .CompareAndSwap (true , false ) {
176176		return  database .ErrNotLocked 
177177	}
178178	return  nil 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments