-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
*: tidy code && prealloc some slice for performance #13468
Changes from 2 commits
60db06e
3174f9d
dfe8980
e43678f
c6820f3
7745cf9
0b8f761
ab0e4ab
bba93aa
2c6b21c
91554e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3606,7 +3606,7 @@ func (s *testDBSuite2) TestTablesLockDelayClean(c *C) { | |
tk.Se.Close() | ||
wg.Done() | ||
}() | ||
time.Sleep(50) | ||
time.Sleep(50 * time.Nanosecond) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
checkTableLock(c, tk.Se, "test", "t1", model.TableLockWrite) | ||
wg.Wait() | ||
c.Assert(time.Since(startTime).Seconds() > 0.1, IsTrue) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,8 +31,8 @@ import ( | |
"go.etcd.io/etcd/integration" | ||
"go.etcd.io/etcd/mvcc/mvccpb" | ||
goctx "golang.org/x/net/context" | ||
"google.golang.org/grpc" | ||
"google.golang.org/grpc/codes" | ||
"google.golang.org/grpc/status" | ||
) | ||
|
||
const minInterval = 10 * time.Nanosecond // It's used to test timeout. | ||
|
@@ -225,7 +225,7 @@ func TestSyncerSimple(t *testing.T) { | |
} | ||
|
||
func isTimeoutError(err error) bool { | ||
if terror.ErrorEqual(err, goctx.DeadlineExceeded) || grpc.Code(errors.Cause(err)) == codes.DeadlineExceeded || | ||
if terror.ErrorEqual(err, goctx.DeadlineExceeded) || status.Code(errors.Cause(err)) == codes.DeadlineExceeded || | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
terror.ErrorEqual(err, etcdserver.ErrTimeout) { | ||
return true | ||
} | ||
|
@@ -245,7 +245,7 @@ func checkRespKV(t *testing.T, kvCount int, key, val string, | |
if string(kv.Key) != key { | ||
t.Fatalf("key resp %s, exported %s", kv.Key, key) | ||
} | ||
if val != val { | ||
if string(kv.Value) != val { | ||
t.Fatalf("val resp %s, exported %s", kv.Value, val) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the context (
HasPrefix
) , I think we should useTrimPrefix