You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/usage.rst
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,8 +56,8 @@ Additional optional arguments:
56
56
than MAXSIZE except when individual input files exceed MAXSIZE (as
57
57
individual files are never split up between different tar files).
58
58
* ``--non-blocking`` Zstash will submit a Globus transfer and immediately create a subsequent tarball. That is, Zstash will not wait until the transfer completes to start creating a subsequent tarball. On machines where it takes more time to create a tarball than transfer it, each Globus transfer will have one file. On machines where it takes less time to create a tarball than transfer it, the first transfer will have one file, but the number of tarballs in subsequent transfers will grow finding dynamically the most optimal number of tarballs per transfer. NOTE: zstash is currently always non-blocking.
59
-
* ``--error-on-duplicate-tar`` Raise an error if a tar file with the same name already exists in the database. If this flag is set, zstash will exit if it sees a duplicate tar. If it is not set, zstash's behavior will depend on whether or not the --overwrite-duplicate-tar flag is set.
60
-
* ``--overwrite-duplicate-tars`` If a duplicate tar is encountered, overwrite the existing tar file with the new one (i.e., it will assume the latest tar is the correct one). If this flag is not set, zstash will permit multiple entries for the same tar in its database.
59
+
* ``--error-on-duplicate-tar`` FOR ADVANCED USERS ONLY: Raise an error if a tar file with the same name already exists in the database. If this flag is set, zstash will exit if it sees a duplicate tar. If it is not set, zstash's behavior will depend on whether or not the --overwrite-duplicate-tar flag is set.
60
+
* ``--overwrite-duplicate-tars`` FOR ADVANCED USERS ONLY: If a duplicate tar is encountered, overwrite the existing tar file with the new one (i.e., it will assume the latest tar is the correct one). If this flag is not set, zstash will permit multiple entries for the same tar in its database.
61
61
* ``-v`` increases output verbosity.
62
62
63
63
Local tar files as well as the sqlite3 index database (index.db) will be stored
@@ -155,7 +155,7 @@ where
155
155
an incomplete tar file, then the archive you're checking
156
156
must have been created using ``zstash >= v1.1.0``.
157
157
* ``--tars`` to specify specific tars to check. See below for example usage.
158
-
* ``--error-on-duplicate-tar`` Raise an error if a tar file with the same name already exists in the database. If this flag is set, zstash will exit if it sees a duplicate tar. If it is not set, zstash will check if the sizes and md5sums match *at least one* of the tars.
158
+
* ``--error-on-duplicate-tar`` FOR ADVANCED USERS ONLY: Raise an error if a tar file with the same name already exists in the database. If this flag is set, zstash will exit if it sees a duplicate tar. If it is not set, zstash will check if the size matches the *most recent* entry.
159
159
* ``-v`` increases output verbosity.
160
160
* ``[files]`` is a list of files to check (standard wildcards supported).
161
161
@@ -243,8 +243,8 @@ where
243
243
they have been extracted from the archive. Normally, they are deleted after
244
244
successful transfer.
245
245
* ``--non-blocking`` Zstash will submit a Globus transfer and immediately create a subsequent tarball. That is, Zstash will not wait until the transfer completes to start creating a subsequent tarball. On machines where it takes more time to create a tarball than transfer it, each Globus transfer will have one file. On machines where it takes less time to create a tarball than transfer it, the first transfer will have one file, but the number of tarballs in subsequent transfers will grow finding dynamically the most optimal number of tarballs per transfer. NOTE: zstash is currently always non-blocking.
246
-
* ``--error-on-duplicate-tar`` Raise an error if a tar file with the same name already exists in the database. If this flag is set, zstash will exit if it sees a duplicate tar. If it is not set, zstash's behavior will depend on whether or not the --overwrite-duplicate-tar flag is set.
247
-
* ``--overwrite-duplicate-tars`` If a duplicate tar is encountered, overwrite the existing tar file with the new one (i.e., it will assume the latest tar is the correct one). If this flag is not set, zstash will permit multiple entries for the same tar in its database.
246
+
* ``--error-on-duplicate-tar`` FOR ADVANCED USERS ONLY: Raise an error if a tar file with the same name already exists in the database. If this flag is set, zstash will exit if it sees a duplicate tar. If it is not set, zstash's behavior will depend on whether or not the --overwrite-duplicate-tar flag is set.
247
+
* ``--overwrite-duplicate-tars`` FOR ADVANCED USERS ONLY: If a duplicate tar is encountered, overwrite the existing tar file with the new one (i.e., it will assume the latest tar is the correct one). If this flag is not set, zstash will permit multiple entries for the same tar in its database.
248
248
* ``-v`` increases output verbosity.
249
249
250
250
Note: in the event that an update includes revisions to files previously archived, ``zstash update``
@@ -324,7 +324,7 @@ where
324
324
an incomplete tar file, then the archive you're extracting from
325
325
must have been created using ``zstash >= v1.1.0``.
326
326
* ``--tars`` to specify specific tars to extract. See "Check" above for example usage.
327
-
* ``--error-on-duplicate-tar`` Raise an error if a tar file with the same name already exists in the database. If this flag is set, zstash will exit if it sees a duplicate tar. If it is not set, zstash will check if the sizes and md5sums match *at least one* of the tars.
327
+
* ``--error-on-duplicate-tar`` FOR ADVANCED USERS ONLY: Raise an error if a tar file with the same name already exists in the database. If this flag is set, zstash will exit if it sees a duplicate tar. If it is not set, zstash will check if the size matches the *most recent* entry.
328
328
* ``-v`` increases output verbosity.
329
329
* ``[files]`` is a list of files to be extracted (standard wildcards supported).
Copy file name to clipboardExpand all lines: tests/scripts/database_corruption.bash
+49-7Lines changed: 49 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -60,6 +60,7 @@ run_test_cases()
60
60
# 5. `zstash create` with `--for-developers-force-database-corruption="simulate_row_existing"`. We simply add a duplicate tar, but `zstash check` with `--error-on-duplicate-tar` errors out because it finds two entries for the same tar.
61
61
# 6. `zstash create` with `--for-developers-force-database-corruption="simulate_no_correct_size"` to construct a very bad database: two entries for the same tar, both with incorrect sizes. `zstash check` confirms that no entries match the actual file size.
62
62
# 7. `zstash create` with `--for-developers-force-database-corruption="simulate_row_existing_bad_size"`. We add a duplicate tar, but with the wrong size. `zstash check` confirms that the other entry matches the actual file size, so it succeeds.
63
+
# 8. `zstash create` with `--for-developers-force-database-corruption="simulate_bad_size_for_most_recent"` to construct two entries for the same tar, the most recent of which has an incorrect size. `zstash check` fails because the most recent size does not match, but it does log that one of the entries matches the actual file size.
63
64
64
65
# Standard cases ##########################################################
65
66
@@ -201,7 +202,7 @@ run_test_cases()
201
202
fi
202
203
cd${src_prefix}_check
203
204
zstash check --hpss=${DST_DIR}/${case_name} --error-on-duplicate-tar 2>&1| tee check.log
204
-
grep "ERROR: Database corruption detected! Found 2 database entries for 000000.tar with sizes" check.log
205
+
grep "ERROR: Database corruption detected! Found 2 database entries for 000000.tar, with sizes" check.log
205
206
if [ $?!= 0 ];then
206
207
((fail_count++))
207
208
review_str+="${case_name}_check/check.log,"
@@ -225,17 +226,23 @@ run_test_cases()
225
226
fi
226
227
cd${src_prefix}_check
227
228
zstash check --hpss=${DST_DIR}/${case_name}2>&1| tee check.log
228
-
grep "INFO: 000000.tar: No database entries match the actual file size:" check.log
229
+
grep "WARNING: Database corruption detected! Found 2 database entries for 000000.tar, with sizes" check.log
229
230
if [ $?!= 0 ];then
230
231
((fail_count++))
231
232
review_str+="${case_name}_check/check.log,"
232
233
else
233
234
((success_count++))
234
235
fi
236
+
grep "INFO: 000000.tar: No database entry matches the actual file size:" check.log
237
+
if [ $?!= 0 ];then
238
+
((fail_count++))
239
+
else
240
+
((success_count++))
241
+
fi
235
242
236
243
237
-
# Case 7: Duplicates detected! Allow them. Pass check because at least one of the sizes match.
238
-
case_name="check_finds_a_matching_size"
244
+
# Case 7: Duplicates detected! Allow them. Pass check because the most recent size matches.
245
+
case_name="check_finds_most_recent_size_matches"
239
246
src_prefix=${SRC_DIR}/${case_name}
240
247
setup ${case_name}${src_prefix}
241
248
cd${src_prefix}_create
@@ -261,13 +268,48 @@ run_test_cases()
261
268
fi
262
269
cd${src_prefix}_check
263
270
zstash check --hpss=${DST_DIR}/${case_name}2>&1| tee check.log
264
-
grep "INFO: 000000.tar: Found a database entry with the same size as the actual file size:" check.log
271
+
grep "WARNING: Database corruption detected! Found 2 database entries for 000000.tar, with sizes" check.log
265
272
if [ $?!= 0 ];then
266
273
((fail_count++))
267
274
review_str+="${case_name}_check/check.log,"
268
275
else
269
276
((success_count++))
270
277
fi
278
+
grep "INFO: 000000.tar: The most recent database entry has the same size as the actual file size:" check.log
279
+
if [ $?!= 0 ];then
280
+
((fail_count++))
281
+
else
282
+
((success_count++))
283
+
fi
284
+
285
+
# Case 8: Duplicates detected! Allow them. Error out on check because the most recent size doesn't match.
help="Raise an error if a tar file with the same name already exists in the database. If this flag is set, zstash will exit if it sees a duplicate tar. If it is not set, zstash's behavior will depend on whether or not the --overwrite-duplicate-tar flag is set.",
172
+
help="FOR ADVANCED USERS ONLY: Raise an error if a tar file with the same name already exists in the database. If this flag is set, zstash will exit if it sees a duplicate tar. If it is not set, zstash's behavior will depend on whether or not the --overwrite-duplicate-tar flag is set.",
173
173
)
174
174
optional.add_argument(
175
175
"--overwrite-duplicate-tars",
176
176
action="store_true",
177
-
help="If a duplicate tar is encountered, overwrite the existing tar file with the new one (i.e., it will assume the latest tar is the correct one). If this flag is not set, zstash will permit multiple entries for the same tar in its database.",
177
+
help="FOR ADVANCED USERS ONLY: If a duplicate tar is encountered, overwrite the existing tar file with the new one (i.e., it will assume the latest tar is the correct one). If this flag is not set, zstash will permit multiple entries for the same tar in its database.",
178
178
)
179
179
optional.add_argument(
180
180
"--for-developers-force-database-corruption",
181
181
type=str,
182
-
help="For developers only! Forces database corruption by inserting a duplicate tar entry into the tars table. This is useful for testing. 3 options: simulate_row_existing -- add the tar before the main logic. simulate_row_existing_bad_size -- add the tar before the main logic, but with the wrong size. simulate_no_correct_size -- add the tar twice, both times with incorrect size. If this option is not set, no corruption will be forced.",
182
+
help="FOR DEVELOPERS ONLY! Forces database corruption by inserting a duplicate tar entry into the tars table. This is useful for testing. 3 options: simulate_row_existing -- add the tar before the main logic. simulate_row_existing_bad_size -- add the tar before the main logic, but with the wrong size. simulate_no_correct_size -- add the tar twice, both times with incorrect size. If this option is not set, no corruption will be forced. simulate_bad_size_for_most_recent -- add the tar twice, first with good size, then with bad size.",
183
183
default="",
184
184
)
185
185
# Now that we're inside a subcommand, ignore the first two argvs
help="Raise an error if a tar file with the same name already exists in the database. If this flag is set, zstash will exit if it sees a duplicate tar. If it is not set, zstash will check if the sizes and md5sums match *at least one* of the tars.",
107
+
help="FOR ADVANCED USERS ONLY: Raise an error if a tar file with the same name already exists in the database. If this flag is set, zstash will exit if it sees a duplicate tar. If it is not set, zstash will check if the size matches the *most recent* entry.",
help="Raise an error if a tar file with the same name already exists in the database. If this flag is set, zstash will exit if it sees a duplicate tar. If it is not set, zstash's behavior will depend on whether or not the --overwrite-duplicate-tar flag is set.",
111
+
help="FOR ADVANCED USERS ONLY: Raise an error if a tar file with the same name already exists in the database. If this flag is set, zstash will exit if it sees a duplicate tar. If it is not set, zstash's behavior will depend on whether or not the --overwrite-duplicate-tar flag is set.",
112
112
)
113
113
optional.add_argument(
114
114
"--overwrite-duplicate-tars",
115
115
action="store_true",
116
-
help="If a duplicate tar is encountered, overwrite the existing tar file with the new one (i.e., it will assume the latest tar is the correct one). If this flag is not set, zstash will permit multiple entries for the same tar in its database.",
116
+
help="FOR ADVANCED USERS ONLY: If a duplicate tar is encountered, overwrite the existing tar file with the new one (i.e., it will assume the latest tar is the correct one). If this flag is not set, zstash will permit multiple entries for the same tar in its database.",
0 commit comments