Higher resolution for status change times on Unix, and coarser test for 1-second-resolution filesystems

pmeunier
Dec 7, 2021, 9:33 PM
Q6MRVSJXQXHRKY5TWJL742RUQNJPRT32QSPJJORZ2IA6KJ4O2UBAC

Dependencies

  • [2] KGN7KVLA Formatting
  • [3] LODKR74E Changing touched_channel resolution to milliseconds instead of seconds
  • [4] F6V27C3M Fixing the "old file optimisation" in record, after the move to parallelisable records
  • [5] EUZFFJSO Updating Pijul with the latest changes in Libpijul
  • [6] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [7] 3ZAS64J6 Solving conflicts
  • [8] 34Q5U4HL Updating the channel touched time after a clone
  • [9] QU6T6J6W Use the change time in addition to the modified time when detecting untouched files (at least on Unix)
  • [10] GHO6DWPI Refactoring iterators
  • [11] MFTN7GBW Pre-tags cleanup + fast Sanakirja
  • [12] I24UEJQL Various post-fire fixes
  • [13] YN63NUZO Sanakirja 1.0

Change contents

  • replacement in pijul/src/commands/record.rs at line 190
    [4.2172][4.6077:6154]()
    txn_.touch_channel(&mut *channel.write(), Some(oldest));
    [4.2172]
    [4.681]
    txn_.touch_channel(&mut *channel.write(), Some((oldest / 1000) * 1000));
  • replacement in pijul/src/commands/clone.rs at line 116
    [4.176][3.96:129]()
    .as_millis() as u64;
    [4.176]
    [4.207]
    .as_secs() as u64;
  • replacement in pijul/src/commands/clone.rs at line 118
    [4.227][4.227:294]()
    .touch_channel(&mut *channel.write(), Some(time + 1));
    [4.227]
    [4.294]
    .touch_channel(&mut *channel.write(), Some(time * 1000 + 1));
  • replacement in libpijul/src/working_copy/filesystem.rs at line 357
    [2.20][2.20:121]()
    std::time::SystemTime::UNIX_EPOCH + std::time::Duration::from_secs(attr.ctime() as u64);
    [2.20]
    [4.383]
    std::time::SystemTime::UNIX_EPOCH + std::time::Duration::from_millis(attr.ctime() as u64 * 1000 + attr.ctime_nsec() as u64 / 1_000_000);
  • replacement in libpijul/src/record.rs at line 721
    [4.56608][4.56608:56633](),[4.56633][3.161:285]()
    Ok(last_modified
    .duration_since(std::time::UNIX_EPOCH)?
    .as_millis() as u64
    >= txn.last_modified(channel))
    [4.56608]
    [4.56751]
    // Account for low-resolution filesystems, by truncating the
    // channel modification time if the file modification time is
    // a multiple of 1000.
    let last_mod = last_modified
    .duration_since(std::time::UNIX_EPOCH)?
    .as_millis() as u64;
    let channel_mod = if last_mod % 1000 == 0 {
    (txn.last_modified(channel) / 1000) * 1000
    } else {
    txn.last_modified(channel)
    };
    Ok(last_mod >= channel_mod)
  • replacement in libpijul/src/pristine/sanakirja.rs at line 1604
    [4.47984][3.286:350]()
    channel.last_modified = duration.as_millis() as u64
    [4.47984]
    [4.48039]
    channel.last_modified = (duration.as_millis() as u64 / 1000) * 1000