-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KSQL sometimes deletes internal topics when the server shuts down #4654
Comments
What do you mean deletes internal topics? For persistent queries, or just for transient queries? |
for persistent queries - so it deletes all the repartition topics and changelogs. This is racy, which might explain why we don't hit this in dev environments. Adding some details now. |
thanks. Would be good to understand when it was introduced. |
So the underlying issue is that the shutdown handling logic iterates over all the running queries and terminates them (calls It looks like maybe this bug is being hidden by a race condition, which is why when I tried to reproduce by just shutting the server down by sending a SIGTERM, I didn't see the internal topics deleted. Let's assume I've started KSQL and run 1 query. When the JVM gets the SIGTERM, 2 threads react to it: Jetty's ShutdownThread (which register's with the JVM as a shutdown handler), which calls main, which also calls Both calls wind up in If you introduce a sleep just before the AdminClient is closed, it's pretty reliable to reproduce:
|
Fixed by #4658 |
When KSQL shuts down, it closes all the queries in the engine. One of the steps of closing a query is to delete the internal topics.
To Reproduce
Start KSQL and run a query, then shut KSQL down (presumably by sending a term signal).
Expected behavior
KSQL exits cleanly but leaves all internal topics in tact
Actual behaviour
KSQL deletes the internal topics (and therefore their data)
The text was updated successfully, but these errors were encountered: