orchestrator icon indicating copy to clipboard operation
orchestrator copied to clipboard

forget operations support removing from kv

Open MaxFedotov opened this issue 6 years ago • 10 comments

Related issue: #966

Description: Support for removing data from KV stores for different forget operations(ForgetInstance, ForgetCluster, ForgetLongUnseenInstances, ForgetUnseenInstancesDifferentlyResolved).

MaxFedotov avatar Aug 23 '19 12:08 MaxFedotov

Sorry about the delay; I expect to look into & merge a bunch of community PRs during the first two weeks of October.

shlomi-noach avatar Sep 27 '19 06:09 shlomi-noach

Hi, @shlomi-noach! Are there any updates?

MaxFedotov avatar Nov 26 '19 15:11 MaxFedotov

/o\ the update is: sorry for the delay 😬

shlomi-noach avatar Nov 26 '19 16:11 shlomi-noach

Hello @shlomi-noach how are you? :) Is there anything I should do in order to proceed with this PR?

MaxFedotov avatar Jan 13 '20 13:01 MaxFedotov

@MaxFedotov thanks for your patience! So, I've been banging my head around this.

On one hand, the essence of this PR makes perfect sense. On the other hand, there is a destructive aspect to it. I'm trying to think whether stale KV entries should be kept around. e.g. the fact orchestrator forgot about an instance doesn't necessarily mean the instance does not exist anymore. Since external apps will depend on KV, I can't anticipate what assumptions those apps will make about existing entries.

For these reasons I find it difficult to approve the PR.

shlomi-noach avatar Jan 13 '20 14:01 shlomi-noach

@MaxFedotov thanks for your patience! So, I've been banging my head around this.

On one hand, the essence of this PR makes perfect sense. On the other hand, there is a destructive aspect to it. I'm trying to think whether stale KV entries should be kept around. e.g. the fact orchestrator forgot about an instance doesn't necessarily mean the instance does not exist anymore. Since external apps will depend on KV, I can't anticipate what assumptions those apps will make about existing entries.

For these reasons I find it difficult to approve the PR.

Yeah, but on the other hand, if Orchestrator forgets the instance and it is still in KV, from which external tools get routing data - that will also lead to inconsistencies, e.g. routing to old\stale servers :)

What do you think about adding a configurable parameter to config.go, with the name like RemoveForgottenClustersFromKV, so everyone can decide for each own if they need this or not.

MaxFedotov avatar Jan 13 '20 15:01 MaxFedotov

What do you think about adding a configurable parameter to config.go, with the name like RemoveForgottenClustersFromKV, so everyone can decide for each own if they need this or not.

@MaxFedotov sounds good to me!

shlomi-noach avatar Jan 14 '20 06:01 shlomi-noach

@shlomi-noach, so i've added RemoveForgottenClustersFromKV config option, fixed a bug with rlike in DeleteRecursive function for internal KV and updated the docs :) And tested everything one more time

MaxFedotov avatar Jan 14 '20 14:01 MaxFedotov

@shlomi-noach ping :) Is there anything i need to do in order to proceed with this PR?

MaxFedotov avatar Jan 29 '20 11:01 MaxFedotov

type KVStore interface {
	PutKeyValue(key string, value string) (err error)
	PutKVPairs(kvPairs []*KVPair) (err error)
	GetKeyValue(key string) (value string, found bool, err error)
+	DeleteRecursive(key string) (err error)
	DistributePairs(kvPairs [](*KVPair)) (err error)
}
[DEBUG] Build only; no packaging
[DEBUG] Building via go version go1.17.6 linux/amd64
go build: -i flag is deprecated
# github.com/openark/orchestrator/go/kv
go/kv/consul_txn.go:104:2: cannot use store (type *consulTxnStore) as type KVStore in return argument:
	*consulTxnStore does not implement KVStore (missing DeleteRecursive method)

Hi, @MaxFedotov, it seems that go/kv/consul_txn.go does not implemented DeleteRecursive(key string) (err error), I don't know about Consul transaction store, can you refine this PR further?

Can I simply copy the same code from consulStore.DeleteRecursive to consulTxnStore.DeleteRecursive?

Like:

func (this *consulTxnStore) DeleteRecursive(key string) (err error) {
	if this.client == nil {
		return nil
	}
	_, err = this.client.KV().DeleteTree(key, nil)
	return err
}

leiless avatar Jan 13 '22 03:01 leiless