Commit Graph

3176 Commits

Author SHA1 Message Date
NikolaiYurchenko
6a4e4e030f web/satellite: dates to utc; limits bug fix;
Change-Id: I00981f62f8540e5bd8688cf4d38f75c9dfd8b820
2020-01-08 12:15:25 +00:00
Jeff Wendling
c740b82e66 satellitedb/dbx: remove sed usage for bash script
turns out portable sed is hard: it has to work with both
linux and bsd sed, etc. instead, use a really really basic
bash script and a temporary file. this should be much less
likely to cause issues on a wide range of machines.

Change-Id: Ia759789fb52aa1ee3361426bb6c02ed4eac3d23a
2020-01-08 01:40:24 +00:00
paul cannon
6b21334c47 satellite/satellitedb: use txutil.ExecuteInTx in dbx WithTx()
Change-Id: I42ec21fdf117c661b3e1687a04014650c3a6ab97
2020-01-07 17:00:08 -06:00
Egon Elbre
3f38a7ed1e lib/uplink: revert library move
Moving lib/uplink actually makes implementing the new library harder.
Move the package back where it was.

Change-Id: If758e897e3e56155a48ae82b23904cd8cdd72c13
2020-01-07 18:39:15 +00:00
paul cannon
0c88a7b475 private/migrate: use transactional helpers and not Begin()
This code needs to work against cockroachDB, so transactions must be retried
when a retryable error is returned. This change puts migrate
transactions into the dbutil.WithTx transactional helpers to achieve
this in the easiest way.

Change-Id: Ib930e82d55cb0257357a222ce9131e6e53372c03
2020-01-07 18:25:38 +00:00
paul cannon
0c5e381434 satellite/console: use transaction helpers in consoledb
Transactions in our code that might need to work against CockroachDB
need to be retried in the event of a retryable error. The transaction
helper functions in dbutil do that automatically. I am changing this
code to use those helpers instead.

I also fleshed out consoledb_test.go to do actual inserts and gets to
make sure things were working correctly.

Change-Id: I089bf4c776d15dc8578080e26760bd6dff4beec9
2020-01-07 17:59:10 +00:00
paul cannon
22b6e9220a satellite/satellitedb: use transaction helpers in irreparabledb
Transactions in our code that might need to work against CockroachDB
need to be retried in the event of a retryable error. The transaction
helper functions in dbutil do that automatically. I am changing this
code to use those helpers instead.

Change-Id: I22b850ce5859fa07d13bf475be5140e6bde95b8a
2020-01-07 17:40:09 +00:00
Moby von Briesen
93f3650cf8 ci: add build number to postgres and redis docker containers for
versions and rolling upgrade tests

If the containers are just named `postgres` and `redis`, we run into
build issues when the master branch and a release branch are building
simultaneously. This change fixes that.

Change-Id: Ibd49a0369900ab4865a4cdc6d6c89991cb7f044f
2020-01-07 12:18:57 -05:00
paul cannon
723ed23298 satellite/satellitedb: use transaction helpers in orders
Transactions in our code that might need to work against CockroachDB
need to be retried in the event of a retryable error. The WithTx
helper functions in dbutil and dbx do that automatically. I am changing
this code to use those helpers instead.

Change-Id: Iaf492af35471931125f2b7365aa4338f44154881
2020-01-07 16:31:47 +00:00
Egon Elbre
05e2b0ca86 mod: bump common and some other packages
Change-Id: Icf73220f5182f5a2fd1431471825948c300c0bea
2020-01-07 18:09:59 +02:00
Michal Niewrzal
6607dacb1c uplink/metainfo: move listing to kvmetainfo
https://storjlabs.atlassian.net/browse/V3-517

Change-Id: Ie23017f7cb4994aec835ff8c8e10c917b79966a6
2020-01-07 16:22:44 +01:00
Ivan Fraixedes
027e3d4f62
satellte/metainfo: Avoid a noisy warning
DeleteObjectPieces must not call overlay cache KnownReliable method with
an empty list of node IDs for avoiding to log a useless noisy warning.

Change-Id: Ibe2a34f2913f003d3ba020f9764c1369fa63123b
2020-01-07 14:15:04 +01:00
Michal Niewrzal
e232042e85 satellite/metainfo: move old API tests to separate file
Move tests for old Metainfo API to separate file. Metainfo tests file is
large enough and in future it will be easier to remove old tests.

Change-Id: I9421907ef015a6dfa65f4de6ef01b2d2c8baa7df
2020-01-07 11:34:33 +00:00
Egon Elbre
fb4b11d13e
scripts: remove old scripts (#3742) 2020-01-07 13:28:41 +02:00
littleskunk
6861f28bbf release/script: allow RC release tags
Change-Id: I635f4579e990b638c6579318dee632dce15e3cf1
2020-01-07 10:43:03 +00:00
Ivan Fraixedes
9618959f1d
satellite/metainfo: Use errs2 IsRPC helper function
Use the helper function IsRPC of the err2 package rather than checking
if an error is of a specific RPC status code with an 'if' conditional.

Change-Id: Ibe89d6c2d836307c3112a6d7cc6bf95f0f985fd2
2020-01-07 08:26:45 +01:00
Natalie Ventura Villasana
1cb0f80a8d satellite/gracefulexit: dq node on exit fail
Disqualifies a node when the node fails to complete a graceful
exit.

Adds a new DisqualifyNode method to the overlay cache, since there
wasn't an existing method to disqualify a node but do nothing else
to its stats.

Adds checks to existing tests to make sure that a storage node that
fails a graceful exit is marked as disqualified in the overlay
cache.

https: //storjlabs.atlassian.net/browse/V3-3342
Change-Id: I4d554a519ab59db31ad3b8e28764c8683a6e3888
2020-01-06 19:16:26 -05:00
paul cannon
4a26fb5bd5 satellite/satellitedb: don't use crdb.ExecuteTx with postgres
crdb.ExecuteTx is great, but I don't think it will work right with
PostgreSQL. It works by way of cockroach savepoints, which allows
it to react to retryable errors, whereas tx.Commit() doesn't. But
I don't think PostgreSQL savepoints work exactly the same way. I'm not
100% sure, but it doesn't seem worth the risk.

So, I'm switching one case here to use the new dbutil.WithTx instead,
which will use crdb.ExecuteTx if appropriate. The other case doesn't
need a transaction at all.

Change-Id: I39283f3b5d8d47596db7aff5048bb74597e5918f
2020-01-06 23:51:35 +00:00
paul cannon
0135852a0e storage/postgreskv: use transactional helper
We may never need this code to work with CockroachDB, but I'm on a
mission to avoid problematic uses of Begin() and BeginTx(), and anywhere
they appear is a possible place for someone to copy-and-paste and do
something wrong. dbutil.WithTx makes this code a little bit simpler too,
so it seems worthwhile.

Change-Id: I9b4ab484db4590cad5ab07de515bbf5d9708daed
2020-01-06 23:24:44 +00:00
paul cannon
f3aee1b758 satellite/satellitedb: use transaction helpers in containment
Transactions in our code that might need to work against CockroachDB
need to be retried in the event of a retryable error. The transaction
helper functions in dbutil do that automatically. I am changing this
code to use those helpers instead.

Change-Id: I660540885a0784fae844cf99376d1537e208fa69
2020-01-06 23:07:38 +00:00
Jeff Wendling
2549c601e9 all: bump storj.io/common dependency
Change-Id: I2e9ba0a76380d99d8650ae6921ed0a3ffe436536
2020-01-06 22:41:06 +00:00
Moby von Briesen
6c2e4cc0cd satellite/overlay: Return NodeLastContact instead of a node dossier from
overlay.GetOfflineNodesLimited

We only care about node ID, address, and last contact success/failure
from the downtime service, so the overlay should only return these
values for the downtime-specific queries.

Change-Id: I08a6ecfdd2a12b82cae62e87d6adeab53975bfce
2020-01-06 17:12:30 -05:00
paul cannon
4203e25c54 satellite/satellitedb: use transaction helpers in overlaycache
Transactions in our code that might need to work against CockroachDB
need to be retried in the event of a retryable error. The transaction
helper functions in dbutil do that automatically. I am changing this
code to use those helpers instead.

Change-Id: Icd3da71448a84c582c6afdc6b52d1f345fe9469f
2020-01-06 21:42:57 +00:00
paul cannon
b072e16ff7 satellite/satellitedb: use transaction helpers in peeridentities
Transactions in our code that might need to work against CockroachDB
need to be retried in the event of a retryable error. The transaction
helper functions in dbutil do that automatically. I am changing this
code to use those helpers instead.

Change-Id: Ibaadd2c8540ba5c8cccd6ecbf529017ab98b78ca
2020-01-06 20:42:15 +00:00
paul cannon
eb81879d47 satellite/satellitedb: use transaction helpers in usercredits
Transactions in our code that might need to work against CockroachDB
need to be retried in the event of a retryable error. The transaction
helper functions in dbutil do that automatically. I am changing this
code to use those helpers instead.

Change-Id: Id24906f5f3ae83245dabb218e1f70e0bcb3b417a
2020-01-06 20:40:45 +00:00
paul cannon
6231842422 private/dbutil: add WithTx transaction helpers
These helpers will work similar to the WithTx method we have added to
our dbx.DB instances, but it will use crdb.ExecuteTx or crdb.ExecuteInTx
when the backend is CockroachDB, so that transactions are retried
correctly.

Anything that uses transactions and might need to work against
CockroachDB needs to handle "RetriableError" from cockroachdb by
restarting the transaction. This will probably be a large pain if not
using these helpers or something very like them.

Subsequent changes will undertake transforming all db-transaction uses
in satellite code so that they are cockroach-safe.

Change-Id: I648b8de2168612c67b9d6eb8402bccf8286249a9
2020-01-06 20:06:45 +00:00
Egon Elbre
f41d440944 all: reduce number of log messages
Remove starting up messages from peers. We expect all of them to start,
if they don't, then they should return an error why they don't start.
The only informative message is when a service is disabled.

When doing initial database setup then each migration step isn't
informative, hence print only a single line with the final version.

Also use shorter log scopes.

Change-Id: Ic8b61411df2eeae2a36d600a0c2fbc97a84a5b93
2020-01-06 19:03:46 +00:00
paul cannon
a33734bee7 satellite/satellitedb/dbx: add cockroach driver type
Change-Id: I7a0da6e066c67a521fc1b23b085ab8554eee0d4c
2020-01-06 18:01:03 +00:00
Moby von Briesen
ea84af578b scripts/tests/rollingupgrade: create new test files for final upload
stage

The test-versions script no longer uses the `testfiles` directory, which
the final upload for the rolling-upgrade script depended on. This change
creates and populates a `testfiles` diirectory during the final upload
stage of the rolling upgrade test.

Change-Id: Iabeccbadc55a8c85a1febbd5eb4e7d889a57a8dc
2020-01-06 12:31:12 -05:00
Egon Elbre
91947311f5 ci: always try to pull latest image
Change-Id: Ic1422a96705f8e66876f5c724060d7c389c5da3d
2020-01-06 15:28:04 +00:00
Yingrong Zhao
07a1702f41 scripts/tests/rollingupgrade: fix test-versions.sh path referrence
Change-Id: I5c696e5d38c087c50f025796e2f48876883d0f4a
2020-01-04 19:42:15 -05:00
Yingrong Zhao
71c5c2213f scripts/tests/testversions: make binary installation and upload/download running in parallel
Change-Id: I16d87f7e16e2daf30e4d7ee5490b76c175b06930
2020-01-04 16:39:45 +00:00
Simon Guindon
80b41af8f1 satellite/metainfo: Fixed bug that discarded context cancellation errors
When the context was being cancelled the error was being discarded within the rate limiting error handling which caused tests to fail.
Change-Id: I5c6458c16da09a11531233ea0ee80d914969cb3f
2020-01-03 22:48:12 -05:00
Ivan Fraixedes
fc4ea28695 satellite/metainfo: Return ErrObjectNotFound
deletePointer must return an ErrObjectNotFound rather than a rpc status
error NotFound because the callers must distinguish such error if it
comes from the getPointer or from the UnsynchronizedDelete.

Change-Id: I68b4e45a2765e63b73bf85c2c39a5fc0198373f6
2020-01-03 22:01:29 +00:00
Jeff Wendling
29fe206b9a satellite/gc: add timeout to retain requests
We don't want slowloris nodes to be able to indefinitely block
up the satellite, so add a timeout. Some monitoring inspection
showed the largest success times being on the order of 30s, so
a 1min timeout should be sufficient to kill the misbehaving nodes.

Change-Id: I5e2c3480a15f6304e37262d0a4d30d07eae99bb3
2020-01-03 21:46:46 +00:00
Jeff Wendling
828d0b9984 pkg/server: set TCP_USER_TIMEOUT and monitor leaked conns
Go will, by default, set tcp keep alives on sockets. But
the kernel does not send keep alives to sockets that have
a non-empty send queue. That can cause connections that
hang forever.

So we set TCP_USER_TIMEOUT on all of the sockets as well.
That option will close any connection that has not received
an ack for any sent data (keep alive or otherwise) in the
configured time period. This places an upper bound on the
amount of time a socket can be stuck due to a client not
acknowleding data.

See https://blog.cloudflare.com/when-tcp-sockets-refuse-to-die/
for more information on what these options do and how they
interact.

Additionally, make sure that we close every connection coming
from the listeners by wrapping them in a type with a finalizer
that closes the connection, much like the os package does for
file handles. It monitors if a connection was closed due to a
finalizer so that we can go and look for the bug if we ever
see a non-zero value.

Change-Id: Idc6c0564224b8dc2e4c9d769e80374ed1fe8cce0
2020-01-03 21:31:09 +00:00
Cameron Ayer
0038abb51b private/testplanet: use redis for live accounting
storing live accounting in memory will not work, as the core and api each create
their own instance. Using redis will allow each to access the same store

Change-Id: I4c8250b579d7b6b6d8991bc890894573626effe6
2020-01-03 21:04:50 +00:00
Simon Guindon
e1e7cebe49 satellite/metainfo: added rate limiting support to the metainfo loop.
As per discussed we decided to rate limit how fast we iterate through
the metainfo database in the metainfo loop. This puts in place a
mechanism for rate limiting and burst limiting if need be in the future.

The default for this rate limiting is still no limits so it stays the
same as our previous functionality.

Change-Id: I950f7192962b0e49f082d2c4284e2d52b0a925c7
2020-01-03 15:00:29 -05:00
Ethan
05b406e992 satellite:{downtime,overlay}: Implement offline node detection chore
https://storjlabs.atlassian.net/browse/V3-3398

Change-Id: I598c3bad819026377d1d113c099dc9bba8b02742
2020-01-03 17:10:03 +00:00
Matt Robinson
5aac77c2a1
Slack the build team instead of everyone (#3739)
Change-Id: If55105fa99ebb32fa84dd595258f83838d3150f1
2020-01-03 11:54:01 -05:00
Yaroslav
389567fc9e satellite/console: add credit card charges to billing history
Change-Id: I82a08c42c01086dc7fb9508da5c6c0baa2438124
2020-01-03 17:34:59 +02:00
Bryan White
325790703f installer/windows: batch file improvements (#3441) 2020-01-03 15:28:04 +02:00
Yaroslav
0cc7056a9a satellite/console: convert dates to UTC in advanced usage reports
Change-Id: I5c72c869533a7613bffdb8077fdedff2a4e203d0
2020-01-03 14:17:37 +02:00
Michal Niewrzal
38eff60698 satellite/metainfo: adjust old API test to new API
We are missing some tests for new Metainfo API that we have for old API.
This is first change to adjust old tests to new API.

Change-Id: Ie2b16bf85de8633662f952e863dbf3d409d801d9
2020-01-03 11:05:14 +01:00
Moby von Briesen
e34ac3ef3a ci,scripts/tests/rolling-upgrade: run rolling upgrade test on private jenkins
Change-Id: Ic1c9f7539ee0ac371bcb856bdbcac2ff6c0ccc65
2020-01-02 16:27:41 -05:00
Moby von Briesen
aecea820fc scripts: add rolling upgrade test script
Change-Id: Ibf79c8e40da54520ce17e2e1f66124c117b32b53
2020-01-02 13:38:56 -05:00
Ethan
8859c36234 satellite/{downtime,contact}: Add CheckNodeAvailability for use within the downtime tracking chores.
https://storjlabs.atlassian.net/browse/V3-2545

Change-Id: I1dd54a0c77cb4905bb1f350beeb82c6f7700ee70
2020-01-02 18:24:11 +00:00
Egon Elbre
6098f606a2 lib/uplink: move to uplink
Setup aliases in lib/uplink and set uplink as the default.

Change-Id: Ic06b5f3d59fe402faaed2143fdf4b2314e3d06b9
2020-01-02 17:56:16 +00:00
Moby von Briesen
ff74b44c5f satellite/overlay: Add ability for overlay to get offline nodes ordered by last checked time
This is required for the downtime tracking service: https://storjlabs.atlassian.net/browse/V3-2545

Change-Id: I286cdc07d802393948eb10c25c45ba78cc3ceafc
2020-01-02 16:39:38 +00:00
Ivan Fraixedes
c3b58f1656 satellte/metainfo: Make BeginDeleteObject to delete pieces
For improving the deletion performance we are shifting the
responsibility to delete the pieces of the object from Uplink to the
Satellite.

BeginDeleteObject was the first call to return the stream ID which was
used for after retrieving the list of segments and then get addressed
order limits for deleting the pieces (of each segment) from the storage
nodes.

Now we want the Satellite deletes the pieces of all the object segments
from the storage nodes hence we don't need anymore to have several
network round trips between the Uplink and the Satellite because the
Satellite can delete all of them in the initial BegingDeleteObject
request.

satellite/metainfo.ListSegments has been changed to return 0 items if
the pointer of the last segment of an object is not found because we
need to preserve the backward compatibility with Uplinks that won't be
updated to the last release and they rely on listing the segments after
calling BeginDeleteObject for retrieving the addressed order limits
to contact the storage nodes to delete the pieces.

Change-Id: I5f99ecf27d62d65b0a062936b9b17581ef692af0
2020-01-02 15:53:59 +00:00