Go to file
Egon Elbre 62e3bf5b34 storagenode/retain: fix concurrency issues (#2828)
* nicer flags

* fix concurrency

* add concurrent workers

* initialize things

* fix tests

* close retain service

* ensure we don't have workers working on the same satellite

* ensure things compile

* fix other compilation issues:

* concurrency changes

ran this with `go test -count=1000` and it passed all of them.

- we add a closed channel so that we can select on it with
  context cancellation.
- we put a once in so we only close the channel once.
- every time the queue/running state changes, we have to broadcast
  because we may want to wake up N pending Wait calls or other
  concurrent workers.
- because we broadcast, we don't need to do the polling in Wait
  anymore.
- ensure Run doesn't start multiple times so that we don't have
  to worry about concurrent Close with multiple Runs.
- hold the lock while we start workers so that a concurrent Close
  with Run can't decide that there's nothing started and exit
  and then have Run start things.
- make sure to poll the closed/context channels through loops
  or at the start of Run calls in case Close happens first.
- these polls should be under a mutex because they have a default
  case which makes it possible to schedule such that Close hasn't
  executed the channel close so it starts more work.
- cancel a local Run context when it's going to exit to make sure
  that any retainPieces calls have a canceled context.
- hopefully enough comments to both check my work and help readers
  digest what's going on.

Change-Id: Ida0e226a7e01e8ae64fa2c59dd5a84b04bccfbd7

* use the retain error class

Change-Id: I1511eaef135f98afd57b878e997e4c8a0d11cafc

* concurrency fixes again

- forgot to update the gc test to use the old Wait api.
- we need to drop the lock while we wait for the workers
  to exit, because they may be blocked on the condition
  variable
- additionally, we need to broadcast when we close the
  signal channel because the state changed: they want
  to wake up and exit.

Change-Id: I4204699792275260cd912f29aa73720f7d9b14b5

* undo my misguided rename

Change-Id: I6baffe1eb0434e260212c485bbcc01bed3250881

* remove pollInterval

* format paragraph more nicely

* move skew calculation into retain pieces
2019-08-28 16:35:25 -04:00
.github architecture-owner codeowners for design docs (#2735) 2019-08-07 17:13:50 -06:00
bootstrap all: enable staticcheck (#2849) 2019-08-22 13:40:15 +02:00
cmd cmd/*: Change loglevel from error to warn (#2876) 2019-08-27 11:24:47 +02:00
docs/design docs/design: update audit v2 (#2901) 2019-08-28 22:47:43 +03:00
examples lib/uplink: remove redis and bolt dependencies (#2812) 2019-08-19 16:10:38 -06:00
internal storagenode/retain: fix concurrency issues (#2828) 2019-08-28 16:35:25 -04:00
lib all: use fewer storage nodes to improve test memory usage (#2875) 2019-08-26 14:40:44 -04:00
linksharing lib/uplink: ensure it's silent by default (#2676) 2019-08-01 07:14:09 -04:00
mobile all: enable staticcheck (#2849) 2019-08-22 13:40:15 +02:00
pkg lint: add linting for errs package (#2881) 2019-08-27 19:07:12 +03:00
resources Add LE CA to satellite and storagenode images (#1688) 2019-04-08 13:06:01 -04:00
satellite storagenode/retain: fix concurrency issues (#2828) 2019-08-28 16:35:25 -04:00
scripts jenkins: backwards-compatibility, don't overwrite installed binaries (#2892) 2019-08-28 09:57:34 -04:00
storage all: enable staticcheck (#2849) 2019-08-22 13:40:15 +02:00
storagenode storagenode/retain: fix concurrency issues (#2828) 2019-08-28 16:35:25 -04:00
uplink lint: add linting for errs package (#2881) 2019-08-27 19:07:12 +03:00
versioncontrol don't use global loggers (#2675) 2019-07-31 17:38:44 +03:00
web web/satellite project related bugs fixed (#2894) 2019-08-28 17:23:37 +03:00
.clabot Add Karl Mozurkewich (#2720) 2019-08-06 15:54:32 +02:00
.dockerignore Forward-port release-alpha8 build script issues (#1726) 2019-04-09 23:01:10 -06:00
.gitignore docs/design: satellite service separation (#2815) 2019-08-28 09:28:53 -07:00
.golangci.yml all: enable staticcheck (#2849) 2019-08-22 13:40:15 +02:00
CODE_OF_CONDUCT.md Adding CODE_OF_CONDUCT to storj/storj repo (#779) 2018-12-07 15:10:02 -05:00
docker-compose.yaml testplanet.Run (#1222) 2019-02-04 22:37:46 +02:00
Dockerfile.jenkins Add aarch64 support and use go 1.12.9 (#2814) 2019-08-19 12:40:16 +03:00
go.mod go.mod: update grpc-go (#2778) 2019-08-14 21:43:21 +03:00
go.sum all: enable staticcheck (#2849) 2019-08-22 13:40:15 +02:00
Jenkinsfile Fix Jenkins master builds (#1889) 2019-05-03 14:14:38 -04:00
Jenkinsfile.gerrit lint: add linting for errs package (#2881) 2019-08-27 19:07:12 +03:00
Jenkinsfile.public lint: add linting for errs package (#2881) 2019-08-27 19:07:12 +03:00
LICENSE license code with agplv3 (#126) 2018-07-05 10:24:26 -04:00
Makefile [build]: Adjust arm63v6 and aarch64 images to match convention (#2845) 2019-08-28 08:18:56 -04:00
package-lock.json Satellite api keys frontend (#1039) 2019-02-01 18:19:30 +02:00
proto.lock storagenode/piecestore + uplink/piecestore: return PieceHash and original OrderLimit during GET_REPAIR (#2775) 2019-08-26 14:57:41 -04:00
README.md Update Readme to actual needed Go Version (#2415) 2019-07-02 10:50:36 +02:00

Storj V3 Network

Go Report Card Go Doc Coverage Status Alpha

Storj is building a decentralized cloud storage network. Check out our white paper for more info!


Storj is an S3-compatible platform and suite of decentralized applications that allows you to store data in a secure and decentralized manner. Your files are encrypted, broken into little pieces and stored in a global decentralized network of computers. Luckily, we also support allowing you (and only you) to retrieve those files!

Table of Contents

Contributing to Storj

All of our code for Storj v3 is open source. Have a code change you think would make Storj better? Please send a pull request along! Make sure to sign our Contributor License Agreement (CLA) first. See our license section for more details.

Have comments or bug reports? Want to propose a PR before hand-crafting it? Jump on to our Rocketchat and join the #dev channel to say hi to the developer community and to talk to the Storj core team.

Want to vote on or suggest new features? Post it on ideas.storj.io.

Issue tracking and roadmap

See the breakdown of what we're building by checking out the following resources:

Install required packages

To get started running Storj locally, download and install the latest release of Go (at least Go 1.12) at golang.org.

You will also need Git. (brew install git, apt-get install git, etc). If you're building on Windows, you also need to install and have gcc setup correctly.

We support Linux, Mac, and Windows operating systems. Other operating systems supported by Go should also be able to run Storj.

Download and compile Storj

Aside about GOPATH: Go 1.11 supports a new feature called Go modules, and Storj has adopted Go module support. If you've used previous Go versions, Go modules no longer require a GOPATH environment variable. Go by default falls back to the old behavior if you check out code inside of the directory referenced by your GOPATH variable, so make sure to use another directory, unset GOPATH entirely, or set GO111MODULE=on before continuing with these instructions.

First, fork our repo and clone your copy of our repository.

git clone git@github.com:<your-username>/storj storj
cd storj

Then, let's install Storj.

go install -v ./cmd/...

Make changes and test

Make the changes you want to see! Once you're done, you can run all of the unit tests:

go test -v ./...

You can also execute only a single test package if you like. For example: go test ./pkg/kademlia. Add -v for more informations about the executed unit tests.

Push up a pull request

Use Git to push your changes to your fork:

git commit -a -m 'my changes!'
git push origin master

Use Github to open a pull request!

Start using Storj

Our wiki has documentation and tutorials. Check out these three tutorials:

License

The network under construction (this repo) is currently licensed with the AGPLv3 license. Once the network reaches beta phase, we will be licensing all client-side code via the Apache v2 license.

For code released under the AGPLv3, we request that contributors sign our Contributor License Agreement (CLA) so that we can relicense the code under Apache v2, or other licenses in the future.

Support

If you have any questions or suggestions please reach out to us on Rocketchat or email us at support@tardigrade.io.