Skip to content
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

heartbeat: rebind stream. #918

Merged
merged 2 commits into from
Jan 15, 2018
Merged

heartbeat: rebind stream. #918

merged 2 commits into from
Jan 15, 2018

Conversation

disksing
Copy link
Contributor

Circumvent potential problems that may be occurred by reconnecting.

Copy link
Member

@Connor1996 Connor1996 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -311,9 +313,10 @@ func (s *Server) RegionHeartbeat(stream pdpb.PD_RegionHeartbeatServer) error {

hbStreams := cluster.coordinator.hbStreams

if isNew {
if time.Since(lastBind) > heartbeatStreamRebindInterval {
regionHeartbeatCounter.WithLabelValues(storeLabel, "report", "bind").Inc()
hbStreams.bindStream(storeID, server)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any side effect if you bindStream again after the interval?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just re-assign a map entry, should be trivial.

@@ -239,6 +239,8 @@ func (s *Server) StoreHeartbeat(ctx context.Context, request *pdpb.StoreHeartbea

const regionHeartbeatSendTimeout = 5 * time.Second

var heartbeatStreamRebindInterval = time.Minute
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use a config here to speed up test?

I see that you should wait at least 1m in test to rebind.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've set it to 3 seconds in test.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, this is a var I just notice. Seem it is a not good way here.

@disksing
Copy link
Contributor Author

PTAL @siddontang

Copy link
Contributor

@siddontang siddontang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@siddontang
Copy link
Contributor

But CI failed @disksing

@disksing
Copy link
Contributor Author

listen tcp 127.0.0.1:41210: bind: address already in use

I'm going to just restart it.

@disksing disksing merged commit 907684f into tikv:master Jan 15, 2018
@disksing disksing deleted the heartbeat branch January 15, 2018 08:07
disksing added a commit to oh-my-tidb/pd that referenced this pull request Jan 15, 2018
Connor1996 pushed a commit that referenced this pull request Jan 15, 2018
disksing added a commit that referenced this pull request Jan 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants