nox icon indicating copy to clipboard operation
nox copied to clipboard

Add builtin: srv remove_alias

Open dzmitry-lahoda opened this issue 3 years ago • 10 comments

scenario:

  • deploy new service
  • migrate data
  • remove alias from old service
  • add alias to new service

related: https://github.com/fluencelabs/fluence/issues/1131

dzmitry-lahoda avatar Jun 18 '21 04:06 dzmitry-lahoda

You can do it like this: https://github.com/fluencelabs/aqua-dht/blob/7942e40d5f505f6b859e536433235be77578f4cd/alias.air

  1. Check if alias resolves to the old service
  2. Deploy new service
  3. Migrate data
  4. Add alias to the new service
  5. Remove old service (not just alias - why leave service running?)

Steps 4 & 5 can be swapped if needed

folex avatar Jun 18 '21 07:06 folex

what happens if there are 2 aliases at same time why service is running always? I thought it only data retained. Is removal lazy? What if removal fails? E.g. somebody uses services .tmp file and removal fails when locked. I do not think that proposed approach is robust. I want to remove and make node without service at all. So on retry will be idempotent.

dzmitry-lahoda avatar Jun 18 '21 07:06 dzmitry-lahoda

see related issues - why it is possible to have 2 same aliases on same node?

dzmitry-lahoda avatar Jun 18 '21 07:06 dzmitry-lahoda

E.g. somebody uses services .tmp file and removal fails when locked.

It's not possible to use service's /tmp from outside the service, so this situation isn't possible if I understand you correctly.

What if removal fails?

You can have XOR and simply repeat the operation. Same if remove_alias fails. Though I see no reasons for service removal to fail - it's a pretty simple unconditional operation.

I want to remove and make node without service at all. So on retry will be idempotent.

First, I agree that we need to have remove_alias builtin.

But regarding the idempotency, I don't see how it's achievable here either with remove_alias or with srv remove.

If you retry remove_alias, you can remove newly added alias that you didn't know about, so it's not idempotent. Same with srv remove.

folex avatar Jun 18 '21 08:06 folex

It's not possible to use service's /tmp from outside the service, so this situation isn't possible if I understand you correctly.

user runs services, deploy removes services. does remove waits deletion? i mean if i delete during particle running via it and saves data to .tmp. and i try to delete .tmp same time - one service.

dzmitry-lahoda avatar Jun 18 '21 09:06 dzmitry-lahoda

i mean if i delete during particle running via it and saves data to .tmp. and i try to delete .tmp same time - one service.

Particles access services in a sequential manner, i.e. it's not possible to access service concurrently from several particles

folex avatar Jun 18 '21 09:06 folex

Particles access services in a sequential manner, i.e. it's not possible to access service concurrently from several particles

that should be very cleared state in docs. as it very important for scale. and there should be option for concurrent access for stateless services. may be.

with current design will need to deploy services per company unit or even chat, not per company.

dzmitry-lahoda avatar Jun 18 '21 13:06 dzmitry-lahoda

if you are ok to consider to remove alias, than i am ok. at least as feature. read is as k8s labels and selectors.

dzmitry-lahoda avatar Jun 18 '21 13:06 dzmitry-lahoda

Check if alias resolves to the old service
Deploy new service
Migrate data
Add alias to the new service
Remove old service (not just alias - why leave service running?)

May be so that is okey. But imagine I want to add my alias to other owner service with my private prefix key? like if that iam want to rout my particles via it. or I want to do A/B/Canary releases?

dzmitry-lahoda avatar Jun 18 '21 14:06 dzmitry-lahoda

but yeah, for now will loop over services, find aliased, find id and remove services. also it would be shorter to remove alias. i do not care of garbage. GC is not my prio. there should be other economics.

dzmitry-lahoda avatar Jun 18 '21 14:06 dzmitry-lahoda