Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d9442c12d |
No files matched your search
@@ -369,8 +369,8 @@ default. An operand may be a directory or a regular file.
|
|||||||
deleted.
|
deleted.
|
||||||
- An operand that is neither a regular file nor a directory is not scanned.
|
- An operand that is neither a regular file nor a directory is not scanned.
|
||||||
`scan` prints a warning naming the path and what it is. It counts the operand
|
`scan` prints a warning naming the path and what it is. It counts the operand
|
||||||
as skipped and drops it. An operand beneath a dropped one is scanned all the
|
as skipped and drops it. An operand beneath a symlink operand is scanned all
|
||||||
same. The scan keeps the records beneath a dropped operand, unless another
|
the same. The scan keeps the records beneath a dropped operand, unless another
|
||||||
operand covers them.
|
operand covers them.
|
||||||
- An operand at or inside a directory named `.zfs` is never scanned, whether
|
- An operand at or inside a directory named `.zfs` is never scanned, whether
|
||||||
given alone or under another operand. The check looks at the path as given and
|
given alone or under another operand. The check looks at the path as given and
|
||||||
@@ -724,8 +724,8 @@ Two limitations are accepted:
|
|||||||
They share storage, so removing one frees nothing. The scan uses the inode to
|
They share storage, so removing one frees nothing. The scan uses the inode to
|
||||||
avoid reading a file twice, and does not store it.
|
avoid reading a file twice, and does not store it.
|
||||||
- Only the regular files in the database define a tree. Empty directories are
|
- Only the regular files in the database define a tree. Empty directories are
|
||||||
invisible. A file skipped during the scan in one copy but not in the other
|
invisible. When the scan skips a file in one copy but not in the other, the
|
||||||
makes two otherwise identical trees differ.
|
two trees differ.
|
||||||
|
|
||||||
`trees` has four phases, each with its own progress display on stderr (see
|
`trees` has four phases, each with its own progress display on stderr (see
|
||||||
"Progress"). `open` opens the database. `read` counts the records, then reads
|
"Progress"). `open` opens the database. `read` counts the records, then reads
|
||||||
@@ -836,7 +836,7 @@ the error for a missing database comes after it.
|
|||||||
|
|
||||||
#### The scan lock
|
#### The scan lock
|
||||||
|
|
||||||
Only one `scan` runs against a database at a time.
|
Only one `scan` at a time can hold the lock.
|
||||||
|
|
||||||
- For its whole run, `scan` holds a lock on a lock file beside the database. The
|
- For its whole run, `scan` holds a lock on a lock file beside the database. The
|
||||||
lock is taken with the `flock(2)` system call, and only one process can hold
|
lock is taken with the `flock(2)` system call, and only one process can hold
|
||||||
@@ -847,7 +847,7 @@ Only one `scan` runs against a database at a time.
|
|||||||
Just before that, it creates the database file, empty, if it is missing. So
|
Just before that, it creates the database file, empty, if it is missing. So
|
||||||
the lock file is named the same way before the first scan as after. A symlink
|
the lock file is named the same way before the first scan as after. A symlink
|
||||||
at the database path is followed, and its target is created.
|
at the database path is followed, and its target is created.
|
||||||
- A second `scan` against the same database does not wait. It fails at once with
|
- A second `scan` that finds the lock held does not wait. It fails at once with
|
||||||
an error naming the lock file, and exits 1. It has walked nothing and has not
|
an error naming the lock file, and exits 1. It has walked nothing and has not
|
||||||
opened the database. The running scan carries on.
|
opened the database. The running scan carries on.
|
||||||
- The lock file is created on first use and never deleted. Only its owner may
|
- The lock file is created on first use and never deleted. Only its owner may
|
||||||
|
|||||||
+2
-3
@@ -1279,9 +1279,8 @@ func holdScanLock(t *testing.T, path string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRunSecondScanFails(t *testing.T) {
|
func TestRunSecondScanFails(t *testing.T) {
|
||||||
// README §Database: while one scan holds the lock, a second scan
|
// README §Database: a second scan that finds the lock held fails
|
||||||
// fails at once, naming the lock file, without opening the
|
// at once, naming the lock file, without opening the database.
|
||||||
// database.
|
|
||||||
path := testDBPath(t)
|
path := testDBPath(t)
|
||||||
t.Setenv(databaseEnv, path)
|
t.Setenv(databaseEnv, path)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user