storj/private
paul cannon 2522ff09b6 satellite/overlay: configurable meaning of last_net
Up to now, we have been implementing the DistinctIP preference with code
in two places:

 1. On check-in, the last_net is determined by taking the /24 or /64
    (in ResolveIPAndNetwork()) and we store it with the node record.
 2. On node selection, a preference parameter defines whether to return
    results that are distinct on last_net.

It can be observed that we have never yet had the need to switch from
DistinctIP to !DistinctIP, or from !DistinctIP to DistinctIP, on the
same satellite, and we will probably never need to do so in an automated
way. It can also be observed that this arrangement makes tests more
complicated, because we often have to arrange for test nodes to have IP
addresses in different /24 networks (a particular pain on macOS).

Those two considerations, plus some pending work on the repair framework
that will make repair take last_net into consideration, motivate this
change.

With this change, in the #2 place, we will _always_ return results that
are distinct on last_net. We implement the DistinctIP preference, then,
by making the #1 place (ResolveIPAndNetwork()) more flexible. When
DistinctIP is enabled, last_net will be calculated as it was before. But
when DistinctIP is _off_, last_net can be the same as address (IP and
port). That will effectively implement !DistinctIP because every
record will have a distinct last_net already.

As a side effect, this flexibility will allow us to change the rules
about last_net construction arbitrarily. We can do tests where last_net
is set to the source IP, or to a /30 prefix, or a /16 prefix, etc., and
be able to exercise the production logic without requiring a virtual
network bridge.

This change should be safe to make without any migration code, because
all known production satellite deployments use DistinctIP, and the
associated last_net values will not change for them. They will only
change for satellites with !DistinctIP, which are mostly test
deployments that can be recreated trivially. For those satellites which
are both permanent and !DistinctIP, node selection will suddenly start
acting as though DistinctIP is enabled, until the operator runs a single
SQL update "UPDATE nodes SET last_net = last_ip_port". That can be done
either before or after deploying software with this change.

I also assert that this will not hurt performance for production
deployments. It's true that adding the distinct requirement to node
selection makes things a little slower, but the distinct requirement is
already present for all production deployments, and they will see no
change.

Refs: https://github.com/storj/storj/issues/5391
Change-Id: I0e7e92498c3da768df5b4d5fb213dcd2d4862924
2023-03-09 02:20:12 +00:00
..
api satellite/console: integrate sessions into satellite UI 2022-06-13 08:02:02 +00:00
apigen private/apigen: Change order of operations in api generation 2023-01-11 16:54:53 +00:00
blockchain private/blockchain: address checksum hex 2022-11-08 18:19:07 +00:00
compensation multinode/console: storage usage and total storage usage 2021-06-10 16:01:41 +00:00
crashreportpb all: fix deprecated ioutil commands 2022-10-11 15:27:29 +00:00
cui all: reformat comments as required by gofmt 1.19 2022-08-10 18:24:55 +00:00
currency private/currency: add strictcsv support to microunit 2020-03-31 14:57:04 -06:00
date Fix monthly earning estimation (#4282) 2021-11-17 18:26:21 -05:00
debugging all: fix dots 2020-07-16 14:58:28 +00:00
lifecycle satellite: more detailed goroutine labels 2022-05-11 17:50:55 +00:00
migrate private/migrate: add version to failed migration step 2023-01-23 15:29:35 +02:00
multinodeauth {storagenode,multinode/nodes}: use multinodeauth.Secret instead of []byte for APISecret 2022-08-23 11:04:04 +00:00
multinodepb {storagenode,web/multinode}: fix storage usage db/cache retrieval queries 2022-12-09 11:07:33 +00:00
nodeoperator all: fix error naming 2021-04-29 15:38:21 +03:00
post all: fix nolint directives 2022-10-11 18:31:20 +00:00
prompt private/prompt: remove dependency to go-prompt 2020-02-25 13:09:41 +02:00
revocation all: fix deprecated ioutil commands 2022-10-11 15:27:29 +00:00
server private/server,satellite/contact,misc: use new storj/common noise helpers 2023-02-07 09:53:45 -05:00
testblobs satellite/audit: add tests for concurrent audits 2023-02-09 19:58:50 +00:00
testmonkit all: reformat comments as required by gofmt 1.19 2022-08-10 18:24:55 +00:00
testplanet satellite/overlay: configurable meaning of last_net 2023-03-09 02:20:12 +00:00
testredis all: replace deprecated ioutil 2022-10-31 15:50:41 +00:00
testrevocation pkg/,private/: merge with private package 2021-04-23 16:37:28 +03:00
teststorj all: fix dots 2020-07-16 14:58:28 +00:00
testuplink all: fix deprecated ioutil commands 2022-10-11 15:27:29 +00:00
version all: fix deprecated ioutil commands 2022-10-11 15:27:29 +00:00
web private/web,satellite/console/.../consoleapi: serve rate limiting errors as JSON 2022-11-23 17:56:07 +00:00