Commit Graph

929 Commits

Author SHA1 Message Date
Jarek Kowalski
93eb4530ef go.mod: added missing dependency 2019-09-10 21:08:16 -07:00
Jarek Kowalski
8a1ce0a353 cli: renamed content gc subcommand to blob gc 2019-09-10 21:08:16 -07:00
Jarek Kowalski
6170ffb117 travis: upgraded to go 1.13, updated go module dependencies 2019-09-06 21:46:13 -07:00
Jarek Kowalski
f1aca74b88 content: additional test for Flush() / WriteContent() race 2019-09-02 19:13:36 -07:00
Jarek Kowalski
4c3272dd94 content: fixed content.Manager.Flush()
Previously, it was possible for Flush() to miss in-flight writes,
but only when using repository manually since Uploader guarantees
there are no in-flight writes when it completes.

With this change Flush() will guarantee that any pending writes
completed before Flush() has started are guaranteed to be committed
to the repository before Flush() returns.

This was actually a regression introduced in #105.
Added regression test to prevent it from reoccurring.
2019-09-02 19:13:36 -07:00
Jarek Kowalski
3e903b4fc5 content: added missing locks to Refresh() and CompactIndexes() 2019-08-30 23:12:48 -07:00
Jarek Kowalski
495821d140 content: clone incoming data bytes before taking a lock 2019-08-30 23:12:48 -07:00
Jarek Kowalski
fd302590ea content: further reduced contention in content.Manage.WriteContent() 2019-08-30 23:12:48 -07:00
Jarek Kowalski
2a6240ba3e content: remove lock while writing content 2019-08-30 23:12:48 -07:00
Jarek Kowalski
ca51fdec0d content: data structures cleanup 2019-08-30 23:12:48 -07:00
Jarek Kowalski
439e19d5c8 content: refactored internal state
Previously 'packIndexBuilder' contained both contents that have been
written to packs and the ones that have not.

This change makes it so that 'packIndexBuilder' only contains contents
from flushed packs, but non pending ones. It will help parallelize
writes later.
2019-08-30 23:12:48 -07:00
Jarek Kowalski
e097e8be84 added test with parallel writes 2019-08-26 07:22:54 -07:00
Jarek Kowalski
2b40f5368b content: refactored content manager
- separated portions that don't require locking into separate struct
  to make it easier to reason about state
- moved iteration-related content to separate file
2019-08-25 16:16:11 -07:00
Niraj Tolia
f32f0ece2f Switch file log level to info
Reduces multi-GB log files. Main culprits were:

- [upload.go:385] could not find cache entry for...
- [content_manager.go:790] WriteContent("...") - new
- [content_manager.go:396] adding ... length=... deleted=false
2019-08-24 21:09:39 -07:00
Jarek Kowalski
e8a13530ae upload: fixed time comparison which was sometimes causing re-hashing of contents
Thanks to @ntolia for debugging.

Fixes #97
2019-08-24 14:41:44 -07:00
Jarek Kowalski
09a31fa910 cli: added -–track-memory-usage flag that periodically logs memory usage 2019-08-24 13:18:31 -07:00
Jarek Kowalski
10d5102cd6 localfs: improved performance and memory usage when scanning large directories
- parallelized os.Lstat() x 16 (dramatically improves speed)
- discarded unused portions of os.FileInfo (uses 60% less RAM on macOS)

BEFORE:
10:47:03.670 [kopia/localfs] listed 200000 entries in 43.871211686s using 79126528 bytes of heap

After:
10:49:12.439 [kopia/localfs] listed 200000 entries in 1.953018184s using 30515200 bytes of heap
2019-08-24 11:51:16 -07:00
Jarek Kowalski
0ca55086df upload: reduced log level 2019-08-24 11:24:25 -07:00
Jarek Kowalski
81ea751c0c cli: added profile flags, built only with 'profiling' tag 2019-08-24 10:42:12 -07:00
Niraj Tolia
7c64934ca8 Remove stale reference to repo project
Removes stale docs as it looks like the `kopia/repo` project has been archived and moved in here.
2019-08-22 21:03:15 -07:00
Jarek Kowalski
399164b3be webdav: improved error handling
- improved HTTP error handling
- added exponential back-off around gowebdav calls
- fixed blob.ListAllBlobsConsistent which was never finishing for WebDAV

Fixes #88 - 429 Too Many Requests - PROPFIND /n0a #88
Fixex #89 - Debug log clashes with interactive repo password request
2019-08-18 10:49:11 -07:00
Jarek Kowalski
d80b659d9e webdav: added tests for basic authentication, CLI options for specifying username and password. fixes #80 v0.3.0-rc6 2019-08-17 18:09:05 -07:00
Jarek Kowalski
9893a552e2 metrics: disable google analytics as it's not providing any useful data, need to rethink the story here 2019-08-17 16:13:30 -07:00
Jarek Kowalski
86dc5bb44c goreleaser: fixed brew install path and deprecation warnings 2019-08-16 08:08:15 -07:00
Jarek Kowalski
06ea905801 Makefile: fixed installation of Google Cloud SDK on Travis v0.3.0-rc5 2019-08-14 06:44:56 -07:00
Jarek Kowalski
671a63aa24 travis: generate repository snapshot for long-term storage
This is triggered for tagged releases and will be used later for
long-term repository compatibility testing.
v0.3.0-rc4
2019-08-12 19:32:25 -07:00
Jarek Kowalski
2e0f75178e removed content.Manager.ListContents*() API 2019-08-12 19:21:06 -07:00
Jarek Kowalski
54d3c2071f added error handling tests to IterateContent() 2019-07-27 19:10:58 -07:00
Jarek Kowalski
b365d3414c removed content.Manager.ListContents*() API 2019-07-27 19:10:58 -07:00
Jarek Kowalski
6f5abf5e09 added content.Manager Iterate()
This uses callbacks avoids having to buffer
all content infos in memory and does not require holding a lock.
2019-07-26 21:31:25 -07:00
Jarek Kowalski
3a80d945d9 lint: upgraded to 1.17.1 2019-07-19 20:00:23 -10:00
Jarek Kowalski
829faf8e1a added 'rewrite --prefixed' flag to only rewrite prefixed content IDs (by default only rewrites non-prefixed IDs) 2019-07-18 20:29:27 -10:00
Jarek Kowalski
6ef696d97a cli: resolve symlinks for snapshot roots
also - error handling improvements in the CLI
2019-07-18 08:40:44 -10:00
Jarek Kowalski
a4430b05da travis: only upload coverage on post-submit builds and not PR 2019-07-17 13:19:23 -10:00
Jarek Kowalski
1af3d86ec7 Added support for separate packs for metadata
This puts all content blocks with non-empty prefix into starting with
`q` instead of `p`. This neatly separates all data (p) from metadata
(q) at the storage level and allows different storage policies, since
most data is not going to be ever accessed ever, but metadata is going
to be read a lot..

We can more aggressively cache contents from `q`.
2019-07-17 08:35:35 -10:00
Jarek Kowalski
8ada9587f3 travis: added encrypted 'known_hosts' file for sftp testing 2019-07-16 20:29:39 -10:00
Jarek Kowalski
59f0231f4c minor testability tweaks 2019-07-16 15:48:00 -10:00
Juan B. Rodriguez
4e2ceea146 Improve sftp provider logic
Tests are failing because pkg/sftp won't overwrite an existing file
(Rename function) and the test is actually doing that with
blobtesting.VerifyStorage.

The solution is to use pkg/sftp's PosixRename function:
"PosixRename renames a file using the posix-rename@openssh.com
extension which will replace newname if it already exists."

Additionally, the provider now creates the path on the server, if it
doesn't exist.
2019-07-16 15:46:52 -10:00
Jarek Kowalski
41530777a7 travis: fixed GPG decryption 2019-07-14 19:52:34 -07:00
Jarek Kowalski
692c741fa3 travis: reencrypted kopia.gpg 2019-07-14 19:47:59 -07:00
Jarek Kowalski
769b3c5f12 travis: reencrypted credentials with fixed key/iv 2019-07-14 19:30:22 -07:00
Jarek Kowalski
975824768e sftp: added encrypted e2e test credentials 2019-07-14 10:25:10 -07:00
Juan B. Rodriguez
d9a1fc93b7 Add e2e tests for sftp storage provider
Uses environment variables from the CI server, to connect to a test
sftp server

This also removes the "localhost" test
2019-07-12 23:16:29 -07:00
Jarek Kowalski
e414e7a4d1 Added support for reconnect tokens
Repository.Token() generates a base64-encoded token that can
be stored in password manager that fully describes repository connection
information (blob.ConnectionInfo) and optionally a password.

Use `kopia repo status -t` to print the token.
Use `kopia repo status -t -s` to print the token that also includes
repository password.

Use `kopia repo connect from-config --token T` to reconnect using the
token.
2019-07-10 21:03:40 -07:00
Jarek Kowalski
89469e74f2 goreleaser: fixed brews deprecation 2019-07-04 11:14:38 -07:00
Juan B. Rodriguez
a24a2da3c0 Implement an sftp backed storage provider
Uses go/ssh and pkg/sftp as building blocks and implements the common
sharded.Storage interface, shared between the filesystem and webdav
providers.

A couple of notes:

- The provider assumes the user has a working public/private key
connection to the ssh server.
No other authentication method is supported

- The repository path must exist on the server

- (testing related) The pkg/sftp server doesn't offer a way to set a
server filesystem root, so, during testing, it runs from the local
directory which is repo/blob/sftp. So the tests leave some debris
behind. Additionally, that's the reason why id_rsa and known_hosts
are there at all.

- Encrypted keyfiles are currently not supported (but it could be done)
2019-07-04 11:14:05 -07:00
Jarek Kowalski
b16e19dc64 fixing gcs credentials, try #3 - regenerated new SA JSON key 2019-07-04 10:56:50 -07:00
Jarek Kowalski
cb7127ac4a fixed credentials path, try #2 2019-07-04 10:20:25 -07:00
Jarek Kowalski
27f5b0540d fixed installation of GCS credentials for testing, which was silently being ignored 2019-07-04 10:13:21 -07:00
Jarek Kowalski
2512b7edeb refactored common bits of blob providers that use sharding (filesystem,webdav and upcoming sftp) into shared package 2019-07-01 18:32:38 -07:00