Skip to content

ZOOKEEPER-5091: WatchManager reports connections with no active watches after consuming the last standard watch - #2457

Open
casolaroSalvatore wants to merge 1 commit into
apache:masterfrom
casolaroSalvatore:ZOOKEEPER-5091
Open

casolaroSalvatore wants to merge 1 commit into
apache:masterfrom
casolaroSalvatore:ZOOKEEPER-5091

Conversation

@casolaroSalvatore

Copy link
Copy Markdown

Background

When the last STANDARD watch associated with a watcher is triggered, WatchManager removes the path registration but retains an empty entry in watch2Paths. As a result, getWatchesSummary() reports one connection with zero paths and zero watches, while getWatches() reports the session with an empty path set.

Change

Remove the watcher from watch2Paths when its last STANDARD watch is consumed and the associated path map becomes empty. The cleanup is performed only when the path map is empty, so other registrations belonging to the same watcher are preserved.

Testing

Regression tests verify that:

  • the watcher is removed from the watches summary after its last STANDARD watch is consumed;
  • the watcher is no longer included in the connection-oriented watches report;
  • another registration belonging to the same watcher is preserved.

Validation performed locally:

  • Individual regression tests passed.
  • WatchManagerTest passed.
  • Checkstyle passed with 0 violations.
  • SpotBugs passed with 0 errors or warnings.

JIRA: ZOOKEEPER-5091

This issue was identified while working on an academic software testing project provided within a course taught by Prof. Guglielmo De Angelis (@gulyx) at the University of Rome Tor Vergata.

@kezhuw kezhuw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good! Thank you!

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.

2 participants