thomaslevesque / CosmosDBStudio

A tool to browse and query Azure Cosmos DB databases
MIT License
54 stars 12 forks source link

Make the database deletion more resilient to transient error #59

Closed rmt2021 closed 2 years ago

rmt2021 commented 2 years ago

Fix https://github.com/thomaslevesque/CosmosDBStudio/issues/58

When transient error happens for database deletion, we will handle it by checking whether the database exist or not. If it still exists, then we should delete it again; otherwise, we will ignore the new 404 NotFound because the 404 means the previous operation succeeded deleting the database.

thomaslevesque commented 2 years ago

Hi @rmt2021,

Thanks for the PR, I appreciate it!

Have you been able to test it? I don't think I ever ran into the error you described, so I don't know how hard it is to reproduce. Are you sure the error is actually 404 NotFound when you retry after a transient error and the database has already been deleted? Since the documentation mentions 410 Gone, I thought maybe it could also return that in this situation.

rmt2021 commented 2 years ago

Thanks for your reply @thomaslevesque! Yes, what we have seen is 404 NotFound when transient faults happen. Maybe 410 Gone could also happen, so let me add it.

rmt2021 commented 2 years ago

Added. Feel free to give any feedback:)

rmt2021 commented 2 years ago

Hi @thomaslevesque, may I ask how to get the exception stack trace of Comos DB Studio during execution? I want to diagnose the problem I encountered, so I would appreciate it a lot if you could provide more information about debugging. For example, if the Cosmos DB SDK throw an exception to the application which is not handled, where will the application store that exception and am I able to print/find it?

thomaslevesque commented 2 years ago

Hi @rmt2021, I'm not sure I understand what you're asking... I usually just configure the debugger to break when an exception is thrown, or add a breakpoint in the relevant catch block.

For exceptions thrown during queries, the error details are displayed in the result pane. For the rest... I'm afraid there are no logs at this point. This is far from being a finished product, and I don't know if it will ever be, since I haven't used Cosmos DB in a while, and have little time to work on this app.

rmt2021 commented 2 years ago

Thanks for your reply. I wanna ask whether there are logs or not, and I think I have got the answer. Thanks!