atomic hard-link creation for XADisk

42 views
Skip to first unread message

g.za...@googlemail.com

unread,
Jan 29, 2013, 11:49:23 AM1/29/13
to xad...@googlegroups.com
Hi,

  XADisk looks like a very promising library for atomic file system transactions. Better than Apache Transactions in any case.

We are using directories with many file already and copy large parts of one directory to the next to archive the state.
To save disk space we use hard links (Java code example below) when copying.
I understand that XADisk allows to create safe-points and restore state to them later - the same we crudely can do by copying the directories back.
So we might not need the hard-linked directories at all.
But the hard-linked directories provide the additional benefit of being easily inspectable on disk for maintenance. 

So my real question is this:

**Would it be difficult to extend XADisk with atomic hard-link creation?**

I tried to understand how e.g. copy() works, but got lost in writing change records to journal streams deep in the internals. 
But it should be easy to do this atomically as hard-linking requires no data IO and the OS call is already atomic I believe.

What do you think?

Gunnar

hard-link code example:
if (Misc.isLinux()) {
LinuxFunctions.hardlink(src, dest);
return;
} else if (Misc.isWindows()) {
WindowsFunctions.hardlink(src, dest);
return;
}
throw ...

where

 public static void hardlink(final File src, final File dest) throws IOException { 
if (LibC.LIBC.link(src.toString(), dest.toString()) != 0) {
throw ...
}

and using JNA for libc (and Win Kernel32) calls.

Nitin Verma

unread,
Feb 7, 2013, 8:32:27 AM2/7/13
to XADisk
Hi Gunnar,

Thanks for your suggestion. I too agree that it would be useful to
have methods for creating soft-links and hard-links in xadisk. I have
created a tracking issue at http://java.net/jira/browse/XADISK-130

Thanks,
Nitin
Reply all
Reply to author
Forward
0 new messages