Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dual DHT shortcutting SearchValue for previously published records #692

Open
aschmahmann opened this issue Aug 31, 2020 · 2 comments
Open

Comments

@aschmahmann
Copy link
Contributor

The dual DHT uses the parallel router SearchValue:

func (dht *DHT) SearchValue(ctx context.Context, key string, opts ...routing.Option) (<-chan []byte, error) {
p := helper.Parallel{Routers: []routing.Routing{dht.WAN, dht.LAN}, Validator: dht.WAN.Validator}
return p.SearchValue(ctx, key, opts...)
}

The parallel router aborts as soon as any of the routers have completed their search. This is problematic if we first we publish and then search because publishing will store a copy of the record in our datastore during the put

err = dht.putLocal(key, rec)

and then when we do a search we will get that record:

if rec, err := dht.getLocal(key); rec != nil && err == nil {

If the LAN DHT is much smaller than the WAN DHT (e.g. the normal online case) or the WAN DHT is much smaller than the LAN DHT (e.g. an offline case or one using a segregated network like CJDNS) then one of the DHTs will return immediately with a single record (the one previously published) and therefore cause an abort of the other DHT query.

@petar @Stebalien

@wenyue
Copy link

wenyue commented Jun 28, 2024

This error has not been fixed yet.

@guillaumemichel
Copy link
Contributor

@wenyue Thanks for pointing this out. If you would like to address this issue, please consider submitting a pull request. Your contribution would be greatly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants