HAMMER: recovering directory?

Matthew Dillon dillon at apollo.backplane.com
Mon Dec 14 08:00:34 PST 2009


:> Note, that you don't have to call "hammer synctid" youself, as every 30
:> seconds the
:> filesystem is synced to disk.
:
:Assuming you know the transaction id, but what if you dont know?
:
:Petr

    Well, 'undo -i' does a pretty good job figuring out what transaction
    ids are available.

    (the 'sync's are just for the demonstration below, without them the
    filesystem will have a 30-60 fine grained history anyway).

    Undo isn't perfect.  In particular undo needs to be enhanced to
    access the snapshot list (now that HAMMER has an ioctl to retrieve
    it) and to adjust its output for any transaction ids beyond the
    prune-min specification since only actual snapshot TIDs are valid
    after that point (due to pruning).

    Note that if you run this several times the undo will pick earlier
    incarnations of the directory 'fubar' as well as different states
    of the most recent incarnation.

    mkdir fubar
    echo > fubar/a
    sync; sleep 1
    undo -i fubar
    echo > fubar/b
    sync; sleep 1
    undo -i fubar
    echo > fubar/c
    sync; sleep 1
    undo -i fubar
    rm fubar/a
    sync; sleep 1
    undo -i fubar
    rm fubar/b
    sync; sleep 1
    undo -i fubar
    rm fubar/c
    sync; sleep 1
    undo -i fubar
    rmdir fubar
    sync; sleep 1
    undo -i fubar

	-----------------------------------------------------------

test28:/root/tt#     rmdir fubar
test28:/root/tt#     sync; sleep 1
test28:/root/tt#     undo -i fubar
fubar: ITERATE ENTIRE HISTORY
        0x0000000b8ab4adf0 14-Dec-2009 07:53:00
        0x0000000b8ab5aeb0 14-Dec-2009 07:53:01
        0x0000000b8ab5af50 14-Dec-2009 07:53:02
        0x0000000b8ab5afd0 14-Dec-2009 07:53:03
        0x0000000b8ab5b050 14-Dec-2009 07:53:04
        0x0000000b8ab5b0f0 14-Dec-2009 07:53:05
test28:/root/tt# ls fubar@@0x0000000b8ab4adf0
a
test28:/root/tt# ls fubar@@0x0000000b8ab5aeb0
a       b
test28:/root/tt# ls fubar@@0x0000000b8ab5af50
a       b       c
test28:/root/tt# ls fubar@@0x0000000b8ab5afd0
b       c
test28:/root/tt# ls fubar@@0x0000000b8ab5b050
c
test28:/root/tt# ls fubar@@0x0000000b8ab5b0f0
test28:/root/tt# 

					-Matt
					Matthew Dillon 
					<dillon at backplane.com>





More information about the Users mailing list