WIP: object: Add priority metric based on geo distance #1640

Draft
acid-ant wants to merge 2 commits from acid-ant/frostfs-node:feature/metric-geo-distance into master
Member

New metric $geoDistance uses geo distance between two nodes. Distance calculation based on information from locodedb and node attribute UN-LOCODE.

Signed-off-by: Anton Nikiforov an.nikiforov@yadro.com

New metric `$geoDistance` uses geo distance between two nodes. Distance calculation based on information from [locodedb](https://git.frostfs.info/TrueCloudLab/frostfs-locode-db) and node attribute `UN-LOCODE`. Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
acid-ant added 2 commits 2025-02-07 14:55:01 +00:00
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
[#xx] object: Add priority metric based on geo distance
Some checks failed
DCO action / DCO (pull_request) Failing after 44s
Vulncheck / Vulncheck (pull_request) Failing after 1m4s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m32s
Build / Build Components (pull_request) Successful in 1m42s
Tests and linters / Run gofumpt (pull_request) Successful in 1m57s
Tests and linters / Staticcheck (pull_request) Successful in 3m5s
Tests and linters / Lint (pull_request) Successful in 3m52s
Tests and linters / Tests with -race (pull_request) Successful in 6m7s
Tests and linters / Tests (pull_request) Successful in 6m42s
Tests and linters / gopls check (pull_request) Successful in 7m2s
5494320fb3
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
acid-ant force-pushed feature/metric-geo-distance from 5494320fb3 to ed3e0244e9 2025-02-07 14:56:13 +00:00 Compare
acid-ant force-pushed feature/metric-geo-distance from ed3e0244e9 to ff6449c6c7 2025-02-07 14:56:40 +00:00 Compare
acid-ant force-pushed feature/metric-geo-distance from ff6449c6c7 to d2ebed13c4 2025-02-11 14:09:02 +00:00 Compare
acid-ant force-pushed feature/metric-geo-distance from d2ebed13c4 to c4e5e33650 2025-02-11 14:39:44 +00:00 Compare
acid-ant force-pushed feature/metric-geo-distance from c4e5e33650 to 98d690063c 2025-02-11 14:48:17 +00:00 Compare
acid-ant changed title from WIP: object: Add priority metric based on geo distance to object: Add priority metric based on geo distance 2025-02-11 14:49:45 +00:00
requested reviews from storage-core-committers, storage-core-developers 2025-02-11 14:49:48 +00:00
dstepanov-yadro requested changes 2025-02-12 13:34:05 +00:00
@ -685,3 +688,3 @@
}
err := c.readConfig(appCfg)
relayOnly := nodeconfig.Relay(appCfg)

I think all this code could be moved to initLocalNodeInfo

I think all this code could be moved to `initLocalNodeInfo`
@ -688,0 +705,4 @@
},
locodebolt.ReadOnly(),
)
err := locodeDB.Open()

I think frostfs-node should not open locode db, if config has no $geoDistance priority

I think frostfs-node should not open locode db, if config has no $geoDistance priority
@ -44,0 +78,4 @@
// the value of attribute is the same. In other case return [1].
func (gm *geoDistanceMetric) CalculateValue(_ *netmap.NodeInfo, to *netmap.NodeInfo) (int, error) {
tl := to.LOCODE()
if v, ok := gm.distance[tl]; ok {

mtx.RLock required

`mtx.RLock` required
achuprov reviewed 2025-02-12 17:15:49 +00:00
@ -44,0 +125,4 @@
dist := math.Sin(radLat1)*math.Sin(radLat2) + math.Cos(radLat1)*math.Cos(radLat2)*math.Cos(radTheta)
if dist > 1 {
Member

Should dist < -1 be checked?

Should `dist < -1` be checked?
acid-ant changed title from object: Add priority metric based on geo distance to WIP: object: Add priority metric based on geo distance 2025-02-13 07:58:54 +00:00
All checks were successful
DCO action / DCO (pull_request) Successful in 36s
Required
Details
Vulncheck / Vulncheck (pull_request) Successful in 54s
Required
Details
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m28s
Required
Details
Build / Build Components (pull_request) Successful in 1m26s
Required
Details
Tests and linters / Run gofumpt (pull_request) Successful in 1m20s
Required
Details
Tests and linters / Staticcheck (pull_request) Successful in 2m15s
Required
Details
Tests and linters / Lint (pull_request) Successful in 3m1s
Required
Details
Tests and linters / Tests (pull_request) Successful in 4m48s
Required
Details
Tests and linters / Tests with -race (pull_request) Successful in 5m5s
Required
Details
Tests and linters / gopls check (pull_request) Successful in 5m24s
Required
Details
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u feature/metric-geo-distance:acid-ant-feature/metric-geo-distance
git checkout acid-ant-feature/metric-geo-distance
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-node#1640
No description provided.