Commit Graph

1459 Commits

Author SHA1 Message Date
Julio López
dddee8a5ec Trivial: Rename local_fs_output_unix.go => local_fs_output_darwin.go (#684) 2020-10-15 13:34:51 -07:00
Erkki Seppälä
6a93e4d5b9 Added support for scanning only one filesystem via files policy (#676)
The new files policy oneFileSystem ignores files that are mounted to
other filesystems similarly to tar's --one-file-system switch. For
example, if this is enabled, backing up / should now automatically
ignore /dev, /proc, etc, so the directory entries themselves don't
appear in the backup. The value of the policy is 'false' by default.

This is implemented by adding a non-windows-field Device (of type
DeviceInfo, reflecting the implementation of Owner) to the Entry
interface. DeviceInfo holds the dev and rdev acquired with stat (same
way as with Owner), but in addition to that it also holds the same
values for the parent directory. It would seem that doing this in some
other way, ie. in ReadDir, would require modifying the ReadDir
interface which seems a too large modification for a feature this
small.

This change introduces a duplication of 'stat' call to the files, as
the Owner feature already does a separate call. I doubt the
performance implications are noticeable, though with some refactoring
both Owner and Device fields could be filled in in one go.

Filling in the field has been placed in fs/localfs/localfs.go where
entryFromChildFileInfo has acquired a third parameter giving the the
parent entry. From that information the Device of the parent is
retrieved, to be passed off to platformSpecificDeviceInfo which does
the rest of the paperwork. Other fs implementations just put in the
default values.

The Dev and Rdev fields returned by the 'stat' call have different
sizes on different platforms, but for convenience they are internally
handled the same. The conversion is done with local_fs_32bit.go and
local_fs_64bit.go which are conditionally compiled on different
platforms.

Finally the actual check of the condition is in ignorefs.go function
shouldIncludeByDevice which is analoguous to the other similarly named
functions.

Co-authored-by: Erkki Seppälä <flux@inside.org>
2020-10-14 22:45:32 -07:00
Jarek Kowalski
c3ade4b0ea b2: added exponential back-off around PutBlob() and DeleteBlob() (#679) v0.7.3 2020-10-11 12:04:58 -07:00
Jarek Kowalski
170bdeb944 cli: improved restore progress information (#678)
Demo: https://asciinema.org/a/8RV8SwBVt2CI0HSsklYwO8FhP
2020-10-11 11:56:46 -07:00
Jarek Kowalski
7d21eaa6c1 Cleanup old RPM and DEB packages from 'unstable' repositories (#677)
* tools: cleanup old RPM packages in the 'unstable' track automatically

* tools: remove old DEB automatically from the 'unstable' channel
2020-10-10 14:43:32 -07:00
Jarek Kowalski
4d7f0cb6cd Fixed symlink restore behavior on macOS (#673)
* restore: use symlink-specific APIs instead of chmod, chown and chtimes

* upload: fix updating directory modtime for symlinks

* cli: plumbed through flags to restore to control new behaviors

* localfs: use Lstat() instead of Stat() in Child() method

* testing: added restore tests for new flags
2020-10-10 11:03:35 -07:00
Jarek Kowalski
9d7cf71a37 Logging flags (#674)
* logging: cleaned up stderr logging

- do not show module
- do not show timestamps by default (enable with --console-timestamps)

* logging: replaced most printStderr() with log.Info

* cli: additional logging cleanup
2020-10-10 10:48:37 -07:00
Jarek Kowalski
ec9c4d6095 restore: support for parallelization (#668) 2020-10-07 21:41:32 -07:00
Jarek Kowalski
4fd0bcf7dc cli: 'snapshot create' switched all stderr output to use logger (#663)
This allows 'kopia snap create --all --log-level=warning --no-progress'
to produce no console output unless an error is encountered.
2020-10-05 17:28:00 -07:00
Jarek Kowalski
d08c052651 cli: removed confusing default on 'snapshot list' that only lists last 100 snapshots per source (#666) 2020-10-05 16:59:06 -07:00
Jarek Kowalski
1962882aa8 testing: use shorter RSA keys to speed up server tests (#665) 2020-10-04 22:06:59 -07:00
Jarek Kowalski
8659b45a44 cli: added --force-color and --disable-color flags (#664)
By default Kopia will emit colored output if the output is a non-dumb
terminal. You can use --force-color (or set environment
variable to KOPIA_FORCE_COLOR=true) to override it and emit ANSI color
sequences, which is useful for example when piping through 'less'.

Conversely --disable-color (or KOPIA_DISABLE_COLOR=true)
will prevent color output.
2020-10-04 17:31:56 -07:00
Jarek Kowalski
6b756bad40 fshasher: truncate timestamps to full seconds when comparing to accomodate filesystems that lose precision (#661) v0.7.2 2020-10-03 15:15:24 -07:00
Jarek Kowalski
966b9be521 Fixed retention tag application to incomplete snapshots, automatically apply at checkpoints. (#660)
* upload: apply retention policy after each checkpoint

* policy: fixed applying retention policy to incomplete snapshots

- added limited retention to incomplete snapshots (keeping at  least 3 snapshots and no less than 4 hours)
2020-10-03 13:36:04 -07:00
Jarek Kowalski
d8d29ed3a5 Fixed few minor data races (#659)
* nit: fixed minor data race

* upload: fixed minor data races when reporting stats

* upload: ensure we cancel estimation goroutine before upload finished

This fixes minor data race when gathering statistics.
Also avoids goroutine leaks.
2020-10-02 23:04:34 -07:00
Jarek Kowalski
f66fe5789e Eliminated busy loop after snapshot failure (#658)
* server: if a snapshot fails, don't start the next one for 5 minutes or until the next successful refresh.

* Makefile: don't print skipped tests
2020-10-02 19:48:21 -07:00
Jarek Kowalski
16073f728f testing: more sleeps in TestFileStorage 2020-09-30 23:08:15 -07:00
Jarek Kowalski
ae38fa3917 Speed up integration tests (#653)
* testing: don't use expensive scrypt-65536-8-1 in integration tests

* testing: use platform-specific encryption and hashing for arm and arm64 to speed up tests

* testing: manually manage log directory to be able to analyze integration test failures

* testing: snapshot_gc_test was too quick

* Makefile: renamed target building integration test binary
2020-09-30 22:01:16 -07:00
Jarek Kowalski
044b170915 testing: fixed deadlock in faketime_test (#655)
TestTimeAdvanceConcurrent was depending on t.Parallel() to be scheduled
quickly, which is not guaranteed.

Fixes #654
2020-09-29 23:28:03 -07:00
Jarek Kowalski
01e6395804 repo: refresh indexes in the background every 15 minutes (#650) 2020-09-29 22:02:46 -07:00
Jarek Kowalski
a01bfde39a Makefile: plug in gotestsum for better test output (#652) 2020-09-29 21:14:20 -07:00
Jarek Kowalski
2b6d3d724e testing: increase delay in filesystem_storage_test 2020-09-29 08:29:46 -07:00
Jarek Kowalski
377513cc34 Upgrade webdav client dependency to include bugfix for the race condition (#651)
* deps: upgrade gowebdav dependency to include race condition fix

* webdav: remove workaround
2020-09-29 08:08:31 -07:00
Jarek Kowalski
66cebb79cb Fixed empty object IDs in checkpoints (#649)
* object: fixed race condition between Result() and Checkpoint()

This would sometimes result in indirect objects having empty object IDs.

Fixes #648

* upload: ensure checkpoints never containt empty object IDs.

* testing: reduce armhf test weight
2020-09-29 07:14:47 -07:00
Jarek Kowalski
0758a92c58 restore: improved user experience (#644)
* restore: improved user experience

* 'snapshot restore' is now the same as 'restore' and both will
  support restoring by manifest ID, root ID or root ID + subdirectory

* added support for restoring individual files

* implemented PR feedback and refactored object ID parsing

Moving helpers inside the snapshot/ package helped clean up the code
a lot.
2020-09-28 22:57:24 -07:00
Jarek Kowalski
fd24227379 b2: fixed handling of 'no_such_file' to indicate NOT_FOUND (#646)
Fixes #645
2020-09-26 21:01:04 -07:00
Jarek Kowalski
1636071f6b testing: increase test timeout because 90s is often flaky 2020-09-26 18:49:53 -07:00
Jarek Kowalski
ff6a414ec5 cli: When listing directory that had errors, print error summary at the end. (#643)
Can be disabled with `--no-error-summary`.
Quick demo: https://asciinema.org/a/2rma0sx2mD6HoIPy6VL0QEFeP

Also refactored fs.Directory to provide Summary optionally.
2020-09-25 09:06:41 -07:00
Jarek Kowalski
c9c8d27c8d Repro and fix for zero-sized snapshot bug (#641)
* server: repro for zero-sized snapshot bug

As described in https://kopia.discourse.group/t/kopia-0-7-0-not-backing-up-any-files-repro-needed/136/5

* server: fixed zero-sized snapshots after repository is connected via API

The root cause was that source manager was inheriting HTTP call context
which was immediately closed after the 'connect' RPC returned thus
silently killing all uploads.
v0.7.1
2020-09-23 20:15:36 -07:00
Julio López
892af670e9 Add support for Blake3 hashing (#640)
* Add Blake3 hash

Uses github.com/zeebo/blake3 optimized implementation

Hash info at https://github.com/BLAKE3-team/BLAKE3

Micro benchmarks show ~2X speedup for hashing+encryption.
- Caveat: not fully controlled environment, etc.

* go mod tidy
2020-09-23 06:57:49 -07:00
Julio López
0f449f31df Update dependencies (#639)
Upgrade AWS SDK from 1.31.3 to 1.34.29
Change log: https://github.com/aws/aws-sdk-go/releases

Upgrade protobuf and google dependencies:
- cloud.google.com/go/storage to v1.12.0 from version 1.8.0
  https://github.com/googleapis/google-cloud-go/releases/tag/storage%2Fv1.12.0
- google.golang.org/protobuf to 1.25.0
  https://github.com/protocolbuffers/protobuf-go/releases/tag/v1.25.0
- google.golang.org/api from 0.25 to 0.32.0
  https://github.com/googleapis/google-api-go-client/releases

Upgrade golang.org/x dependencies

Upgrade prometheus and opencensus
- Prometheus client to 1.7.0
  https://github.com/prometheus/client_golang/releases/tag/v1.7.0
- Opencensus to 0.22.4
  https://github.com/census-instrumentation/opencensus-go/releases/tag/v0.22.4
- Opencensus prometheus exporter to v0.2.0
  https://github.com/census-ecosystem/opencensus-go-exporter-prometheus/releases/tag/v0.2.0

Upgrade minio to 6.0.58
https://github.com/minio/minio-go/releases

Upgrade github.com/natefinch/atomic
Fixes an issue when working with relative directories

Upgrade testify to 1.6.1
https://github.com/stretchr/testify/releases/tag/v1.6.1

Upgrade gocloud.dev to 0.20.0
https://github.com/google/go-cloud/releases/tag/v0.20.0

Upgrades Azure storage blob to 0.10.0
https://github.com/Azure/azure-storage-blob-go/releases/tag/v0.10.0
as well as other Azure dependencies
azure-amqp-common-go    v2.1.0 => v2.1.0
azure-pipeline-go       v0.2.2 => v0.2.3

Upgrade compress and pgzip
github.com/klauspost/compress to v1.11.0
github.com/klauspost/pgzip to v1.2.5

Upgrade go-cmp to v0.4.1
Upgrade flock to v0.8.0
Upgrade uuid to v1.1.2
Upgrade gorilla/mux to v1.8.0
Upgrade github.com/pkg/sftp to v1.12.0
Upgrade github.com/zalando/go-keyring to v0.1.0
Upgrade github.com/mattn/go-colorable v0.1.7 // indirect

Cleanup: go mod tidy
2020-09-22 22:37:26 -07:00
Julio López
ae6a960080 Prefer t.TempDir() over makeScratchDir(t) (#612)
Prefer t.TempDir() over makeScratchDir(t)
Remove unused randomString
Leverage T.TempDir() in CLITest env
2020-09-22 22:16:39 -07:00
Julio López
6b0b79afe1 Trivial: update git attributes for Makefile (#638)
* Update .gitattributes for Go files

- Mark go source files as text, with LF line ending.
- Set git diff language mode for `*.go` files to `golang`

* Add .gitattributes entry for Makefiles
2020-09-22 21:32:53 -07:00
Jarek Kowalski
44ad8b58c1 Update build-armhf.yml 2020-09-22 19:51:54 -07:00
Jarek Kowalski
6bdcb81712 ignorefs: fixed arm-specific linter warning (#637)
* ignorefs: fixed arm-specific linter warning

* testing: TestServerStart fixes for armhf
2020-09-22 19:04:05 -07:00
Jarek Kowalski
b8c506b916 Create build-armhf.yml 2020-09-22 17:25:29 -07:00
Julio López
090cd1cc4d Minor edits for SFTP documentation (#635) 2020-09-21 17:18:03 -07:00
Jarek Kowalski
d0d6ac4767 SFTP connectivity and docs improvements (#623)
* sftp: support for external SSH command and host verfication improvements

- removed custom parsing of hostnames and verification and replaced with
  standard 'knownhosts' implementation.

- added option to launch external SSH command which supports
  aliases, agent, etc.

NOTE, we're still not supporting any cases where password needs to be
entered on the command line, since that would be incompatible with
the UI which uses client-server model.

Fixes #500
Fixes #414

* site: updated SFTP repository connection instructions

Fixes #590
v0.7.0
2020-09-20 11:10:13 -07:00
Jarek Kowalski
0595213d79 upload: fixed armhf alignment issue (#632)
Fixes: #631
2020-09-20 10:19:03 -07:00
Jarek Kowalski
04fcddeff0 webdav: prevent webdav client race condition (#626)
The race is described in
https://github.com/studio-b12/gowebdav/issues/36

We need this workaround until the fix is merged upstream,
to avoid maintaining a webdav client fork.

Fixes #624
2020-09-19 11:47:57 -07:00
Jarek Kowalski
538c644586 cli: don't ask for password if repository is not connected (#627) 2020-09-19 11:45:03 -07:00
Jarek Kowalski
fce9497375 restore: support for symlinks (experimental) (#621) v0.7.0-rc2 2020-09-18 10:29:20 -07:00
Jarek Kowalski
98a2bc6f6d testing: increase sleep time to fix flaky arm64 test 2020-09-18 08:25:17 -07:00
Nick
7f61dc6637 [Robustness] Add command line parameters for kopia snapshotter (#576)
* [Robustness] Add command line parameters for kopia snapshotter

Add flags for:
- no-progress
- parallel
- cache sizes
- no update check

Add an integration test to validate snapshotter expected output
against a kopia executable.
2020-09-18 01:15:19 -07:00
Jarek Kowalski
9551d2495d upload: scan the directory to be uploaded in parallel to estimate the amount of data to be uploaded (#622)
This allows better progress indicator in the CLI and UI.
The percentage completed is not displayed until estimate is available.

Quick demo: https://asciinema.org/a/O7ktcWSgaGUPfJwhzc65mMWM1
2020-09-17 23:59:18 -07:00
Jarek Kowalski
7cdb75ab79 fuse: changed file read implementation to avoid OOM (#620)
Changed file read implementation from ReadAll() to a Handle to avoid OOMing

We don't have automated tests for this but I verified this by restoring
13GB file over fuse and memory usage never exceeded 400MB.
2020-09-16 23:04:22 -07:00
Jarek Kowalski
f2cf71d914 logging: revamped logs from content manager to be machine parseable (#617)
* logging: revamped logs from content manager to be machine parseable

Logs from the content manager (except reads) are sent to separate log
file that is always free from personally-identifiable information
(e.g. no file names, just content IDs and blob IDs).

Also moved CLI logs to a subdirectory (cli-logs) and put content logs
in a parallel directory (content-logs)

Also, the log file name will now include the type of the command that
was invoked:

   kopia-20200913-134157-16110-snapshot-create.log

Fixes #588

* tests: moved all logs from tests to a separate directory
2020-09-16 20:04:26 -07:00
Jarek Kowalski
c7be3a0c87 testing: added performance benchmark (#618)
The benchmarks creates 20 GB of files in different configurations

* 10 x 2 GB files
* 100 x 200 MB files
* 1000 x 20 MB files

and backs them up to a local filesystem repository measuring time,
CPU and RAM usage.

The benchmarking script uses GCP instance (n1-standard-8) with fast NVME
flash to eliminate local filesystem latency.

Current performance numbers show major improvement in latency in
0.7.0-rc1 due to splitter throughput optimization (#606).
2020-09-15 21:30:08 -07:00
Jarek Kowalski
b71e551fd5 app: changed releaseType to release to fix publishing artifacts to GitHub, 2nd try v0.7.0-rc1 2020-09-13 18:47:05 -07:00
Jarek Kowalski
a5f275b2f5 app: changed releaseType to release to fix publishing artifacts to GitHub 2020-09-13 18:26:45 -07:00