Skip to content

refactor: remove zookeeper segment announcement and discovery#19377

Merged
clintropolis merged 7 commits into
apache:masterfrom
clintropolis:remove-some-zk-stuff
Apr 30, 2026
Merged

refactor: remove zookeeper segment announcement and discovery#19377
clintropolis merged 7 commits into
apache:masterfrom
clintropolis:remove-some-zk-stuff

Conversation

@clintropolis
Copy link
Copy Markdown
Member

@clintropolis clintropolis commented Apr 25, 2026

Description

Druid has carried both ZooKeeper- and HTTP-based paths for segment announcement and inventory for several releases. The ZK paths have been @Deprecated for years, off by default (druid.serverview.type=http is the default), and segment-publishing path, the ZK-based inventory view, and the now-orphaned ZkCoordinator / DataSegmentServerAnnouncer / CuratorDataSegmentServerAnnouncer.

After this change, ZooKeeper's responsibilities in Druid are limited to:

  1. Coordinator and Overlord leader election
  2. Service (node) announcement and discovery
  3. Overlord / MiddleManager task management (out of scope for this PR; but will look to remove this too in a follow-up)

BatchDataSegmentAnnouncer seems a lot nicer now since it only has to track change history for the lister resource, to something better in a follow-up, but skipped for now.

Release note

ZooKeeper-based segment announcement and discovery removed

The ZooKeeper-based segment announcement and inventory view, which have been deprecated and off by default for several releases, have been removed. The HTTP-based path (the default for druid.serverview.type=http) is now the only supported option.

If your configuration sets druid.serverview.type to anything other than http, startup will now fail with a clear error message. Remove the property (or set it to http, which is the default) to proceed.

The following configuration properties are no longer recognized and should be removed from common.runtime.properties:

  • druid.announcer.segmentsPerNode
  • druid.announcer.maxBytesPerNode
  • druid.announcer.skipLoadSpec
  • druid.announcer.skipDimensionsAndMetrics
  • druid.announcer.skipSegmentAnnouncementOnZk
  • druid.zk.paths.announcementsPath
  • druid.zk.paths.liveSegmentsPath
  • druid.zk.paths.propertiesPath
  • druid.zk.paths.connectorPath

ZooKeeper is still used for leader election, service (node) announcement and discovery, and Overlord-to-MiddleManager task management.

Copy link
Copy Markdown
Member

@FrankChen021 FrankChen021 left a comment

Choose a reason for hiding this comment

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

The changes LGTM, no correctness issues found.

Copy link
Copy Markdown
Contributor

@gianm gianm left a comment

Choose a reason for hiding this comment

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

👍 on the removal. I think a few too many tests got removed, as mentioned in line comments. Beyond that there's a couple of references that could also be removed:

  • in docs/configuration/logging.md, the example log file mentions BatchServerInventoryView which doesn't exist anymore
  • in MainTest there is a setting of druid.serverview.type = batch in one of the tests. It's expecting an exception to be thrown. I believe it's now passing for a different reason than intended.

import java.util.concurrent.Executor;
import java.util.stream.Collectors;

public class BrokerServerViewTest extends CuratorTestBase
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There's coverage of BrokerServerView in this test that we should preserve, such as testing for handling of tiers, etc. It should be reworked to use some other base view.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

oops, restored, thanks for catching

import java.util.concurrent.ExecutorService;

@RunWith(Parameterized.class)
public class CoordinatorServerViewTest extends CuratorTestBase
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Like BrokerServerView, the tests here should be reworked to use some other base view.

/**
*
*/
public class BatchDataSegmentAnnouncerTest
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Some of the removed tests in this file look like they are testing functionality that still exists, so they should be restored. Including:

  • testAnnounceSegmentWithSameSegmentConcurrently
  • testAnnounceSegmentsWithSameSegmentConcurrently
  • testSchemaAnnounce

Copy link
Copy Markdown
Member

@FrankChen021 FrankChen021 left a comment

Choose a reason for hiding this comment

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

The changes LGTM, no correctness issues found.

Copy link
Copy Markdown
Member

@FrankChen021 FrankChen021 left a comment

Choose a reason for hiding this comment

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

The changes LGTM, no correctness issues found.

Copy link
Copy Markdown
Contributor

@gianm gianm left a comment

Choose a reason for hiding this comment

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

I know I just approved this but a few other things to consider removing are inline. Beyond that, check docs/api-reference/service-status-api.md, it references "Zookeeper segment discovery" which doesn't happen anymore.

Comment thread docs/design/zookeeper.md Outdated

```
${druid.zk.paths.liveSegmentsPath}/${druid.host}
${druid.zk.paths.announcementsPath}/${druid.host}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is druid.zk.paths.announcementsPath really still used? It looked like this PR removed it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

oops, yea it can go too

@JsonProperty
private String propertiesPath;
@JsonProperty
private String announcementsPath;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It looks like this isn't used anymore

Copy link
Copy Markdown
Member

@FrankChen021 FrankChen021 left a comment

Choose a reason for hiding this comment

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

Severity Findings
P0 0
P1 1
P2 0
P3 0
Total 1

Findings that could not be attached inline:

  • server/src/main/java/org/apache/druid/server/coordinator/rules/PartialLoadRule.java:94 - [P1] Partial load rules still enqueue full segment loads. RunRules calls rule.run(...) after appliesTo, but this implementation discards the matcher's wrappedLoadSpec and fingerprint and calls replicateSegment with the original DataSegment. Any configured loadPartial* rule whose matcher resolves will therefore load the full segment, not the selected projections, so the new public rule types silently violate the partial-load contract until the action path can pass the wrapped load spec through.

This is an automated review by Codex GPT-5

@clintropolis
Copy link
Copy Markdown
Member Author

server/src/main/java/org/apache/druid/server/coordinator/rules/PartialLoadRule.java:94

I guess this is a comment for wrong PR?

@clintropolis clintropolis merged commit aef9aa9 into apache:master Apr 30, 2026
63 of 64 checks passed
@clintropolis clintropolis deleted the remove-some-zk-stuff branch April 30, 2026 21:59
@github-actions github-actions Bot added this to the 38.0.0 milestone Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants