Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-9113

Make it easier to use CollectionStateWatchers

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.1
    • Component/s: None
    • Labels:
      None

      Description

      SOLR-8323 adds the notion of a CollectionStateWatcher to ZkStateReader, but it's not actually that easy to use - you need to remember to re-register it if necessary, and it can fire immediately if it's the first watcher to be registered on a collection.

      1. SOLR-9113.patch
        9 kB
        Alan Woodward
      2. SOLR-9113.patch
        5 kB
        Alan Woodward

        Activity

        Hide
        romseygeek Alan Woodward added a comment -

        Patch with proposed API change. CollectionStateWatcher.onStateChange() now returns a boolean - true if the watcher doesn't need to be re-registered, false otherwise.

        This also fixes the flaky testSimpleCollectionWatch() test.

        Show
        romseygeek Alan Woodward added a comment - Patch with proposed API change. CollectionStateWatcher.onStateChange() now returns a boolean - true if the watcher doesn't need to be re-registered, false otherwise. This also fixes the flaky testSimpleCollectionWatch() test.
        Hide
        romseygeek Alan Woodward added a comment -

        Better patch, with some more tests.

        Show
        romseygeek Alan Woodward added a comment - Better patch, with some more tests.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 2b9cbe97a880de246292e61ca8f06feb3f984008 in lucene-solr's branch refs/heads/master from Alan Woodward
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=2b9cbe9 ]

        SOLR-9113: Improve state watcher API

        Show
        jira-bot ASF subversion and git services added a comment - Commit 2b9cbe97a880de246292e61ca8f06feb3f984008 in lucene-solr's branch refs/heads/master from Alan Woodward [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=2b9cbe9 ] SOLR-9113 : Improve state watcher API
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 8de89081e6def8239c2a9678ca4eea9f5b8ca8db in lucene-solr's branch refs/heads/branch_6x from Alan Woodward
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=8de8908 ]

        SOLR-9113: Improve state watcher API

        Show
        jira-bot ASF subversion and git services added a comment - Commit 8de89081e6def8239c2a9678ca4eea9f5b8ca8db in lucene-solr's branch refs/heads/branch_6x from Alan Woodward [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=8de8908 ] SOLR-9113 : Improve state watcher API
        Hide
        romseygeek Alan Woodward added a comment -
        Show
        romseygeek Alan Woodward added a comment - Seeing some test failures: http://jenkins.thetaphi.de/job/Lucene-Solr-6.x-Linux/686/
        Hide
        romseygeek Alan Woodward added a comment -

        Test failures are due to a race between a watcher being removed, and then being re-added. This a genuine bug, as it's possible that a second notification could be triggered between the watchers being cleared by a previous notification, and the watchers adding themselves again, which would lead to notifications being missed.

        I'll switch the logic around, so that watchers are not removed by default, rather only if they return 'true' at notification time.

        Show
        romseygeek Alan Woodward added a comment - Test failures are due to a race between a watcher being removed, and then being re-added. This a genuine bug, as it's possible that a second notification could be triggered between the watchers being cleared by a previous notification, and the watchers adding themselves again, which would lead to notifications being missed. I'll switch the logic around, so that watchers are not removed by default, rather only if they return 'true' at notification time.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 6113e1f2fabf6668b4bdbd7640af45bebcc2e505 in lucene-solr's branch refs/heads/master from Alan Woodward
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=6113e1f ]

        SOLR-9113: Fix re-registration race

        Show
        jira-bot ASF subversion and git services added a comment - Commit 6113e1f2fabf6668b4bdbd7640af45bebcc2e505 in lucene-solr's branch refs/heads/master from Alan Woodward [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=6113e1f ] SOLR-9113 : Fix re-registration race
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 8db3c73375d5cf6e9b6973cc576163ca9a2773c5 in lucene-solr's branch refs/heads/branch_6x from Alan Woodward
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=8db3c73 ]

        SOLR-9113: Fix re-registration race

        Show
        jira-bot ASF subversion and git services added a comment - Commit 8db3c73375d5cf6e9b6973cc576163ca9a2773c5 in lucene-solr's branch refs/heads/branch_6x from Alan Woodward [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=8db3c73 ] SOLR-9113 : Fix re-registration race
        Hide
        dragonsinth Scott Blum added a comment -

        Fixes seem good to me! I like the direction this went.

        Show
        dragonsinth Scott Blum added a comment - Fixes seem good to me! I like the direction this went.

          People

          • Assignee:
            romseygeek Alan Woodward
            Reporter:
            romseygeek Alan Woodward
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development