Commit Graph

3505 Commits

Author SHA1 Message Date
Ivan Fraixedes
80a6219c4b cmd/uplink: Create dir before saving config file
Setup command of uplink has to create the configuration directory just
before saving the configuration file for making it more robust than
creating in the initial state of the process.

When creating the directory at the beginning of the process leaves the
possibility to delete such directory during the setup process and leads
to a failure.

Ticket https://storjlabs.atlassian.net/browse/V3-3545

Change-Id: I30db0175e23a597e9675d267b4d7e25d5d4c5119
2020-01-22 13:36:09 +00:00
Michal Niewrzal
6502454947 satellite/metainfo: move RS configuration to satellite
With this change RS configuration will be set on satellite. Uplink with
get RS values with BeginObject request and will use it. For backward
compatibility and to avoid super large change redundancy scheme stored
with bucket is not touched. This can be done in future.

Change-Id: Ia5f76fc10c37e2c44e4f7b8754f28eafe1f97eff
2020-01-22 09:33:53 +00:00
Jeff Wendling
75314a4364 satellite/satellitedb: fix roundToNextDay to handle timezones appropriately
Since incoming times may be in any time zone, and we want the output
to be in UTC and for them to have 00:00:00 hours, minutes and seconds
we first convert the incoming timestamp to UTC before doing the
truncate to the day and adding a day.

Because the old code always returned a timestamp that was in the
future, this is just for efficiency.

Change-Id: Ie692d47bca8691e73852c822d5c56cf8773d99b4
2020-01-21 21:02:16 +00:00
Egon Elbre
0c0b47823d satellite: use require.WithinDuration
Noticed that assert/require has WithinDuration for comparing
time.Time-s.

Change-Id: Ia340896443f610d38799b7ef245b5775eecfc92b
2020-01-21 19:43:53 +02:00
Moby von Briesen
d32626fe8c scripts/tests: update uplink config migration for test versions
Updates config migration to occur for any v0.30.x release rather than
specifically 30.4

Also updates the config for the rolling upgrade test to use 64 kib
segments, and use smaller files for the final upload of rolling upgrade.

Change-Id: I941f77fe2b9011b45f28a5f3a2430e882d2ae6b3
2020-01-21 11:50:13 -05:00
Jessica Grebenschikov
c353e8b108 run backwards compat tests with cockroachdb
Change-Id: I1de9a6e6e0681825a5d021e168f3a116591d28c2
2020-01-21 07:42:49 -08:00
NikolaiYurchenko
d289cdc6e4 web/satellite: project limits blinking fixed
Change-Id: I2fa3af1c535f10e0c30ceb1c1a6cdfa19d44eeaf
2020-01-21 14:48:59 +00:00
Ethan
21a5d70a83 satellite/metainfo: Rate limiting - API requests
Limits how many times metainfo APIs can be called per second by project ID. If limit is exceeded, the API will return Unauthorized/Too Many requests.

Limit per second and the size of the limiter cache per project are configurable, as well as whether the limiter is enabled.

Tests added/updated for the new rate_limit field in projects table.
Tests added for exceeding limits and disableing limiter.

Change-Id: Ic8ad102de3b690a475809d4f684156d5715f20fa
2020-01-21 14:25:04 +00:00
NikolaiYurchenko
38196b4809 web/satellite: validation to reset password page added
Change-Id: I493e0499d1806aa856b7ebed40272608140233c7
2020-01-21 13:57:23 +00:00
VitaliiShpital
6b6517aac6 web/satellite: date view on billing history improved
Change-Id: Ic15ba8496193cad8592d414b662b41ffc6dc43b9
2020-01-21 13:26:52 +00:00
VitaliiShpital
28d302c6f8 web/satellite: redundant text removed from api keys page
Change-Id: Id44e60a77ff51ea30ebef00d42041e4cce995d30
2020-01-21 13:10:16 +00:00
Bryan White
cb827cbe31 cmd/{uplink,gateway}: update cli copy "http" -> "https"
Change-Id: I47f46221ab3eb6065d382acfe75865abf09b1ce5
(cherry picked from commit 580a00561ae35b4830acc1f4dd990329df4d3c7b)
2020-01-21 11:35:15 +01:00
Michal Niewrzal
8772867855 satellite/metainfo: combine CommitSegment and CommitObject in batch
This change is a special case for batch processing. If in batch request
CommitSegment and CommitObject are one after another we can execute
these request as one. This will avoid current logic where we are saving
pointer for CommitSegment and later we are deleting this pointer and
saving it once again as under last segment path for CommitObject.

Change-Id: If170e78c8410f5ba5916cbff6a29b9221db9ce2e
2020-01-21 09:30:55 +00:00
Michal Niewrzal
86f194769f uplink: adjust to changes in storj/uplink
This change is adjusting code base to changes in storj/uplink.

https://review.dev.storj.io/c/storj/uplink/+/643

Change-Id: Ieca87f9f5983e391bf4b4fec8b9d5491fd32bfa1
2020-01-20 22:06:19 +00:00
Yaroslav
c636b06191 satellite/console: use cookie based auth scheme
Change-Id: I143b56f49fa9028ec172db8c29fd93577c3e7878
2020-01-20 21:35:23 +02:00
stefanbenten
b678b55f83 satellite/metainfo: improve metainfo logging
Change-Id: Ibc06393bfb996e1cad9bb76c451e3faf2393b478
2020-01-20 18:49:55 +00:00
Egon Elbre
c1c878efcf all: fix import groupings
check-imports was broken and didn't complain about things.

Change-Id: I38adafd16b4aba86f0eb4f53427b4393f9a6c710
2020-01-20 17:47:44 +00:00
Moby von Briesen
0def7a9d2a scripts/tests/testversions;scripts/tests/rollingupgrade: update test versions script
Fix uplink setup step for uplink versions that requires an access field.

Update how script selects uplink versions to test.

Use significantly smaller remote files for test (performance).

Change-Id: If590b8798767e2a0621fb84cd3b8852d02f6d1da
2020-01-20 11:46:11 -05:00
Yaroslav
33790e0f7e satellite/console: handle graphql errors properly
Change-Id: Id62b4f10cff9e9caba64ec940f558530eadbabbc
2020-01-20 15:20:24 +00:00
Egon Elbre
21f53e38da storagenode/storagenodedb/storagenodedbtest: pass ctx as an argument
Change-Id: I10b0a8ef3a7d5001e7d361f1873ad5987af1f9c2
2020-01-20 16:56:12 +02:00
Egon Elbre
f3b4bf2b7c satellite/satellitedb/satellitedbtest: pass ctx as an argument
ctx is created in most tests, instead pass in as argument
to reduce code duplication.

Change-Id: I466c51c008392001129c8b007c9d6b3619935ac4
2020-01-20 16:35:42 +02:00
Egon Elbre
1279eeae39 private/tagsql,storage: fixes to context cancellation
Replace all the remaining uses of sql.DB with tagsql.DB to
fix issues with context cancellation.

Introduce tagsql.Open which helps to get rid of all tagsql.Wrap-s.
Use tagsql in cockroachkv and postgreskv.

Change-Id: I8946d203341cb85a25976896fc7881e1f704e779
2020-01-20 15:44:39 +02:00
Egon Elbre
ba2fce814c satellite/satellitedb: better coupons query
Change-Id: Iaf180b99c57443550418b46dfd8300f921e93bec
2020-01-20 15:05:10 +02:00
Egon Elbre
10d932fd65 lib/uplinkc: fix test flakiness by setting MaxTimeSkew
Not having a skew caused an issue where:

1. Uplink calls "begin segment", where segment isn't committed to the
database.
2. Uplink stores piece X to the storage node A with timestamp 1.
3. Satellite runs garbage collection with timestamp 2.
4. Satellite sends retain request to storage node A with timestamp 2.
5. Storage node A deletes piece X, because 1 < 2.
6. Uplink calls "commit segment" with storage node A in it.
7. Download of segment fails, because A doesn't have piece X.

In production this is not an issue since the MaxTimeSkew is 72h by
default.

Change-Id: Id87ca3ddc44103dcd85d031b1367168c014b8e7b
2020-01-20 12:44:42 +00:00
crawter
c4cbc6ff2f satellite/payments: promotional coupons generation functional added
Change-Id: Ie0df256503114ca377d81bf7c8b26cc90a1f5b26
2020-01-20 11:01:55 +00:00
Egon Elbre
a4026f97b8 satellite: fix test time comparisons
Correct way to compare time that may have an error is to use InDelta.

Change-Id: I0140892119c44c63fa042bbc7292ab91bb33a350
2020-01-20 10:17:20 +00:00
Bryan White
3b55b50eac cmd/uplink: Add ability to generate named accesses
Change-Id: I2cf58c1c41bfffa800949dc441a488c16a448375
2020-01-20 10:02:13 +01:00
ccase
034f9845b1 storage: Plumb limit through storage backends.
* Plumbs the limit through all backends ensuring they don't do
  unnecessary work.
* Don't arbitrarily limit at the backend with hardcoded defaults. The
  limit will be set by the caller.

Prior to this change the code on recursive in some backends would do 10k
results from the database and then only return the first 1k (throwing
out 9k of them).

Prior to this change some backends had no limit at all (e.g. redis).

Change-Id: I1f327eefe095776d123dd11362cd00994c22efdf
2020-01-19 21:23:20 +00:00
Egon Elbre
d5438036b5 {satellite,storagnode}/gracefulexit: reduce logging
Change-Id: I9f274ede77a582fc43ef14a47bf9341d4e3083df
2020-01-19 22:36:13 +02:00
Egon Elbre
ee0293c212 private/dbutil/sqliteutil: add missing err check
Change-Id: Ie18c76d0e6d02a5c55e2d6503437b8a07b47a64e
2020-01-19 19:24:58 +00:00
Egon Elbre
cf7b22c466 satellite/satellitedb: add missing err check
Change-Id: I502838f78f1871315597b488602c0f1112612981
2020-01-19 19:24:12 +00:00
Egon Elbre
3cd584c007 storagenode/gracefulexit: move database test
Database tests belong to the interface, not the implementation.

Change-Id: I5d76fdc7df0b0f32391ebad1b595ef26b062a9cb
2020-01-19 18:12:01 +00:00
Egon Elbre
ca8ceff5e2 pkg/cache: fix expiration test
Multiple time.Now calls in a short amount of time
may return the exact same time.

This adds a time.Sleep() to ensure we get different internal
timing.

Change-Id: I533b5eedfdcab13a0197976ccf4b9fa96d4c3bba
2020-01-19 19:31:31 +02:00
Yaroslav
48303bc0a9 satellite/console/limits: add content-type to response, fix error
Change-Id: I63dffb5372456569b100f97b04eacc1fc19bddf5
2020-01-19 15:42:55 +00:00
Egon Elbre
c207cd08fc satellite/satellitedb: gracefulexit, add missing Errs check
Change-Id: Iba4ba84fd57b3a0a0d15f13006566076045d6c11
2020-01-19 15:24:12 +00:00
Egon Elbre
7bc76624cf storagenode/storagenodedb: fix closing in-use database
Migration step was closing a database that was used by
the migration itself. There is an active tranasction
over the database.

Instead of closing in the same transaction we can wait
until restart for the database cleanup.

Change-Id: Ic971d8cea81a3ab783f4a1bdc6357009c8b31386
2020-01-19 16:18:46 +02:00
Egon Elbre
1abfe42142 satellite: use tagsql
Change-Id: I2170dee409fb0c2fe85913ddd36e7811a3b853ed
2020-01-19 14:39:16 +02:00
Egon Elbre
25b76fe63f storagenode/storagenodedb: use tagsql
Change-Id: Iba3b34a97b982deb4f72ce55517a294f249b6b55
2020-01-19 14:39:16 +02:00
Egon Elbre
59d06644b9 private/migrate: switch to tagsql
Also added temporary types withRebind and withTagTx,
which will be later removed. Currently they help to avoid
changing the whole codebase at the same time.

Change-Id: I7f07ba8f4709a23a463bfa67464628665a05808f
2020-01-19 14:39:16 +02:00
Egon Elbre
5fd833b108 private/dbutil: remove basic Query
dbschema.Query is used only for testing and sqlite,
so this won't cause us problems in production.

Change-Id: Ib296a7daf161a9d3de23a7dfdc4f505d47ac4a37
2020-01-19 14:39:16 +02:00
Stefan Benten
23463e1dc3
Catch the Stage properly for Alerts (#3753) 2020-01-19 13:34:13 +01:00
ccase
14b43b7e9b storage/postgreskv/schema/data.go: Regenerate migrations that failed to update.
Change-Id: I9fd5a9a5414214faea5f8c476778fccbe022cb6c
2020-01-19 11:22:00 +00:00
stefanbenten
f4097d518c satellite: reduce logging of node status
Change-Id: I6618cf4bf31b856acd7a28b54011a943c03ab22a
2020-01-18 17:47:59 +00:00
Egon Elbre
76a6b28b33 ci: use tmpfs for running tests
Change-Id: I6278899bd158759c6fc0bceafd6a6c7244860f4a
2020-01-17 20:28:15 +00:00
Moby von Briesen
273eb66fae cmd/storagenode,storagenode/preflight: add config flag to disable
storagenode database preflight check.

Disable preflight database check by default, and have the option to
enable it. This will allow us to enable it once it is definitely
working.

Also change the name of the config flag for preflight  time sync.

Change-Id: Ie2e20f9e25dcb38794eafa7e1505e7c6ff287c99
2020-01-17 17:53:17 +00:00
Yaroslav
d8368d0b30 satellite/payments: coinpayments add completed status, treat received status as pending, add balance for completed transactions only
Change-Id: I20494bdddfda6d4f37ba2c5b6f7955cd29a6d798
2020-01-17 17:26:34 +00:00
Isaac Hess
614e04d055 storagenode/pieces: Cache inits trash info from db
On pieces usage cache init we now load the trash info from the db. Also
fixes a test that was masking the failure here.

Change-Id: I9ff7da5bc6c0f74cf0942e20931b40e0c88d70fa
2020-01-17 09:33:05 -07:00
Bill Thorp
6f2f97b313 storagenode\gracefulexit: broke worker deleteOnePieceOrAll into deleteOnePiece and deleteAllPieces and deletePiece
Change-Id: Ic3bd21e89fa71e962c2bb1c4943f4696bc4f83e5
2020-01-17 15:07:34 +00:00
Bill Thorp
0c660f5490 satellite/payments: fixed test so that it passes on non-UTC systems, simplified date comparison
Change-Id: I5e1b31efc148701b9d4918bf9870fb72fbca75ac
2020-01-17 14:14:13 +00:00
Egon Elbre
5d80e22af9 private/tagsql: implement wrapper for sql.DB
Wrapper adds tracing and fixes context usage issues.

Change-Id: Ie6f7650eac87e2a2b64b760198498ba5857ad535
2020-01-17 13:52:12 +00:00