Commit Graph

3660 Commits

Author SHA1 Message Date
Jarek Kowalski
6217df1a87 lint: switched to 1.21 and fixed a ton of whitespace issues discovered
by new wsl linter
2019-11-26 06:49:49 -08:00
Jarek Kowalski
f4afaec9b5 object: fixed Seek() behavior for seeking to end of object 2019-11-25 23:36:24 -08:00
Julio Lopez
4598a05083 Trivial: clarify comment 2019-11-22 15:17:40 +09:00
Julio Lopez
41fb97bd45 Fix mispelled tag, caught by staticheck linter 2019-11-22 15:17:40 +09:00
Julio Lopez
24f292b719 Cleanup lint: empty lines (via whitespace and wsl linters) 2019-11-22 15:17:40 +09:00
Julio Lopez
4a24ae4714 Set golangci whitespace linter option 2019-11-22 15:17:40 +09:00
Pavan Navarathna
829742599c [#124] Add optional flags to override hostname and username 2019-11-22 15:15:21 +09:00
Jarek Kowalski
b3e1eab094 server: added --server-username and --server-password to optionally require basic auth for Kopia server 2019-11-20 15:49:40 -08:00
Jarek Kowalski
36859bdf8b server: removed dependency on pat 2019-11-20 15:49:40 -08:00
Jarek Kowalski
e8a1eaa9ee htmlui: added experimental HTML-based UI
This is enabled by `kopia server --ui` and can be viewed in a browser
at http://localhost:51515/

Right now it can only list snapshots and policies (barely).
2019-11-20 14:41:38 -08:00
Julio Lopez
945708c5c5 Add test for snapshot.Stats
Also, set directory mode and default permissions in mockfs.NewDirectory
2019-11-20 04:27:56 -08:00
Julio Lopez
40c6f6fc88 Simple test for Cache.getEntries() locking/unlocking.
See #130 and #132
2019-11-15 18:58:42 -08:00
Julio Lopez
a445c80ef2 Make Cache.mu a syncLocker 2019-11-15 18:58:42 -08:00
Jarek Kowalski
c3ffc435d7 site:reorganized NPM installation into main Makefile 2019-11-11 19:23:22 -08:00
Jarek Kowalski
0699fcfbea reorganized icons into separate directory, added PNG and ICO versions 2019-11-11 18:54:06 -08:00
Julio Lopez
c5cb83c2e3 Rename Cache.c.getEntriesFromCacheLocked
Follows the naming convention for the locking requirements
2019-11-09 12:26:27 -08:00
Julio Lopez
467243f23c Remove unnecessary unlock() in Cache.getEntriesFromCache
Motivation:

- Consistent locking/unlocking `c.mu` in `Cache.getEntries`
- Fix CI failure

`Cache.getEntriesFromCache()` was releasing `c.mu` when returning an
entry and not releasing it when returning nil. Previously, the caller
(`Cache.getEntries`) was accordingly not releasing `c.mu` when
`getEntriesFromCache()` was returning an entry, and unlocking `c.mu`
otherwise.

`Cache.getEntries` is the only caller for `getEntriesFromCache`.

After this change c.mu is consistently locked and unlocked in
`getEntries`
2019-11-09 12:26:27 -08:00
Julio Lopez
26415e6439 Trivial: prefer const where possible 2019-11-07 18:03:54 -08:00
Julio Lopez
34661d7f5e Ensure Mutex.Unlock() in cachefs.Cache.getEntries() 2019-11-07 18:01:17 -08:00
Jarek Kowalski
9d4a7c32cf golangci: upgraded linter to 1.18.x 2019-11-06 17:42:05 -08:00
Julio Lopez
ae3c16a3d2 Allow passing an fs.Entry to the TreeWalker callback
This will be useful for #114
2019-11-06 17:34:28 -08:00
Julio Lopez
78e05ffe5e Generalize enqueue filtering in TreeWalker 2019-11-06 17:34:28 -08:00
Julio Lopez
91508dac46 Move 'snapshot gc' functionality to gc package
Motivation:
Allow generalizing TreeWalker. See follow-up commit.

Changes:
* [x] Refactoring, no functional changes.
2019-11-06 17:34:28 -08:00
Julio Lopez
3883c2751c Allow multiple simultaneous profilers (#122)
Allow multiple simultaneous profilers.
Also, allow specifying the memory sampling rate for
the memory profiler
2019-10-31 05:11:41 -07:00
Julio Lopez
467c8d1e6f Add .gitattributes with settings for Go
Removes git warnings about tabs in indentation for Go files.
2019-10-31 05:08:46 -07:00
Julio Lopez
b5c00941fd Documentation about the encryption of the format blob (#120)
* Documentation about the encryption of the format blob
2019-10-31 05:07:30 -07:00
Jarek Kowalski
9778ba3dd3 site: added version compatibility page v0.3.0 2019-10-03 21:00:09 -07:00
Jarek Kowalski
d0e4d4f4cc Fixed how blob storage PutBlob errors are handled in content.Manager (#117)
* Fixed how blob storage PutBlob errors are handled in content.Manager

In order to guarantee that all index entries have corresponding
pack blobs, we must ensure that `content.Manager.Flush` will
not succeed unless all pending writes have completed.

Added test that simulates various patterns of PutBlock failures and
ensures that data remains durable despite those, assuming all calls
to `WriteContent()` and `Flush()` are retried.

* addressed review feedback
2019-10-01 17:33:05 -07:00
Jarek Kowalski
3b1177cc4e cli: implemented 'snapshot gc' and moved verify to be snapshot verify
`snapshot gc` marks contents not reachable from the root of any snapshot
as soft-deleted

The algorithm is a mark-and-sweep with parallel iteration of objects.
Currently it stores content IDs and object IDs in a map, so won't scale
to huge repositories, but this can be fixed in the future.

This fixes #110 at least for reasonable repository sizes.
2019-09-15 21:25:48 -07:00
Jarek Kowalski
cc8009da6a lint: rollback to 1.17.x because 1.18.0 is unsupported by golangci.com for now 2019-09-15 19:41:40 -07:00
Jarek Kowalski
0654e30b26 linter: upgraded to golangci-lint 1.18.0, fixed or suppressed warnings 2019-09-11 06:42:08 -07:00
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