ActiveMQ
  1. ActiveMQ
  2. AMQ-4378

Documentation on Shared File System Master Slave wrong or out of date

    Details

      Description

      The documentation at http://activemq.apache.org/shared-file-system-master-slave.html says that OCFS2 does not work, saying

      "OCFS2 only supports locking with 'fcntl' and not 'lockf and flock', therefore mutex file locking from Java isn't supported."

      However, based on my reading of the OpenJDK source, Java uses fcntl, not flock and this statement is incorrect.

        Activity

        Hide
        Gary Tully added a comment -

        If you have OCFS2 handy the only way to know for sure is to "ask the computer". Start two broker instances and see if they both think they are masters. I don't know history of that section of the doc, but I assume it was added in good faith based on a real test.
        would be great to know we can work with OCFS2

        Show
        Gary Tully added a comment - If you have OCFS2 handy the only way to know for sure is to "ask the computer". Start two broker instances and see if they both think they are masters. I don't know history of that section of the doc, but I assume it was added in good faith based on a real test. would be great to know we can work with OCFS2
        Hide
        Timothy Bish added a comment -

        No feedback from the submitter to validate these assertions.

        Show
        Timothy Bish added a comment - No feedback from the submitter to validate these assertions.
        Hide
        Carl Harris added a comment -

        I just ran into this issue and since the original submitter has not provided feedback, I decided to post my findings.

        The cited documentation is at least somewhat incorrect, in that OCFS2 lock support is not quite as cut and dried as the documentation suggests. Moreover, the documentation makes incorrect references to the supported lock types for OCFS2.

        Reference [1], Section III (New Features) item 10 (Clustered flock(2)) on page 12, states that "the flock(2) call is now cluster-aware." It notes further that "Support for clustered POSIX file locks, also known as lockf(3) or fcntl(2), has not yet been added."

        The documentation cited in this issue should therefore be written as "OCFS2 only supports locking with 'flock' and not 'lockf' nor 'fcntl' [...]".

        Internally, it appears that Java uses lockf/fcntl or (on some UNIX platforms in some circumstances) mmap/futex to implement locks. Either of these mechanisms are effectively POSIX locks, and would not be supported on OCFS2 according to [1].

        That said, reference [2] in a section entitled "Cluster aware POSIX file locks" states that POSIX lockf/fctrl is supported by OCFS2 as of Linux Kernel 2.6.28, but that "Due to the group communication required to make these locks coherent, a userspace cluster is required."

        I'm not sure what a "userspace cluster" is, but apparently the default O2CB cluster stack used on my system is a "kernel cluster" and thus does not support POSIX locks. That said, I think if I had a userspace cluster, ActiveMQ's shared file system master/slave would be supported.

        I wrote a C program to test all of the various lock types on my configuration, along with a simple Java program that uses a FileLock obtained from a FileChannel. Others might find this useful in testing their configurations. You can get the source from [3].

        [1] http://oss.oracle.com/projects/ocfs2/dist/documentation/v1.4/ocfs2-1_4-usersguide.pdf
        [2] https://oss.oracle.com/osswiki/OCFS2/NewFeaturesList.html
        [3] https://github.com/ceharris/ocfs2-lock-validation

        Show
        Carl Harris added a comment - I just ran into this issue and since the original submitter has not provided feedback, I decided to post my findings. The cited documentation is at least somewhat incorrect, in that OCFS2 lock support is not quite as cut and dried as the documentation suggests. Moreover, the documentation makes incorrect references to the supported lock types for OCFS2. Reference [1] , Section III (New Features) item 10 (Clustered flock(2)) on page 12, states that "the flock(2) call is now cluster-aware." It notes further that "Support for clustered POSIX file locks, also known as lockf(3) or fcntl(2), has not yet been added." The documentation cited in this issue should therefore be written as "OCFS2 only supports locking with 'flock' and not 'lockf' nor 'fcntl' [...] ". Internally, it appears that Java uses lockf/fcntl or (on some UNIX platforms in some circumstances) mmap/futex to implement locks. Either of these mechanisms are effectively POSIX locks, and would not be supported on OCFS2 according to [1] . That said, reference [2] in a section entitled "Cluster aware POSIX file locks" states that POSIX lockf/fctrl is supported by OCFS2 as of Linux Kernel 2.6.28, but that "Due to the group communication required to make these locks coherent, a userspace cluster is required." I'm not sure what a "userspace cluster" is, but apparently the default O2CB cluster stack used on my system is a "kernel cluster" and thus does not support POSIX locks. That said, I think if I had a userspace cluster, ActiveMQ's shared file system master/slave would be supported. I wrote a C program to test all of the various lock types on my configuration, along with a simple Java program that uses a FileLock obtained from a FileChannel. Others might find this useful in testing their configurations. You can get the source from [3] . [1] http://oss.oracle.com/projects/ocfs2/dist/documentation/v1.4/ocfs2-1_4-usersguide.pdf [2] https://oss.oracle.com/osswiki/OCFS2/NewFeaturesList.html [3] https://github.com/ceharris/ocfs2-lock-validation
        Hide
        Christian Posta added a comment -

        Awesome, Carl. Thanks for your investigation. I've added a link to this JIRA from the wiki.

        Show
        Christian Posta added a comment - Awesome, Carl. Thanks for your investigation. I've added a link to this JIRA from the wiki.

          People

          • Assignee:
            Unassigned
            Reporter:
            John Liptak
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development