Commit Graph

3532 Commits

Author SHA1 Message Date
Jeff Wendling
16bb374deb storagenode/piecestore: add large timeouts to read/write operations
this is to help protect against intentional or unintentional
slowloris style problems where a client keeps a tcp connection
alive but never sends any data. because grpc is great, we have
to spawn a separate goroutine for every read/write to the stream
so that we can return from the server handler to cancel it if
necessary. yep. really.

additionally, we update the rpcstatus package to do some stack
trace capture and add a Wrap method for the times where we want
to just use the existing error.

also fixes a number of TODOs where we attach status codes to the
returned errors in the endpoints.

Change-Id: Id8bb8ff84aa34e0f711b0cf9bce3908b36a1d3c1
2020-01-23 19:20:49 +00:00
Egon Elbre
89a148047d private/testplanet: shutdown databases in reverse order
Since we have caches on top of databases and they are included in the
databases list, we need to shut them down in-reverse order to avoid
issues with flushing to a closed database.

Change-Id: I3f23a527a2a5425638b1a7e2cab84741f019d493
2020-01-23 18:55:57 +00:00
Isaac Hess
44de90ecc8 storagenode/pieces: Rename vars and update comments
A few variables were not renamed to the new standard piecesTotal and
piecesContentSize, so it was unclear which value was being used. These
have been updated, and some comments made more thorough.

Change-Id: I363bad4dec2a8e5c54d22c3c4cd85fc3d2b3096c
2020-01-23 11:00:24 -07:00
Isaac Hess
14fd6a9ef0 storagenode/pieces: Track total piece size
This change updates the storagenode piecestore apis to expose access to
the full piece size stored on disk. Previously we only had access to
(and only kept a cache of) the content size used for all pieces. This
was inaccurate when reporting the amount of disk space used by nodes.

We now have access to the total content size, as well as the total disk
usage, of all pieces. The pieces cache also keeps a cache of the total
piece size along with the content size.

Change-Id: I4fffe7e1257e04c46021a2e37c5adc6fe69bee55
2020-01-23 11:00:24 -07:00
VitaliiShpital
826fef0fac web/satellite: hyperlink on copy api key popup added
Change-Id: I662410ffd79220b171bb3dde0a61ab4864a6390a
2020-01-23 17:46:04 +00:00
NikolaiYurchenko
6bc989ae62 web/satellite: banner action area extended
Change-Id: I4f9a001846f2d66943c95f76728695d4cd1ac71f
2020-01-23 17:32:26 +00:00
VitaliiShpital
81d4c05d9b web/satellite: hyperlinks updated
Change-Id: I2ddf5350e02f832a5139df1064ef03777d5beadb
2020-01-23 17:17:33 +00:00
NikolaiYurchenko
9414b8eb48 web/satellite: redundant scrolls fixed
Change-Id: I0677c3bd9ca13aaf788261af4edbc4921a3aa633
2020-01-23 17:02:55 +00:00
VitaliiShpital
5151dc981c web/satellite: popup's images changed
Change-Id: I8ad36ca669b41ae901d08b068b1fa24ff0b14126
2020-01-23 16:45:57 +00:00
paul cannon
fd84fa6316 private/dbutil: rollback pending transactions on panic
We don't do a lot of panicking in our main code, so hopefully this won't
matter much, but we /do/ call panic a lot in our tests (t.Fatal,
require.NoError, etc). And when that happens, we need pending
transactions to be aborted or we can get into a deadlock situation when
something else tries to /Close/ that connection.

Change-Id: Idaf0d543ac95afea34f9b2393d1187f5322e9f0f
2020-01-23 16:30:19 +00:00
paul cannon
cadd727df8 cmd/uplink: just a silly spelling fix
Change-Id: If3b5abdee9fa51fc9c23f2f2de9edcd7ab9ed039
2020-01-23 16:15:01 +00:00
stefanbenten
62d3783928 storagenode/peer: ensure contact.external-address and server.address is valid
Change-Id: I634f0d355b0be18ba419726ace746921adda3ac0
2020-01-23 15:51:46 +00:00
Isaac Hess
40a890639d satellite/orders: Flush all pending bandwidth rollup writes on shutdown
Currently we risk losing pending bandwidth rollup writes even on a clean
shutdown. This change ensures that all pending writes are actually
written to the db when shutting down the satellite.

Change-Id: Ideab62fa9808937d3dce9585c52405d8c8a0e703
2020-01-23 08:12:41 -07:00
Isaac Hess
960e103082 satellite/orders: Rename orders_write_cache to rollups_write_cache
Change-Id: Icffca37e40bb8b2927b38d97728575321c2ad90c
2020-01-23 08:12:41 -07:00
Isaac Hess
0548c3f6bf satellite/orders: RollupsWriteCache has a single method to reset cache
Change-Id: I3ae18115dccd7ac8369313bd96951b9da6464cf3
2020-01-23 08:12:41 -07:00
Bryan White
fab58e9c12 cmd/uplink: hide advanced flags from output
Change-Id: I536af267c38e153aeea682fca4a74dc0ea2c42f0
2020-01-23 13:24:30 +00:00
Egon Elbre
c6f94ce9e4 satellite/metainfo: remove support for boltdb based pointerDB
By previous changes we can now remove testplanet.New and
also remove metainfo boltdb support.

Change-Id: I5bdfbbbb45967492728e705b34b2fedb4f28c381
2020-01-23 13:54:00 +02:00
Egon Elbre
5a4745eddb all: remove usages of testplanet.New
Ensure that tests use testplanet.Run, so we always require running
against all database backends.

Change-Id: I6b0209e6a4912cf3328bd35b2c31bb8598930acb
2020-01-22 22:42:57 +02:00
Egon Elbre
76fdb5d863 storage: add configurable lookup limits
Currently storage tests were tied to the default lookup limit.
By increasing the limits, the tests will take longer and sometimes
cause a large number of goroutines to be started.

This change adds configurable lookup limit to all storage backends.

Also remove boltdb.NewShared, since it's not used any more.

Change-Id: I1a052f149da471246fac5745da133c3cfc27582e
2020-01-22 21:35:56 +02:00
ccase
38f707c0d2
storage/redis: Limit should not be applied as count.
COUNT on a SCAN does not actually limit the results [1]. It limits the
amount of work a single call to SCAN will perform before returning. By
setting this to limit we can sometimes timeout on the request if limit
is very large.

This restores storage/redis back to it's original behavior.

[1]: https://redis.io/commands/scan#the-count-option

Change-Id: Ia75afb5152df909df38c9a7c6feb74d062f49d6a
2020-01-22 13:23:06 -05:00
Yingrong Zhao
5de4f66553 scripts/tests: change multisegment file to be 128kb
To cover a special case: an object that has 2 remote segments
and 1 inline segment.

Change-Id: Ia8d82bb67fc6cf76af9c7f44cd738cab6df591e9
2020-01-22 17:12:11 +00:00
ccase
818242f452
storage/postgreskv: Reverting back to the venerable PG CAS
This was inadvertently converted to the Cockroach version. This reverts
most of that and keeps the changes since then.

Change-Id: Ia440eeebb01bc89fbfa8ce266668030173061469
2020-01-22 11:36:25 -05:00
Fadila Khadar
b2c454dbd6 cmd/uplink: print user-friendly FATAL errors.
Change-Id: I9147a83bec2defa854e52aecbd9658e56e2aa123
2020-01-22 16:21:48 +00:00
Jeff Wendling
3b86917cc9 private/dbutil/pgutil: faster cockroach constraint finding
Change-Id: Ia100b9ef7d2d59dfad0389feb8f2e7c47c2c4c9b
2020-01-22 15:47:04 +00:00
Egon Elbre
fc2766eefc private/testplanet: flatten migration for running tests
Currently Cockroach DB setup takes a significant amount of time.
This flattens the database setup into a single query,
which improves the test time significantly.

The migration tests still test each migration separately.

Change-Id: Iaca16f34a6af3926fa2b5ebf618f939fd59460b3
2020-01-22 15:09:11 +00:00
Bryan White
d0041c94dc pkg/process: increase default log level to warn
Change-Id: I2ae089dcb584061627ff8254e7e34d7a6ff3a158
2020-01-22 14:31:28 +00:00
Egon Elbre
8b3db70329 private/testplanet: increase metainfo rate limit
Rate limit was causing tests to fail due to making too many request.

Change-Id: Iafbc97b4880b6d98c86045b28ca7583d27f51720
2020-01-22 13:57:38 +00:00
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