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

Handle DCP stream end/reconnection #969

Closed
tleyden opened this issue Jul 2, 2015 · 6 comments
Closed

Handle DCP stream end/reconnection #969

tleyden opened this issue Jul 2, 2015 · 6 comments
Assignees
Milestone

Comments

@tleyden
Copy link
Contributor

tleyden commented Jul 2, 2015

Factored out of #922

When a vbucket gets moved/rebalanced, it will send an END STREAM. Currently, our DCP impl does nothing with a stream end. Desired behavior: trigger a reconnection .. might be a different node, but we don't care.

In dcp_feed.go:

func (r *DCPReceiver) OnError(err error) {
    Warn("Feed", "Error processing DCP stream: %v", err)
}

This needs to reconnect rather than just logging an error.

@steveyen do you have any examples of DCP stream reconnection I should be looking at?

@steveyen
Copy link
Member

steveyen commented Jul 6, 2015

Hi, if you're using cbdatasource, then it should do all the reconnection work for you...

https://github.com/couchbase/go-couchbase/blob/master/cbdatasource/cbdatasource.go#L1136

But, testing back in the day was all manual. Are you seeing cbdatasource not working properly for that case?

@tleyden
Copy link
Contributor Author

tleyden commented Jul 6, 2015

Yep, we are using cbdatasource. Nope, haven't tried to test yet. But thanks, that clears things up regarding expectations.

@tleyden
Copy link
Contributor Author

tleyden commented Jul 6, 2015

But, testing back in the day was all manual.

Do you remember the manual testing you did and how big the cluster was / how many replicas?

@tleyden
Copy link
Contributor Author

tleyden commented Jul 6, 2015

If there was a single node couchbase cluster and the node was abruptly rebooted, would it be expected that cbdatasource would reconnect?

@tleyden
Copy link
Contributor Author

tleyden commented Jul 6, 2015

I caught up with @steveyen in detail regarding the reconnection behavior of cbdatasource and it turns out that #942 is a pre-requisite for this ticket because:

  • There was a conscious decision in the cbdatasource design not to use the cluster map to connect to other nodes, due to the usage pattern of some advanced users of couchbase that access it in front of a load balancer.
  • Therefore, if you have a case where you have a multi-node cluster and one node (10.1.1.1) is brought down and a rebalance is done, cbdatasource will repeatedly try to connect to the node it knows about (10.1.1.1) and will never be able to reconnect to the other working nodes in the cluster since it doesn't know their URLs.

@tleyden
Copy link
Contributor Author

tleyden commented Jul 7, 2015

Actually, I might be wrong on the dependence on #942 for this, since it looks like we are using the cbdatasource package directly from when initializing the connection to the bucket, and we have an opportunity to pass a list of URLs at that point:

LogTo("Feed+", "Connecting to new bucket datasource. URLs:%s, pool:%s, name:%s, auth:%s", urls, poolName, bucketName, auth)
bds, err := cbdatasource.NewBucketDataSource(
urls,
poolName,
bucketName,
"",
vbucketIdsArr,
auth,
dcpReceiver,
nil,
)

Doing so there should solve the issue described above.

@tleyden tleyden added ready and removed in progress labels Jul 13, 2015
@tleyden tleyden added this to the 1.2.0 milestone Aug 3, 2015
@zgramana zgramana removed the ready label Nov 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants