threefoldtecharchive / jumpscaleX_threebot

Apache License 2.0
0 stars 3 forks source link

conflict on solution name in deployed solution #702

Closed zaibon closed 4 years ago

zaibon commented 4 years ago

The deployed solution in the admin panel was loading forever. So I checked the server logs and saw this:

Could not insert object, unique constraint failed:UNIQUE constraint failed:
        index_tfgrid_solutions_delegated_domain_1.name

From what I understand, for the delegated domain solution, the domain is used as bcdb config name. A bcdb config name must be unique. It's like the primary key in a table. I think this property makes it unsuitable to be use to store the deployed solution. There are cases where you will have different delegated domain solution using the same domain.

I think the way how the deployed solution are stored in bcdb needs to be reviewed. There should not no conflict on name. If you need query ability on names, then the bcdb schema needs to index a name property but the actual config name should most probably be unique or be the reservation ID, which is already unique by design.

zaibon commented 4 years ago

https://github.com/threefoldtech/jumpscaleX_threebot/issues/694 is also a consequence of this.

zaibon commented 4 years ago

cc @grimpy

BolaNasr commented 4 years ago

FIXED at : https://github.com/threefoldtech/jumpscaleX_libs/commit/4fb0f353a676a984325f45f3fba48e93b1865a34

https://github.com/threefoldtech/jumpscaleX_threebot/commit/3feaef0fe98aa3f7ee6bd5e4bfb3a28291276922

zaibon commented 4 years ago

@BolaNasr This issue is affecting all the solutions. Not only the domain delegate solution. But in your commit I only see code change regarding domain delegate. Is this problem also solved for all the other solutions ?

BolaNasr commented 4 years ago

@zaibon This issue it's already solved before by we are check the name of solution it's already exist in bcdb ( only DEPLOYED solutions ) ask user to add another name. and we are every time when refresh solution page we clear all bcdb and get all solutions of user has deployed before to add it in BCDB if it's not expired or cancelled yet

https://github.com/threefoldtech/jumpscaleX_libs/blob/development/JumpscaleLibs/sal/reservation_chatflow/reservation_chatflow.py#L747

Pishoy commented 4 years ago

steps: a) create a domain delegation by first getaway 6RZfnjuXVLFdtZh218hn4BLzsoKkTVpweqWECk5YUKud with domain ns1.freeflowpages.com it succeed and gives me image

b) create a domain delegation by second gateway C57earvre9QGj5oHbsDB2gjudbrAMXXtGsBReF8TE1ZR with domain ns1.freeflowpages.com

is takes long time and gives me the reservation fail reservation failing with https://explorer.testnet.grid.tf/explorer/reservations/460606 does not give me info like above picture in a about delegation info

when refresh the Domain Delegation tab , i got below which is mean is created ! image

but when i show info about delegation b . it gives different reservation id ! so it created without informing me creating NS record as picture in a case image

BolaNasr commented 4 years ago

@Pishoy can please retry both with the first getaway ?

Pishoy commented 4 years ago

verified