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

Fix: 主备切换后没有往Kafka发送数据 #1810

Merged
merged 1 commit into from
May 27, 2019

Conversation

sosozhuang
Copy link
Contributor

发生主备切换时,调用canalMQStarter启停对应的destination。

1.1.3版本中在CanalMQStarter判断CanalInstance是否存在,如果此时发生切换,再getWithoutAck获取数据会抛出异常。

    private void worker(String destination, AtomicBoolean destinationRunning) {
        ....
        while (running && destinationRunning.get()) {
            try {
                CanalInstance canalInstance = canalServer.getCanalInstances().get(destination);
                if (canalInstance == null) {
                    try {
                        Thread.sleep(3000);
                    } catch (InterruptedException e) {
                        // ignore
                    }
                    continue;
                }
                ....

                while (running && destinationRunning.get()) {
                    Message message;
                    if (getTimeout != null && getTimeout > 0) {
                        message = canalServer.getWithoutAck(clientIdentity,
                            getBatchSize,
                            getTimeout,
                            TimeUnit.MILLISECONDS);
                    } else {
                        message = canalServer.getWithoutAck(clientIdentity, getBatchSize);
                    }

发生主备切换时,调用canalMQStarter启停对应的destination。
@CLAassistant
Copy link

CLAassistant commented May 15, 2019

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@codecov-io
Copy link

Codecov Report

Merging #1810 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##             master   #1810   +/-   ##
========================================
  Coverage      5.33%   5.33%           
  Complexity      126     126           
========================================
  Files           265     265           
  Lines         23841   23841           
  Branches       3493    3493           
========================================
  Hits           1272    1272           
  Misses        22357   22357           
  Partials        212     212

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3b9ff26...baff4bc. Read the comment docs.

@agapple agapple merged commit 8df6d6f into alibaba:master May 27, 2019
@agapple
Copy link
Member

agapple commented May 27, 2019

tks

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.

4 participants