-
Notifications
You must be signed in to change notification settings - Fork 286
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
kv(ticdc): reduce eventfeed rate limited log #4072
Changes from 7 commits
3903a40
4f95e79
57e28e3
e30d3fc
e61ea09
2c15ee9
98f39f8
20d6f48
a90e28c
8ccd0ab
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 |
---|---|---|
|
@@ -44,6 +44,7 @@ import ( | |
"github.com/pingcap/tiflow/pkg/txnutil" | ||
"github.com/pingcap/tiflow/pkg/util" | ||
"github.com/pingcap/tiflow/pkg/util/testleak" | ||
"github.com/stretchr/testify/require" | ||
"github.com/tikv/client-go/v2/oracle" | ||
"github.com/tikv/client-go/v2/testutils" | ||
"github.com/tikv/client-go/v2/tikv" | ||
|
@@ -3610,3 +3611,19 @@ func (s *clientSuite) TestHandleRateLimit(c *check.C) { | |
c.Assert(session.rateLimitQueue, check.HasLen, 0) | ||
c.Assert(cap(session.rateLimitQueue), check.Equals, 128) | ||
} | ||
|
||
func TestRegionErrorInfoLogRateLimitedHint(t *testing.T) { | ||
t.Parallel() | ||
|
||
errInfo := newRegionErrorInfo(singleRegionInfo{}, nil) | ||
errInfo.logRateLimitDuration = time.Second | ||
|
||
// True on the first rate limited. | ||
require.True(t, errInfo.logRateLimitedHint()) | ||
require.False(t, errInfo.logRateLimitedHint()) | ||
Comment on lines
+3622
to
+3623
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. Could it happen L3623 executes 200ms after L3622 executes, and 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. Maybe, although I think it's very rare. 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. t.Parallel() makes it possible |
||
|
||
// True if it lasts too long. | ||
time.Sleep(2 * errInfo.logRateLimitDuration) | ||
require.True(t, errInfo.logRateLimitedHint()) | ||
require.False(t, errInfo.logRateLimitedHint()) | ||
} |
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.
do not need sleep in the new change ?
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.
Yes, it will be rate-limited in
onRegionFail
.