[tahoe-dev] expiration of shares that never had a lease?

Brian Warner warner at lothar.com
Thu Feb 24 18:52:55 UTC 2011


On 2/24/11 5:37 AM, Greg Troxel wrote:
> 
> I'm not entirely clear on the 'tahoe debug catalog-shares' output, but
> it seems that field 6 is the remaining lease duration. On a pubgrid
> server, I find that about half the shares have 0 in this field, and
> the files are quite old.

Yup, that field is the minimum of all remaining lease durations, in
seconds, but it's set to 0 if that minimum is negative
(src/allmydata/scripts/debug.py L623):

        expiration_time = min( [lease.expiration_time
                                for lease in sf.get_leases()] )
        expiration = max(0, expiration_time - now)

> So can shares be created without a lease? (Perhaps, on a server that
> didn't have expiration enabled?)

No, that code doesn't actually tolerate zero-lease shares (I should have
used min([leases]+[0]) to avoid a crash if there were no leases at all).
So I think you're seeing old shares that can be expired by the lease
crawler.

Note: the way we store lease times is kinda wonky; I didn't think it
through very well early on, especially with respect to the lease
crawler. Leases are updated by creating a new share, calling
remote_add_lease, or calling remote_renew_lease, none of which take any
sort of "what duration of lease would you like?" argument. The server
sets the expiration time to exactly 31 days in the future, and writes
the expiration time (as seconds-since-epoch) into the share's lease
record.

So it's straightforward to delete leases that have expired, and then
delete shares with no leases. But it's hard to do things like expire
leases after 60 days instead of 31, or expire shares that haven't been
renewed since Jan-01, because the shares don't store the renewal date,
just the fixed pre-calculated expiration date.

I wouldn't be surprised if there are some bugs in the lease-crawler's
expiration routines because of this, either in the display of what it's
doing, planning to do, or in the actual expiration choicess.

cheers,
 -Brian



More information about the tahoe-dev mailing list