Commit Graph

511 Commits

Author SHA1 Message Date
Jarek Kowalski
51fdbf2048 nit: minor log output cleanups (#1380) 2021-10-13 06:07:18 -07:00
Jarek Kowalski
4a47bc3210 logging: switched from go-logging to zap (#1376)
This is much more efficient in terms of memory allocations
and speeds up backup due to less GC pressure.

Fixes #1345
2021-10-12 22:52:24 -07:00
Jarek Kowalski
8b760b66a8 logging: added memoization of Logger instances per context (#1369) 2021-10-09 05:02:18 -07:00
Eng Zer Jun
73e492c9db refactor: move from io/ioutil to io and os package (#1360)
* refactor: move from io/ioutil to io and os package

The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* chore: remove //nolint:gosec for os.ReadFile

At the time of this commit, the G304 rule of gosec does not include the
`os.ReadFile` function. We remove `//nolint:gosec` temporarily until
https://github.com/securego/gosec/pull/706 is merged.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2021-10-06 08:39:10 -07:00
Jarek Kowalski
3bb5b63289 sftp: fixed performance reggression due to connection management (#1359)
* sftp: fixed performance reggression due to connection management

The previous pooling was causing serialization of all requests, which
was too slow.

This change effectively reverts connection pooling but adds
automatic reconnection + unit tests.

* sftp: fixed unwanted retry on initial connection
2021-10-06 07:28:42 -07:00
CrendKing
93b9bf15b4 Support setting AWS S3 storage class for all types of blobs (#1335)
* Support setting AWS S3 storage class for all types of blobs

* Read .storageconfig file

* Improve loading logic

* Hide .storageconfig from ListBlobs()
2021-10-03 19:01:39 -07:00
Pawit Pornkitprasan
4c16770a8a cli: linux: read KOPIA_USE_KEYRING env (#1337)
On Linux, Keyring is disabled by default and `--use-keyring` must
be specified on every command-line invocation, which gets quite
annoying.

This commit allows enabling keyring from environment variable
instead.
2021-10-01 22:56:50 -07:00
cristihcd
d9c1bd0758 minor spelling and grammar fixes (#1318) 2021-09-28 15:19:02 -07:00
Jarek Kowalski
d56b93587e cli: only read first 128 MiB of provided file for compression benchmark (#1317) 2021-09-26 15:08:09 -07:00
Jarek Kowalski
1894727458 cli: fixed windows color output (#1305)
Fixes #1287
2021-09-19 21:59:24 -07:00
Jarek Kowalski
5ab712b3e7 cli: fixed error message when trying 'repo sync-to from-config' and the config file is connected to the repository server (#1304) 2021-09-19 21:54:47 -07:00
Jarek Kowalski
1566b74263 blob: support for custom blob store sharding (#1299)
* blob: support for custom blob store sharding

This is experimental.

The .shards file can reside in the root of any blob storage that uses
sharding (filesystem/sftp/webdav) and can specify rules for sharding.

{
  "default": [3,2,1],
  "overrides": [
    { "prefix": "p", "shards": [2,2] },
    { "prefix": "x", "shards": [1,1,1] }
  ],
  "maxNonShardedLength": 2
}

With this in place we'll be later able to do resharding of the
repository to optimize get/put/list performance for both repositories
and caches.

* cli: command line tools to manipulate shards in a directory
2021-09-19 18:50:38 -07:00
Jarek Kowalski
c48f2e5528 cli: added support for passing bare filename for --config-file parameter (#1293)
When --`config-file` is passed as a filename without any directory
(absolute or relative) it is resolved in OS-specific
config path.

For example on macOS:

`--config-file foo.config`

resolves to:

`~/Library/Application Support/kopia/foo.config`
2021-09-15 18:30:38 -07:00
Jarek Kowalski
928150fe6b linter: upgrade to 1.42.1 (#1292) 2021-09-14 19:11:39 -07:00
Jarek Kowalski
8b2b91f9f9 content: fixed repo upgrade version (#1286)
* content: fixed repo upgrade version

Previously upgrade would enable epoch manager and index v2 but would
not set the version of the format itself. Everything worked fine
but it would not protect from old kopia opening the repository.

* ci: added compatibility test that uses real 0.8 and current binaries
2021-09-10 22:51:51 -07:00
Julio Lopez
06a997385a cli: include parameters in maintenance info JSON output (#981)
* cli: include parameters in maintenance info JSON output
* e2e: add maintenance info checks in e2e test
* cli: simple test for 'maintenance info --json' command
2021-09-10 17:51:55 -07:00
Jarek Kowalski
7e68d8e4c1 Consolidated format version flags (#1284) 2021-09-08 18:44:03 -07:00
Julio Lopez
1077cc24d3 blob/s3: point-in-time support for s3 versioned stores (#1259)
Adds a `--point-in-time' flag for `repo connect`
2021-09-02 21:38:08 -07:00
Jarek Kowalski
56edb042ae content: switched defaults to use v2 index format and epoch-based indexes (#1275) 2021-09-02 05:53:01 -07:00
Jarek Kowalski
9cebffc628 Fix endurance test (#1254) 2021-08-27 04:22:18 -07:00
Jarek Kowalski
9e182f131a linter: upgraded to 1.42.0 (#1246) 2021-08-20 18:26:45 -07:00
Jarek Kowalski
35d0f31c0d huge: replaced the use of allocated byte slices with populating gather.WriteBuffer in the repository (#1244)
This helps recycle buffers more efficiently during snapshots.
Also, improved memory tracking, enabled profiling flags and added pprof
by default.
2021-08-20 08:45:10 -07:00
Jarek Kowalski
1238a0db60 cli: additional 'index inspect' flags (#1231)
* cli: fixed output of 'index inspect' to go to stdout

* cli: additional flags for 'index inspect'
2021-08-06 21:54:38 -07:00
Jarek Kowalski
67165cae5f build(deps): bump github.com/prometheus/client_golang (#1226)
Includes manual change to fix linter deprecation warning.

Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.10.0 to 1.11.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.10.0...v1.11.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-02 21:36:15 -07:00
Jarek Kowalski
d6d9a1fb5f Maintenance improvements for epoch-based index structures (#1225)
* testing: KOPIA_TEST_LOG_OUTPUT logs subcommand outputs

* cli: additional flags for 'blob list'

* Makefile: run all tests against epoch-based index manager

* epoch: added support for deletion watermark, which keeps track of latest maintenance which dropped index entries

* content: added deletion watermark to content manager

* maintenance: improved maintenance without safety to force rewrites

* maintenance: skip quick maintenance when epoch manager is enabled

* maintenance: do not enable quick maintenance when epoch manager is used

* testing: skip TestIndexOptimize when running against epoch manager-backed index strutures
2021-08-02 21:08:54 -07:00
Jarek Kowalski
cfdbc40756 cli: Fixed ETA estimation of 'snapshot verify' (#1213) 2021-07-26 18:57:58 -07:00
Jarek Kowalski
6c5bf42d23 cli: changed 'kopia snapshot verify --verify-files-percent' to float (#1210)
* cli: changed 'kopia snapshot verify --verify-files-percent' to float

* cli: added 'kopia content verify --download-percent'
2021-07-24 13:04:50 -07:00
Benedikt McMullin
317d5c3419 force-hash: Allow fractional percentages (#1209)
* force-hash: Allow fractional percentages

Co-authored-by: Jarek Kowalski <jaak@jkowalski.net>
2021-07-24 09:45:46 -07:00
Jarek Kowalski
4f93a17782 WebDAV and Rclone atomic writes (#1206)
* webdav: added --atomic-writes (defaults to false) to assume WebDAV supports atomic writes

* rclone: added --atomic-writes (defaults to true)

This allows the provider to assume rclone backend supports atomic writes (most of them do).
2021-07-19 21:55:56 -07:00
Jarek Kowalski
e42cc6ccce Added 'kopia repository validate-provider` (#1205)
* cli: added 'repository validate-provider' which runs a set of tests against blob storage provider to validate it

This implements a provider tests which exercises subtle behaviors which are not always correctly implemented by providers claiming compatibility with S3, for example.

The test checks:

- not found behavior
- prefix scans
- timestamps
- write atomicity

* retry: improved error message on failure

* rclone: fixed stats reporting and awaiting for completion

* webdav: prevent panic when attempting to mkdir with empty name

* testing: run providervalidation.ValidateProvider as part of regular provider tests

* cli: print a recommendation to validate provider after repository creation
2021-07-19 21:42:24 -07:00
Jarek Kowalski
4c2f52a2e3 Rclone and testing improvements (#1202)
* sharded: added parallel iteration of blobs to improve performance

* retry: reduce first retry delay 1s->100ms

* testing: additional assertions for blob storage testing

* rclone: testing cleanup improvements, re-enabled OneDrive

* cli: added --list-parallelism parameter to fs,webdav,sftp and rclone

* sharded: added dedicated test
2021-07-17 16:04:51 -07:00
Jarek Kowalski
928e1d3071 rclone: wait for rclone transfers to finish when closing (#1201)
added --rclone-debug flag to enable better logging from rclone
2021-07-17 12:55:03 -07:00
Jarek Kowalski
730ba7b94a Repository password change support (#1197)
* repo: added 'enable password change' flag (defaults to true for new repositories), which prevents embedding replicas of kopia.repository in pack blobs

* cli: added 'repo change-password' which can change the password of a connected repository

* repo: nit - renamed variables and functions dealing with key derivation

* repo: fixed cache validation HMAC secret to use stored HMAC secret instead of password-derived one

* cli: added test for repo change-password

* repo: negative cases for attempting to change password in an old repository

* Update cli/command_repository_change_password.go

Co-authored-by: Julio Lopez <julio+gh@kasten.io>

Co-authored-by: Julio Lopez <julio+gh@kasten.io>
2021-07-17 07:58:02 -07:00
Jarek Kowalski
bffe8b37da repo: limit the duration of kopia.repository caching to 15 minutes (#1196)
added flags to specify kopia.repository cache duration
2021-07-15 11:32:55 -07:00
Jarek Kowalski
7cabed85ae sftp: added automatic reconnect and connection pooling (#1195)
Fixes #397
2021-07-12 18:45:25 -07:00
Jarek Kowalski
61af6399c8 cli: fixed profiling flags (#1181) 2021-07-09 21:35:00 -07:00
Jarek Kowalski
62ad437bb6 Implemented epoch-based index manager (#1174)
* epoch: misc fixes and logging

* blob: misc helpers

* cli: removed useless 'repository upgrade', replaced by 'repository set-parameters'

* content: implemented indexBlobManagerV1 which uses epoch manager

* cli: commands to manipulate repository epoch parameters

* cli: commands to examine epoch-based indexes

* content: added test suite that uses epoch-based index manager

* content: fixed a ton of test data races caused by sharing blobtesting.DataMap

* cli: additional tests and validation for 'repository set-params'

* testing: replaced the use of suite with our own, since suite is not parallelizable
2021-07-06 21:38:08 -07:00
Robert Kroeger
474ef1c9bf Multiplaces (#1154)
* Multiple placeholder expansion

It's inconvenient to only be able to expand a single placeholder file
at a time. Add support to the restore command to expand any number of
shallow placeholder arguments.

* Add placeholder looping

Loop over placeholder targets to expand from within the restore
command.

* Added multiple placeholder expansion test

Added a test to exercise the new code capable of expanding multiple
placeholder arguments to the restore command.
2021-06-27 16:24:21 -07:00
Jarek Kowalski
85cfbb1afd cli: added 'kopia repo set-parameters' to override mutable parameters (#1148) 2021-06-19 18:47:13 -07:00
Jarek Kowalski
9e059a1277 upgraded linter to 1.41.0 (#1144) 2021-06-16 19:44:55 -07:00
Jarek Kowalski
8b0296cdf2 Misc index blob manager refactorings (#1138)
* content: extracted encryptedBlobMgr component

* content: renamed files

* content: refactored ParseIndexBlob

* epoch: adjusted API to return blob.Metadata

* content: removed IndexBlobReader interface

* content: cleaned up indexBlobManager API
2021-06-13 18:52:49 -07:00
Robert Kroeger
93979818e6 Add a flag to not shallowrestore small files (#1126)
When doing a shallow restore, small files might take up less size than
storing the DirectoryEntry metadata. Add a minimum file size flag that
where files below that size will be written directly instead being
represented with shallow placeholders. This improves on #710.
2021-06-09 20:31:07 -07:00
Robert Kroeger
6fc3bf1af6 Support for shallow restore (#725) 2021-06-08 20:11:43 -07:00
Jarek Kowalski
b7c8463075 cli: 'kopia content verify' performance improvements (#1120)
* content: reduce cache lock scope and improve sharding for metadata cache

* cli: improved 'content verify' progress reporting

* cli: ensure we stop estimation goroutine before we return from content verify
2021-06-06 14:13:31 -07:00
Jarek Kowalski
87f1f5281c cli: added tests for benchmark subcommands 2021-06-05 09:03:49 -07:00
Jarek Kowalski
d84c884321 Added content manager internal logging (#1116)
* logging: added logger wrappers for Broadcast and Prefix

* nit: moved max hash size to a named constant

* content: added internal logger

* content: replaced context-based logging with explicit Loggers

This will capture the logger.Logger associated with the context when
the repository is opened and will reuse it for all logs instead of
creating new logger for each log message.

The new logger will also write logs to the internal logger in addition
to writing to a log file/console.

* cli: allow decrypting all blobs whose names start with _

* maintenance: added logs cleanup

* cli: commands to view logs

* cli: log selected command on each write session
2021-06-05 08:48:43 -07:00
Jarek Kowalski
4b251bdaac mechanical: added ctx parameter to repo.{Direct}WriteSession callback (#1114) 2021-06-02 23:12:30 -07:00
Jarek Kowalski
f5eb12e8b7 content: introduced content.Crypter (#1112) 2021-06-01 20:12:34 -07:00
Jarek Kowalski
6811f1fae1 cli: optimized 'kopia index recover' by leveraging partial read and parallelism (#1094) 2021-05-23 22:18:31 -07:00
Jarek Kowalski
e15a79474c azure: added support for using SAS Tokens instead of storage keys (#1093)
Fixes #1071
2021-05-22 12:43:55 -07:00