[ 
https://issues.apache.org/jira/browse/AMQ-4378?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13750217#comment-13750217
 ] 

Carl Harris commented on AMQ-4378:
----------------------------------


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
                
> Documentation on Shared File System Master Slave wrong or out of date
> ---------------------------------------------------------------------
>
>                 Key: AMQ-4378
>                 URL: https://issues.apache.org/jira/browse/AMQ-4378
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Documentation, Message Store
>    Affects Versions: 5.8.0
>         Environment: Linux
>            Reporter: John Liptak
>            Priority: Minor
>              Labels: documentation
>
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to