Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-1329

Lock recipe sorts sequenced children incorrectly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.3.3
    • None
    • recipes
    • None
    • Mac OS X Version 10.6.8
      Darwin emcclure-lt-mac.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386
      Homebrew 0.8

    Description

      The lock recipe sorts sequenced children lexicographically. When the sequence number wraps, a lexicographical comparison will always place 2147483648 ahead of -2147483649, place -2147483648 ahead of -2147483649, and place -1 ahead of -2. Clearly, we want 2147483648 < -2147483649, -2147483649 < -2147483648, and -2 placed ahead of -1, since those sequence numbers were generated in that order.

      I suggest that the sequence numbers be converted to unsigned numbers before being compared in the comparison functor that gets passed to qsort().

      This leaves us with another issue. When comparing unsigned sequence numbers, there is a slim chance that 4294967296 < 0. So, I suggest that a fudge range be used, say, the number of nodes in the quorum * some fudge factor, in order to handle this comparison.

      Please close this if I'm way off base here.

      Attachments

        Activity

          People

            Unassigned Unassigned
            evanmcclure Evan McClure
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: