From acabc21c68624d131f0316f807951a03ac01dca9 Mon Sep 17 00:00:00 2001 From: AilinKid <314806019@qq.com> Date: Tue, 10 Sep 2019 14:00:51 +0800 Subject: [PATCH 01/14] fix max autoId alloc --- meta/autoid/autoid.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/meta/autoid/autoid.go b/meta/autoid/autoid.go index cccaa35875974..15329e8d7dc77 100644 --- a/meta/autoid/autoid.go +++ b/meta/autoid/autoid.go @@ -248,6 +248,9 @@ func (alloc *allocator) alloc4Unsigned(tableID int64) (int64, error) { alloc.base, alloc.end = newBase, newEnd } + if uint64(alloc.base)+uint64(1) == math.MaxUint64 { + return 0, ErrAutoincReadFailed + } alloc.base = int64(uint64(alloc.base) + 1) logutil.Logger(context.Background()).Debug("alloc unsigned ID", zap.Uint64("ID", uint64(alloc.base)), @@ -284,6 +287,9 @@ func (alloc *allocator) alloc4Signed(tableID int64) (int64, error) { alloc.base, alloc.end = newBase, newEnd } + if alloc.base+1 == math.MaxInt64 { + return 0, ErrAutoincReadFailed + } alloc.base++ logutil.Logger(context.Background()).Debug("alloc signed ID", zap.Uint64("ID", uint64(alloc.base)), From ee2a9e3c3de1d623563916064b7320a1438b4870 Mon Sep 17 00:00:00 2001 From: AilinKid <314806019@qq.com> Date: Tue, 10 Sep 2019 15:32:54 +0800 Subject: [PATCH 02/14] fix autoid MaxInt64 and MaxUint64 rebase --- meta/autoid/autoid.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/meta/autoid/autoid.go b/meta/autoid/autoid.go index 15329e8d7dc77..cba76537e00a2 100644 --- a/meta/autoid/autoid.go +++ b/meta/autoid/autoid.go @@ -113,6 +113,10 @@ func (alloc *allocator) NextGlobalAutoID(tableID int64) (int64, error) { } func (alloc *allocator) rebase4Unsigned(tableID int64, requiredBase uint64, allocIDs bool) error { + // Keep requiredBase valid. + if requiredBase == math.MaxUint64 { + return ErrAutoincReadFailed + } // Satisfied by alloc.base, nothing to do. if requiredBase <= uint64(alloc.base) { return nil @@ -159,6 +163,10 @@ func (alloc *allocator) rebase4Unsigned(tableID int64, requiredBase uint64, allo } func (alloc *allocator) rebase4Signed(tableID, requiredBase int64, allocIDs bool) error { + // Keep requiredBase valid. + if requiredBase == math.MaxInt64 { + return ErrAutoincReadFailed + } // Satisfied by alloc.base, nothing to do. if requiredBase <= alloc.base { return nil From 3e7233dd8511b777a5dac5aa121d8ae1571834e2 Mon Sep 17 00:00:00 2001 From: AilinKid <314806019@qq.com> Date: Tue, 10 Sep 2019 16:35:19 +0800 Subject: [PATCH 03/14] fix autoid maxUint64 limit in session_test --- session/session_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/session/session_test.go b/session/session_test.go index 1d260a16f922b..aba6d61e360ad 100644 --- a/session/session_test.go +++ b/session/session_test.go @@ -842,8 +842,11 @@ func (s *testSessionSuite) TestAutoIncrementID(c *C) { tk.MustExec("insert into autoid values();") tk.MustExec("insert into autoid values();") tk.MustQuery("select * from autoid").Check(testkit.Rows("9223372036854775808", "9223372036854775810", "9223372036854775812")) - tk.MustExec("insert into autoid values(18446744073709551614);") - _, err := tk.Exec("insert into autoid values()") + // TiDB nature : _tidb_rowid will also consume the autoID when auto_increment column is not primary key. + // Behaviour like MySQL using the MaxUint64 and MaxInt64 as the autoID upper limit will cause _tidb_rowid alloc fail here. + _, err := tk.Exec("insert into autoid values(18446744073709551614)") + c.Assert(terror.ErrorEqual(err, autoid.ErrAutoincReadFailed), IsTrue) + _, err = tk.Exec("insert into autoid values()") c.Assert(terror.ErrorEqual(err, autoid.ErrAutoincReadFailed), IsTrue) // FixMe: MySQL works fine with the this sql. _, err = tk.Exec("insert into autoid values(18446744073709551615)") From d82daf02f6fe6cf9902a213981735e41bc27f3a1 Mon Sep 17 00:00:00 2001 From: AilinKid <314806019@qq.com> Date: Tue, 10 Sep 2019 16:43:33 +0800 Subject: [PATCH 04/14] rebase maxUInt64 or maxInt64 ok --- meta/autoid/autoid.go | 8 -------- session/session_test.go | 7 ++----- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/meta/autoid/autoid.go b/meta/autoid/autoid.go index cba76537e00a2..15329e8d7dc77 100644 --- a/meta/autoid/autoid.go +++ b/meta/autoid/autoid.go @@ -113,10 +113,6 @@ func (alloc *allocator) NextGlobalAutoID(tableID int64) (int64, error) { } func (alloc *allocator) rebase4Unsigned(tableID int64, requiredBase uint64, allocIDs bool) error { - // Keep requiredBase valid. - if requiredBase == math.MaxUint64 { - return ErrAutoincReadFailed - } // Satisfied by alloc.base, nothing to do. if requiredBase <= uint64(alloc.base) { return nil @@ -163,10 +159,6 @@ func (alloc *allocator) rebase4Unsigned(tableID int64, requiredBase uint64, allo } func (alloc *allocator) rebase4Signed(tableID, requiredBase int64, allocIDs bool) error { - // Keep requiredBase valid. - if requiredBase == math.MaxInt64 { - return ErrAutoincReadFailed - } // Satisfied by alloc.base, nothing to do. if requiredBase <= alloc.base { return nil diff --git a/session/session_test.go b/session/session_test.go index aba6d61e360ad..f3283095c8641 100644 --- a/session/session_test.go +++ b/session/session_test.go @@ -842,11 +842,8 @@ func (s *testSessionSuite) TestAutoIncrementID(c *C) { tk.MustExec("insert into autoid values();") tk.MustExec("insert into autoid values();") tk.MustQuery("select * from autoid").Check(testkit.Rows("9223372036854775808", "9223372036854775810", "9223372036854775812")) - // TiDB nature : _tidb_rowid will also consume the autoID when auto_increment column is not primary key. - // Behaviour like MySQL using the MaxUint64 and MaxInt64 as the autoID upper limit will cause _tidb_rowid alloc fail here. - _, err := tk.Exec("insert into autoid values(18446744073709551614)") - c.Assert(terror.ErrorEqual(err, autoid.ErrAutoincReadFailed), IsTrue) - _, err = tk.Exec("insert into autoid values()") + tk.MustExec("insert into autoid values(18446744073709551614)") + _, err := tk.Exec("insert into autoid values()") c.Assert(terror.ErrorEqual(err, autoid.ErrAutoincReadFailed), IsTrue) // FixMe: MySQL works fine with the this sql. _, err = tk.Exec("insert into autoid values(18446744073709551615)") From cca05610e0f7302dc3188ca74508767e3d5d2a33 Mon Sep 17 00:00:00 2001 From: AilinKid <314806019@qq.com> Date: Tue, 10 Sep 2019 16:57:46 +0800 Subject: [PATCH 05/14] fix autoID upper limit test --- session/session_test.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/session/session_test.go b/session/session_test.go index f3283095c8641..3371607bdb3a5 100644 --- a/session/session_test.go +++ b/session/session_test.go @@ -842,8 +842,11 @@ func (s *testSessionSuite) TestAutoIncrementID(c *C) { tk.MustExec("insert into autoid values();") tk.MustExec("insert into autoid values();") tk.MustQuery("select * from autoid").Check(testkit.Rows("9223372036854775808", "9223372036854775810", "9223372036854775812")) - tk.MustExec("insert into autoid values(18446744073709551614)") - _, err := tk.Exec("insert into autoid values()") + // TiDB nature : _tidb_rowid will also consume the autoID when auto_increment column is not primary key. + // Behaviour like MySQL using the MaxUint64 and MaxInt64 as the autoID upper limit will cause _tidb_rowid alloc fail here. + _, err := tk.Exec("insert into autoid values(18446744073709551614)") + c.Assert(terror.ErrorEqual(err, autoid.ErrAutoincReadFailed), IsTrue) + _, err = tk.Exec("insert into autoid values()") c.Assert(terror.ErrorEqual(err, autoid.ErrAutoincReadFailed), IsTrue) // FixMe: MySQL works fine with the this sql. _, err = tk.Exec("insert into autoid values(18446744073709551615)") @@ -866,12 +869,15 @@ func (s *testSessionSuite) TestAutoIncrementID(c *C) { // Corner cases for signed bigint auto_increment Columns. tk.MustExec("drop table if exists autoid") tk.MustExec("create table autoid(`auto_inc_id` bigint(20) NOT NULL AUTO_INCREMENT,UNIQUE KEY `auto_inc_id` (`auto_inc_id`))") - tk.MustExec("insert into autoid values(9223372036854775806);") - tk.MustQuery("select auto_inc_id, _tidb_rowid from autoid use index()").Check(testkit.Rows("9223372036854775806 9223372036854775807")) + // TiDB nature : _tidb_rowid will also consume the autoID when auto_increment column is not primary key. + // Behaviour like MySQL using the MaxUint64 and MaxInt64 as autoID upper limit will cause insert fail if + // the values is 9223372036854775806. Because autoID will want alloc 9223372036854775807. + tk.MustExec("insert into autoid values(9223372036854775805);") + tk.MustQuery("select auto_inc_id, _tidb_rowid from autoid use index()").Check(testkit.Rows("9223372036854775805 9223372036854775806")) _, err = tk.Exec("insert into autoid values();") c.Assert(terror.ErrorEqual(err, autoid.ErrAutoincReadFailed), IsTrue) - tk.MustQuery("select auto_inc_id, _tidb_rowid from autoid use index()").Check(testkit.Rows("9223372036854775806 9223372036854775807")) - tk.MustQuery("select auto_inc_id, _tidb_rowid from autoid use index(auto_inc_id)").Check(testkit.Rows("9223372036854775806 9223372036854775807")) + tk.MustQuery("select auto_inc_id, _tidb_rowid from autoid use index()").Check(testkit.Rows("9223372036854775805 9223372036854775806")) + tk.MustQuery("select auto_inc_id, _tidb_rowid from autoid use index(auto_inc_id)").Check(testkit.Rows("9223372036854775805 9223372036854775806")) tk.MustExec("drop table if exists autoid") tk.MustExec("create table autoid(`auto_inc_id` bigint(20) NOT NULL AUTO_INCREMENT,UNIQUE KEY `auto_inc_id` (`auto_inc_id`))") From 9fea317ff8ec53981e5d6060caf4565d7ee35a80 Mon Sep 17 00:00:00 2001 From: AilinKid <314806019@qq.com> Date: Tue, 10 Sep 2019 17:30:32 +0800 Subject: [PATCH 06/14] add autoid test --- meta/autoid/autoid_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/meta/autoid/autoid_test.go b/meta/autoid/autoid_test.go index 6714e322b4076..8fd5ffdcfbcaf 100644 --- a/meta/autoid/autoid_test.go +++ b/meta/autoid/autoid_test.go @@ -133,6 +133,14 @@ func (*testSuite) TestT(c *C) { id, err = alloc.Alloc(3) c.Assert(err, IsNil) c.Assert(id, Equals, int64(6544)) + + // Test the MaxInt64 is alloc upper bound but not rebase. + err = alloc.Rebase(3, int64(9223372036854775806), true) + c.Assert(err, IsNil) + _, err = alloc.Alloc(3) + c.Assert(alloc, NotNil) + err = alloc.Rebase(3, int64(9223372036854775807), true) + c.Assert(err, IsNil) } func (*testSuite) TestUnsignedAutoid(c *C) { @@ -229,6 +237,17 @@ func (*testSuite) TestUnsignedAutoid(c *C) { id, err = alloc.Alloc(3) c.Assert(err, IsNil) c.Assert(id, Equals, int64(6544)) + + // Test the MaxUint64 is alloc upper bound but not rebase. + var n uint64 = 18446744073709551614 + var i interface{} = n + un := i.(int64) + err = alloc.Rebase(3, un, true) + c.Assert(err, IsNil) + _, err = alloc.Alloc(3) + c.Assert(alloc, NotNil) + err = alloc.Rebase(3, un, true) + c.Assert(err, IsNil) } // TestConcurrentAlloc is used for the test that From 914e5d51855af395dfdf502951dc23c0d15d7f49 Mon Sep 17 00:00:00 2001 From: AilinKid <314806019@qq.com> Date: Tue, 10 Sep 2019 17:36:10 +0800 Subject: [PATCH 07/14] fix uint64 transfer to int64 --- meta/autoid/autoid_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/meta/autoid/autoid_test.go b/meta/autoid/autoid_test.go index 8fd5ffdcfbcaf..c3d0e9ed15047 100644 --- a/meta/autoid/autoid_test.go +++ b/meta/autoid/autoid_test.go @@ -15,6 +15,7 @@ package autoid_test import ( "fmt" + "math" "sync" "testing" "time" @@ -239,13 +240,12 @@ func (*testSuite) TestUnsignedAutoid(c *C) { c.Assert(id, Equals, int64(6544)) // Test the MaxUint64 is alloc upper bound but not rebase. - var n uint64 = 18446744073709551614 - var i interface{} = n - un := i.(int64) + var n uint64 = math.MaxInt64 - 1 + un := int64(n) err = alloc.Rebase(3, un, true) c.Assert(err, IsNil) _, err = alloc.Alloc(3) - c.Assert(alloc, NotNil) + un = int64(n + 1) err = alloc.Rebase(3, un, true) c.Assert(err, IsNil) } From 082123be8e5e7d2d80c58cf322ff4e3ea5c8e1c5 Mon Sep 17 00:00:00 2001 From: AilinKid <314806019@qq.com> Date: Tue, 10 Sep 2019 17:40:34 +0800 Subject: [PATCH 08/14] fix comment --- meta/autoid/autoid_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/meta/autoid/autoid_test.go b/meta/autoid/autoid_test.go index c3d0e9ed15047..2e19ee80c09c5 100644 --- a/meta/autoid/autoid_test.go +++ b/meta/autoid/autoid_test.go @@ -245,6 +245,7 @@ func (*testSuite) TestUnsignedAutoid(c *C) { err = alloc.Rebase(3, un, true) c.Assert(err, IsNil) _, err = alloc.Alloc(3) + c.Assert(err, NotNil) un = int64(n + 1) err = alloc.Rebase(3, un, true) c.Assert(err, IsNil) From 4e3188476e21c4dced51dec04eb85a1719d06b2f Mon Sep 17 00:00:00 2001 From: AilinKid <314806019@qq.com> Date: Tue, 10 Sep 2019 17:43:54 +0800 Subject: [PATCH 09/14] fix init value error --- meta/autoid/autoid_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/autoid/autoid_test.go b/meta/autoid/autoid_test.go index 2e19ee80c09c5..5baf51ce8854a 100644 --- a/meta/autoid/autoid_test.go +++ b/meta/autoid/autoid_test.go @@ -240,7 +240,7 @@ func (*testSuite) TestUnsignedAutoid(c *C) { c.Assert(id, Equals, int64(6544)) // Test the MaxUint64 is alloc upper bound but not rebase. - var n uint64 = math.MaxInt64 - 1 + var n uint64 = math.MaxUint64 - 1 un := int64(n) err = alloc.Rebase(3, un, true) c.Assert(err, IsNil) From 23a2ccc106e17e13a80ed600eff07debc522158f Mon Sep 17 00:00:00 2001 From: AilinKid <314806019@qq.com> Date: Wed, 11 Sep 2019 10:19:37 +0800 Subject: [PATCH 10/14] fix comment --- session/session_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/session/session_test.go b/session/session_test.go index 3371607bdb3a5..707d6e97566d2 100644 --- a/session/session_test.go +++ b/session/session_test.go @@ -842,7 +842,7 @@ func (s *testSessionSuite) TestAutoIncrementID(c *C) { tk.MustExec("insert into autoid values();") tk.MustExec("insert into autoid values();") tk.MustQuery("select * from autoid").Check(testkit.Rows("9223372036854775808", "9223372036854775810", "9223372036854775812")) - // TiDB nature : _tidb_rowid will also consume the autoID when auto_increment column is not primary key. + // TiDB characteristics : _tidb_rowid will also consume the autoID when the auto_increment column is not the primary key. // Behaviour like MySQL using the MaxUint64 and MaxInt64 as the autoID upper limit will cause _tidb_rowid alloc fail here. _, err := tk.Exec("insert into autoid values(18446744073709551614)") c.Assert(terror.ErrorEqual(err, autoid.ErrAutoincReadFailed), IsTrue) @@ -869,9 +869,9 @@ func (s *testSessionSuite) TestAutoIncrementID(c *C) { // Corner cases for signed bigint auto_increment Columns. tk.MustExec("drop table if exists autoid") tk.MustExec("create table autoid(`auto_inc_id` bigint(20) NOT NULL AUTO_INCREMENT,UNIQUE KEY `auto_inc_id` (`auto_inc_id`))") - // TiDB nature : _tidb_rowid will also consume the autoID when auto_increment column is not primary key. - // Behaviour like MySQL using the MaxUint64 and MaxInt64 as autoID upper limit will cause insert fail if - // the values is 9223372036854775806. Because autoID will want alloc 9223372036854775807. + // TiDB characteristics: _tidb_rowid will also consume the autoID when the auto_increment column is not the primary key. + // Behaviour like MySQL using the MaxUint64 and MaxInt64 as autoID upper limit will cause insert fail if the values is + // 9223372036854775806. Because _tidb_rowid will be allocated 9223372036854775807 at same time. tk.MustExec("insert into autoid values(9223372036854775805);") tk.MustQuery("select auto_inc_id, _tidb_rowid from autoid use index()").Check(testkit.Rows("9223372036854775805 9223372036854775806")) _, err = tk.Exec("insert into autoid values();") From 89984f36bf9662375a4902e640579abbffe436c5 Mon Sep 17 00:00:00 2001 From: AilinKid <314806019@qq.com> Date: Wed, 11 Sep 2019 10:34:23 +0800 Subject: [PATCH 11/14] fix autoid_test comment --- meta/autoid/autoid_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/autoid/autoid_test.go b/meta/autoid/autoid_test.go index 5baf51ce8854a..af54be278a337 100644 --- a/meta/autoid/autoid_test.go +++ b/meta/autoid/autoid_test.go @@ -135,7 +135,7 @@ func (*testSuite) TestT(c *C) { c.Assert(err, IsNil) c.Assert(id, Equals, int64(6544)) - // Test the MaxInt64 is alloc upper bound but not rebase. + // Test the MaxInt64 is the upper bound of `alloc` function but not `rebase`. err = alloc.Rebase(3, int64(9223372036854775806), true) c.Assert(err, IsNil) _, err = alloc.Alloc(3) @@ -239,7 +239,7 @@ func (*testSuite) TestUnsignedAutoid(c *C) { c.Assert(err, IsNil) c.Assert(id, Equals, int64(6544)) - // Test the MaxUint64 is alloc upper bound but not rebase. + // Test the MaxUint64 is the upper bound of `alloc` func but not `rebase`. var n uint64 = math.MaxUint64 - 1 un := int64(n) err = alloc.Rebase(3, un, true) From 177eb26258655c6a5369ed90ae2ab82e121dabe4 Mon Sep 17 00:00:00 2001 From: AilinKid <314806019@qq.com> Date: Wed, 11 Sep 2019 10:41:17 +0800 Subject: [PATCH 12/14] fix session_test comment --- session/session_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/session/session_test.go b/session/session_test.go index 707d6e97566d2..6e3a23dbfe7ee 100644 --- a/session/session_test.go +++ b/session/session_test.go @@ -842,8 +842,8 @@ func (s *testSessionSuite) TestAutoIncrementID(c *C) { tk.MustExec("insert into autoid values();") tk.MustExec("insert into autoid values();") tk.MustQuery("select * from autoid").Check(testkit.Rows("9223372036854775808", "9223372036854775810", "9223372036854775812")) - // TiDB characteristics : _tidb_rowid will also consume the autoID when the auto_increment column is not the primary key. - // Behaviour like MySQL using the MaxUint64 and MaxInt64 as the autoID upper limit will cause _tidb_rowid alloc fail here. + // In TiDB : _tidb_rowid will also consume the autoID when the auto_increment column is not the primary key. + // Using the MaxUint64 and MaxInt64 as the autoID upper limit like MySQL will cause _tidb_rowid alloc fail here. _, err := tk.Exec("insert into autoid values(18446744073709551614)") c.Assert(terror.ErrorEqual(err, autoid.ErrAutoincReadFailed), IsTrue) _, err = tk.Exec("insert into autoid values()") @@ -869,8 +869,8 @@ func (s *testSessionSuite) TestAutoIncrementID(c *C) { // Corner cases for signed bigint auto_increment Columns. tk.MustExec("drop table if exists autoid") tk.MustExec("create table autoid(`auto_inc_id` bigint(20) NOT NULL AUTO_INCREMENT,UNIQUE KEY `auto_inc_id` (`auto_inc_id`))") - // TiDB characteristics: _tidb_rowid will also consume the autoID when the auto_increment column is not the primary key. - // Behaviour like MySQL using the MaxUint64 and MaxInt64 as autoID upper limit will cause insert fail if the values is + // In TiDB : _tidb_rowid will also consume the autoID when the auto_increment column is not the primary key. + // Using the MaxUint64 and MaxInt64 as autoID upper limit like MySQL will cause insert fail if the values is // 9223372036854775806. Because _tidb_rowid will be allocated 9223372036854775807 at same time. tk.MustExec("insert into autoid values(9223372036854775805);") tk.MustQuery("select auto_inc_id, _tidb_rowid from autoid use index()").Check(testkit.Rows("9223372036854775805 9223372036854775806")) From 3497998435e9391d7833b2f07c524208618a1898 Mon Sep 17 00:00:00 2001 From: AilinKid <314806019@qq.com> Date: Wed, 11 Sep 2019 10:43:41 +0800 Subject: [PATCH 13/14] fix session_test comment2 --- session/session_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/session/session_test.go b/session/session_test.go index 6e3a23dbfe7ee..6a279e80f230d 100644 --- a/session/session_test.go +++ b/session/session_test.go @@ -843,7 +843,7 @@ func (s *testSessionSuite) TestAutoIncrementID(c *C) { tk.MustExec("insert into autoid values();") tk.MustQuery("select * from autoid").Check(testkit.Rows("9223372036854775808", "9223372036854775810", "9223372036854775812")) // In TiDB : _tidb_rowid will also consume the autoID when the auto_increment column is not the primary key. - // Using the MaxUint64 and MaxInt64 as the autoID upper limit like MySQL will cause _tidb_rowid alloc fail here. + // Using the MaxUint64 and MaxInt64 as the autoID upper limit like MySQL will cause _tidb_rowid allocation fail here. _, err := tk.Exec("insert into autoid values(18446744073709551614)") c.Assert(terror.ErrorEqual(err, autoid.ErrAutoincReadFailed), IsTrue) _, err = tk.Exec("insert into autoid values()") From 58fdf142b76720e5e1f254256149aaf11727e03f Mon Sep 17 00:00:00 2001 From: AilinKid <314806019@qq.com> Date: Wed, 11 Sep 2019 18:47:35 +0800 Subject: [PATCH 14/14] use MaxInt64 to replace hard code --- meta/autoid/autoid_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/autoid/autoid_test.go b/meta/autoid/autoid_test.go index af54be278a337..23961eac150e7 100644 --- a/meta/autoid/autoid_test.go +++ b/meta/autoid/autoid_test.go @@ -136,11 +136,11 @@ func (*testSuite) TestT(c *C) { c.Assert(id, Equals, int64(6544)) // Test the MaxInt64 is the upper bound of `alloc` function but not `rebase`. - err = alloc.Rebase(3, int64(9223372036854775806), true) + err = alloc.Rebase(3, int64(math.MaxInt64-1), true) c.Assert(err, IsNil) _, err = alloc.Alloc(3) c.Assert(alloc, NotNil) - err = alloc.Rebase(3, int64(9223372036854775807), true) + err = alloc.Rebase(3, int64(math.MaxInt64), true) c.Assert(err, IsNil) }