bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-tar] checkpointing details


From: Denis Excoffier
Subject: [Bug-tar] checkpointing details
Date: Sat, 29 Nov 2014 00:03:43 +0100

Hello,

I'm wondering whether we could modify checkpointing a little bit.

Here is the motivation. In the following i use the 'foo' file,
containing 1024000 bytes, to create the 'x.tar' file with a simple
tar command. I use tar-1.28.

/usr/local/bin/tar-1.28 cf x.tar foo --checkpoint=10 
"--checkpoint-action=echo=%T (#%u)"
currently produces:
/usr/local/bin/tar-1.28: W: 92160 (90KiB, 53MiB/s) (#10)
/usr/local/bin/tar-1.28: W: 194560 (190KiB, 104MiB/s) (#20)
/usr/local/bin/tar-1.28: W: 296960 (290KiB, 150MiB/s) (#30)
/usr/local/bin/tar-1.28: W: 399360 (390KiB, 189MiB/s) (#40)
/usr/local/bin/tar-1.28: W: 501760 (490KiB, 222MiB/s) (#50)
/usr/local/bin/tar-1.28: W: 604160 (590KiB, 251MiB/s) (#60)
/usr/local/bin/tar-1.28: W: 706560 (690KiB, 281MiB/s) (#70)
/usr/local/bin/tar-1.28: W: 808960 (790KiB, 308MiB/s) (#80)
/usr/local/bin/tar-1.28: W: 911360 (890KiB, 329MiB/s) (#90)
/usr/local/bin/tar-1.28: W: 1013760 (990KiB, 352MiB/s) (#100)

It can be noted that although the checkpoint numbers (%u) are
multiples of the first one (10), the number of bytes (%T) are not.
Instead, those numbers are completely unrecognizable (to me).

This is a pity but it is in full accordance with the documentation:
checkpoints shall be displayed _before_ each Nth record, and %T
is the number of bytes read/written so far.

Instead, I would be more enclined to get, for the same command:
/usr/local/bin/tar-1.28: W: 102400 (100KiB, 70MiB/s) (#10)
/usr/local/bin/tar-1.28: W: 204800 (200KiB, 127MiB/s) (#20)
/usr/local/bin/tar-1.28: W: 307200 (300KiB, 178MiB/s) (#30)
/usr/local/bin/tar-1.28: W: 409600 (400KiB, 222MiB/s) (#40)
/usr/local/bin/tar-1.28: W: 512000 (500KiB, 262MiB/s) (#50)
/usr/local/bin/tar-1.28: W: 614400 (600KiB, 295MiB/s) (#60)
/usr/local/bin/tar-1.28: W: 716800 (700KiB, 329MiB/s) (#70)
/usr/local/bin/tar-1.28: W: 819200 (800KiB, 359MiB/s) (#80)
/usr/local/bin/tar-1.28: W: 921600 (900KiB, 387MiB/s) (#90)
/usr/local/bin/tar-1.28: W: 1024000 (1000KiB, 411MiB/s) (#100)

This means that the checkpoints would be displayed _after_
each Nth record, with %T still being the number of bytes
read/written so far.

The following small patch does more or less this:
-------------------------------------
diff -uNr tar-1.28.original/src/checkpoint.c tar-1.28.patched/src/checkpoint.c
--- tar-1.28.original/src/checkpoint.c  2014-07-22 02:28:50.000000000 +0200
+++ tar-1.28.patched/src/checkpoint.c   2014-11-28 22:49:59.000000000 +0100
@@ -422,8 +422,9 @@
 void
 checkpoint_run (bool do_write)
 {
-  if (checkpoint_option && !(++checkpoint % checkpoint_option))
+  if (checkpoint_option && checkpoint && !(checkpoint % checkpoint_option))
     run_checkpoint_actions (do_write);
+  ++checkpoint;
 }
 
 void
--------------------------------------

Here:
- checkpoints are displayed _before_ each record number that is 1 mod N,
- checkpoint number = record number - 1
- there is no checkpoint before record 1 (no need for a checkpoint when tarfile 
is small)

The unexpected thing is that the last checkpoint (#100) is displayed although
there is no record 101. It has to be investigated whether such (favourable)
circumstances still occur when the number of bytes is not a multiple of
N times the record size.

Hoping this goes in the right direction,

Denis Excoffier.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]