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 when manager restart, collect register error #1896

Merged
merged 4 commits into from
May 1, 2024

Conversation

Ceilzcx
Copy link
Contributor

@Ceilzcx Ceilzcx commented May 1, 2024

What's changed?

#1709

Checklist

  • I have read the Contributing Guide
  • I have written the necessary doc or comment.
  • I have added the necessary unit tests and all cases have passed.

Add or update API

  • I have added the necessary e2e tests and all cases have passed.

log.info("the collector {} is not online.", identity);
boolean isChannelActive = this.manageServer.isChannelActive(identity);
if (!isChannelActive) {
this.manageServer.addChannel(identity, ctx.channel());
Copy link
Contributor

Choose a reason for hiding this comment

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

if the collector is offline and re online throgh heartbeatProcessor, does we need add this.manageServer.getCollectorAndJobScheduler().collectorGoOnline(collector, collectorInfo); to re-dispath current collect jobs.

@tomsun28
Copy link
Contributor

tomsun28 commented May 1, 2024

hi, i think this bug is due code here


    @Override
    public void collectorGoOnline(String identity, CollectorInfo collectorInfo) {
        Optional<Collector> collectorOptional = collectorDao.findCollectorByName(identity);
        Collector collector;
        if (collectorOptional.isPresent()) {
            collector = collectorOptional.get();
            if (collector.getStatus() == CommonConstants.COLLECTOR_STATUS_ONLINE) {
                return;
            }
            collector.setStatus(CommonConstants.COLLECTOR_STATUS_ONLINE);
            if (collectorInfo != null) {
                collector.setIp(collectorInfo.getIp());
                collector.setMode(collectorInfo.getMode());   
                collector.setMode(collectorInfo.getMode());
            }
        }

the

            if (collector.getStatus() == CommonConstants.COLLECTOR_STATUS_ONLINE) {
                return;
            }

when the main server shutdown, the all collector status is online. And when the main server startup, first will set all collector status offline in database, but if the collector online request is before the init offline, the online request will be ignored.

Copy link
Contributor

@tomsun28 tomsun28 left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@tomsun28 tomsun28 merged commit 6980263 into apache:master May 1, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
2 participants