When (the first version of) this check was added 10 years ago in
b4b4ef116880, it was presumably to ensure that "index; save; touch;
index" in the same second would flag a file as needing saving.
Since then, tmax has been added in the indexing process to solve the
problem by capping timestamps stored in the index. This capping means
that a file with ctime in the same second as an indexing start will
be picked up on both the indexes in the example above - there's no need
to special case the check.
Signed-off-by: Aidan Hobson Sayers <aidanhs@cantab.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
log('pack error: %s (%r)\n' % (e, self))
raise
log('pack error: %s (%r)\n' % (e, self))
raise
- def stale(self, st, tstart, check_device=True):
+ def stale(self, st, check_device=True):
if self.size != st.st_size:
return True
if self.mtime != st.st_mtime:
if self.size != st.st_size:
return True
if self.mtime != st.st_mtime:
return True
if check_device and (self.dev != st.st_dev):
return True
return True
if check_device and (self.dev != st.st_dev):
return True
- # Check that the ctime's "second" is at or after tstart's.
- ctime_sec_in_ns = xstat.fstime_floor_secs(st.st_ctime) * 10**9
- if ctime_sec_in_ns >= tstart:
- return True
return False
def update_from_stat(self, st, meta_ofs):
return False
def update_from_stat(self, st, meta_ofs):
def update_index(top, excluded_paths, exclude_rxs, xdev_exceptions, out=None):
def update_index(top, excluded_paths, exclude_rxs, xdev_exceptions, out=None):
- # tmax and start must be epoch nanoseconds.
+ # tmax must be epoch nanoseconds.
tmax = (time.time() - 1) * 10**9
ri = index.Reader(indexfile)
msw = index.MetaStoreWriter(indexfile + b'.meta')
wi = index.Writer(indexfile, msw, tmax)
rig = IterHelper(ri.iter(name=top))
tmax = (time.time() - 1) * 10**9
ri = index.Reader(indexfile)
msw = index.MetaStoreWriter(indexfile + b'.meta')
wi = index.Writer(indexfile, msw, tmax)
rig = IterHelper(ri.iter(name=top))
- tstart = int(time.time()) * 10**9
hlinks = hlinkdb.HLinkDB(indexfile + b'.hlink')
hlinks = hlinkdb.HLinkDB(indexfile + b'.hlink')
if rig.cur and rig.cur.name == path: # paths that already existed
need_repack = False
if rig.cur and rig.cur.name == path: # paths that already existed
need_repack = False
- if(rig.cur.stale(pst, tstart, check_device=opt.check_device)):
+ if(rig.cur.stale(pst, check_device=opt.check_device)):
try:
meta = metadata.from_path(path, statinfo=pst)
except (OSError, IOError) as e:
try:
meta = metadata.from_path(path, statinfo=pst)
except (OSError, IOError) as e: