storj/satellite
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
..
abtesting console/abTesting: add support for AB testing 2022-10-27 10:57:12 +00:00
accounting satellite/payments/stripecoinpayments: undo price override removal 2023-02-24 16:54:51 +00:00
admin satellite/admin: add Groups to config 2023-02-27 16:07:20 +00:00
analytics satellite/{db,analytics,payments}: add chore for auto account freeze 2023-03-01 09:31:27 +00:00
attribution satellite: remove rewards package 2023-01-31 11:46:50 +00:00
audit satellite/audit: fix go1.19 dial timeouts and log more 2023-02-28 17:09:47 +00:00
buckets satellite/accounting/tally: fix looping over all buckets 2022-12-07 10:32:23 +00:00
compensation all: reformat comments as required by gofmt 1.19 2022-08-10 18:24:55 +00:00
console satellite/console: use custom session duration 2023-03-08 14:55:02 +00:00
contact satellite/overlay: configurable meaning of last_net 2023-03-09 02:20:12 +00:00
gc satellite/gc: improve comments 2023-03-08 13:15:13 +00:00
geoip satellite/geoip: update node check-in to associate a country code 2021-11-10 16:44:41 +01:00
gracefulexit satellite/metabase: add piece size calculation to segment 2023-02-22 11:04:02 +00:00
inspector {satellite/metabase, satellite/metainfo, satellite/inspector} : Use metabase.GetObjectLastCommitted instead metabase.GetObjectExactVersion 2022-09-08 07:27:22 +00:00
internalpb all: fix deprecated ioutil commands 2022-10-11 15:27:29 +00:00
mailservice satellite/consoleweb: fix flaky TestAuth tests 2022-08-04 19:06:07 +00:00
metabase satellite/rangedloop: migrate segments verification from segment loop 2023-03-08 17:00:11 +00:00
metainfo satellite/metabase: add piece size calculation to segment 2023-02-22 11:04:02 +00:00
metrics satellite/metabase/rangedloop: measure observer duration (#5350) 2022-12-21 21:58:08 +01:00
nodeapiversion satellite/nodeapiversion: new table for tracking node api usage 2020-07-09 15:02:25 +00:00
nodeevents satellite/satellitedb/dbx: document node tables 2023-02-24 14:05:55 +00:00
nodeselection/uploadselection satellite/overlay: configurable meaning of last_net 2023-03-09 02:20:12 +00:00
nodestats satellite: return interval_end_time in DailyStorageUsage endpoint 2022-07-27 18:24:27 +00:00
oidc all: fix deprecated ioutil commands 2022-10-11 15:27:29 +00:00
orders satellite/orders: cleanup after altering primary key 2023-03-06 16:03:11 +00:00
overlay satellite/overlay: configurable meaning of last_net 2023-03-09 02:20:12 +00:00
payments satellite/payments: return public project ID for project charges 2023-03-06 22:50:21 +00:00
repair repairer: monitor non-nil limit amount 2023-03-06 20:39:45 +00:00
reputation satellite/reputation: if node is DQd or exited skip applying audit 2023-02-21 18:31:21 +00:00
revocation satellite/satellitedb: move tests to their domains 2021-02-19 17:29:15 +02:00
satellitedb satellite/overlay: configurable meaning of last_net 2023-03-09 02:20:12 +00:00
snopayouts all: fix error naming 2021-04-29 15:38:21 +03:00
admin.go satellite/payments/stripecoinpayments: avoid mock cross-talk in tests 2023-03-03 20:20:48 +02:00
api.go satellite/payments/stripecoinpayments: avoid mock cross-talk in tests 2023-03-03 20:20:48 +02:00
auditor.go satellite/audit: split out auditor process 2022-12-16 12:44:32 -06:00
configlock_test.go all: fix deprecated ioutil commands 2022-10-11 15:27:29 +00:00
core.go satellite/payments/stripecoinpayments: avoid mock cross-talk in tests 2023-03-03 20:20:48 +02:00
gc-bf_test.go satellite: use ranged loop with GC-GF peer 2023-02-13 18:32:21 +00:00
gc-bf.go satellite: use ranged loop with GC-GF peer 2023-02-13 18:32:21 +00:00
gc.go gc: remove segment loop dependency 2023-02-03 10:31:16 +00:00
peer.go satellite/{db,analytics,payments}: add chore for auto account freeze 2023-03-01 09:31:27 +00:00
rangedloop.go satellite/rangedloop: migrate segments verification from segment loop 2023-03-08 17:00:11 +00:00
repairer.go satellite/audit: newContainment->containment 2022-12-16 17:59:52 +00:00