[Gluster-devel] best practice to ensure data integrity at a concurrent

Dongmin Yu min at hostway.co.kr
Wed Feb 17 12:05:00 UTC 2010


Hello,

I'm trying to store additional metadata like content-type and etc at extended attribute.

My client code are like

fd = glusterfs_open( path );
glusterfs_write( fd, data, data_length );
glusterfs_close( fd );       //------
glusterfs_setxattr( path, attr_name, attr_value, value_length,0 );

My concern is that above client code runs on multiple machines and multi-threaded.
In higher concurrency, client A could write content, client B write content, client B write its attribute then client A write its attribute.
So to speak, file content comes from client B but attribute comes from client A.

If I use a lock server, I can guarantee data integrity. But is there a simpler way to store extended attributes at an atomic environment?
I see another function, glusterfs_fsetxattr which accepts open glusterfs_file descriptor. If I rewrite as following, can I guarantee the integrity?

fd = glusterfs_open( path );
glusterfs_write( fd, data, data_length );
glusterfs_fsetxattr( fd, attr_name, attr_value, value_length,0 );
glusterfs_close( fd );


Thanks

DongMin Yu

HOSTWAY IDC Corp. / R&D Principal Researcher
TEL. +822 2105 6037
FAX. +822 2105 6019
CELL. +8216 2086 1357
EMAIL: min.yu at hostwaycorp.com<mailto:min.yu at hostwaycorp.com>
Website: http://www.hostway.com

NOTICE:  This email and any file transmitted are confidential and/or legally privileged and intended only for the person(s) directly addressed.  If you are not the intended recipient, any use, copying, transmission, distribution, or other forms of dissemination is strictly prohibited.  If you have received this email in error, please notify the sender immediately and permanently delete the email and files, if any.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://supercolony.gluster.org/pipermail/gluster-devel/attachments/20100217/457ae66e/attachment-0003.html>


More information about the Gluster-devel mailing list