storj/storage
Cameron Ayer 4424697d7f satellite/accounting: refactor live accounting to hold current estimated totals
live accounting used to be a cache to store writes before they are picked up during
the tally iteration, after which the cache is cleared. This created a window in which
users could potentially exceed the storage limit. This PR refactors live accounting to
hold current estimations of space used per project. This should also reduce DB load
since we no longer need to query the satellite DB when checking space used for limiting.

The mechanism by which the new live accounting system works is as follows:

During the upload of any segment, the size of that segment is added to its respective
project total in live accounting. At the beginning of the tally iteration we record
the current values in live accounting as `initialLiveTotals`. At the end of the tally
iteration we again record the current totals in live accounting as `latestLiveTotals`.
The metainfo loop observer in tally allows us to get the project totals from what it
observed in metainfo DB which are stored in `tallyProjectTotals`. However, for any
particular segment uploaded during the metainfo loop, the observer may or may not
have seen it. Thus, we take half of the difference between `latestLiveTotals` and
`initialLiveTotals`, and add that to the total that was found during tally and set that
as the new live accounting total.

Initially, live accounting was storing the total stored amount across all nodes rather than
the segment size, which is inconsistent with how we record amounts stored in the project
accounting DB, so we have refactored live accounting to record segment size

Change-Id: Ie48bfdef453428fcdc180b2d781a69d58fd927fb
2020-01-16 10:26:49 -05:00
..
boltdb common: separate repository 2019-12-27 14:11:15 +02:00
cockroachkv Revert "dbutil: statically require all databases accesses to use contexts" 2020-01-15 07:28:00 +00:00
filestore common: separate repository 2019-12-27 14:11:15 +02:00
postgreskv Revert "dbutil: statically require all databases accesses to use contexts" 2020-01-15 07:28:00 +00:00
postgreskv2 Revert "dbutil: statically require all databases accesses to use contexts" 2020-01-15 07:28:00 +00:00
redis satellite/accounting: refactor live accounting to hold current estimated totals 2020-01-16 10:26:49 -05:00
storelogger storage/: remove reverse-key-listing feature 2019-11-12 18:47:51 +00:00
teststore lint: add staticcheck as a separate step (#3569) 2019-11-14 10:31:30 +02:00
testsuite common: separate repository 2019-12-27 14:11:15 +02:00
blob.go storagenode: Include trash space when calculating space used 2019-12-23 19:07:03 -07:00
common.go storage/: remove reverse-key-listing feature 2019-11-12 18:47:51 +00:00
iterator.go storage/: remove reverse-key-listing feature 2019-11-12 18:47:51 +00:00
listkeys.go Stylistic Go Cleanup (#2524) 2019-07-22 15:10:04 -04:00
listv2.go storage/: remove reverse-key-listing feature 2019-11-12 18:47:51 +00:00
util.go storage: add monkit task to missing places (#2122) 2019-06-05 16:23:10 +02:00