eclipse / openvsx

An open-source registry for VS Code extensions
https://open-vsx.org/
Eclipse Public License 2.0
1.24k stars 137 forks source link

Renaming a namespace appears to leave incorrect URLs. #690

Closed kineticsquid closed 1 year ago

kineticsquid commented 1 year ago

In two cases, after renaming a namespace, URLs to files result in 404s.

@amvanbaren I'd seen something similar when I renamed a different namespace. That ended up going away and you mentioned a caching issue. Could that be what's going on here?

amvanbaren commented 1 year ago

The namespace change takes effect immediately. There are no background operations that take longer to complete.

Actually file URLs aren't being renamed during the namespace change, which is probably a bug.

But if the 404s resolve themselves after some time then it is likely a caching issue. open-vsx.org uses local ehcache. The namespace change clears parts of the cache, but only the cache of that instance. All other instances don't get notified of the namespace change. Using a distributed cache like Redis would solve this issue. But it could also be the load balancer or browser cache.

kineticsquid commented 1 year ago

@amvanbaren The 404s are still there. Is this a code fix or will we need some DB surgery?

amvanbaren commented 1 year ago

@kineticsquid We'll need a database and storage migration for that.

kineticsquid commented 1 year ago

@amvanbaren One more example. I published an extension to my kineticsquid namespace. Then renamed it to k-squid. My I then attempt to access the extension, I get the following error:

image

If I take that URL and replace the k-squid with kineticsquid like this, https://openvsxorg.blob.core.windows.net/resources/kineticsquid/helloworld-minimal-sample-kineticsquid/0.0.1/README.md, that file exists.

kineticsquid commented 1 year ago

Re https://github.com/eclipse/openvsx/issues/690#issuecomment-1462611623, the DB and storage migration is to fix the errant links, right? Do we also need to update the namespace rename code?

amvanbaren commented 1 year ago

If I take that URL and replace the k-squid with kineticsquid like this, https://openvsxorg.blob.core.windows.net/resources/kineticsquid/helloworld-minimal-sample-kineticsquid/0.0.1/README.md, that file exists.

Yes, the best course of action right now is to reverse the namespace changes and keep the namespace change request issues open.

Re https://github.com/eclipse/openvsx/issues/690#issuecomment-1462611623, the DB and storage migration is to fix the errant links, right? Do we also need to update the namespace rename code?

I think we only need to update the rename code. A migration isn't needed, because the namespace changes can be reversed.

kineticsquid commented 1 year ago

@amvanbaren I was able to revert the namespace changes for my test namespace , kineticsquid, and the change in #1589. However, I don't think I can use this approach for stateful in #877 because that was a namespace merge; there were extensions in stateful when I renamed activecove to stateful. This may require some DB surgery.