You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix error during DROP caused by the persistent queries dependencies needing prior termination for the STREAMS & TABLES instantiated with CREATE AS SELECT statement.
Return useful information about the errors still occuring.
Problem observed
All resource instantiated from CREATE AS SELECT fails on DROP because their persistent queries needs to be terminated before the drop.
So far there is no methods defined to TERMINATE the QUERIES.
Expected behavior
Running a DROP on a STREAMS or a TABLESSHOULD terminate the underlying persistent query before the drop if present BUT SHOULD NOT manage cascading drops as this is a resource dependency issue related to Confulent KSQL.
Prerequisites
Implemented DESCRIBE query for STREAMS & TABLES information listing.
Implemented TERMINATE query for QUERIES termination.
Solution
Run DESCRIBE on the resource
In order to check if there is persistent queries related to a STREAM or a TABLE, the KSQL client should check the resource status with the DESCRIBE query before running a DROP operation.
Read queries should be perceived as downstream dependencies and should therefore imply a CASCADE DROP. As this behavior is not intended and is an issue related to the KSQL development, the DROPshould fail under this condition, specifying that a subset of resource depends on the current resource.
Concretely, from the received payload from the operation above, the code should look like this:
iflen(sourceDescription.ReadQueries) >0 {
dependency:=sourceDescription.readQueries[0].sinks[0]
returnfmt.Errorf("could not drop '%s', '%s' needs to be dropped before.", RESOURCE_NAME, dependency)
}
Try to terminate the write queries related to the current resource.
To determine if a persistent query is running for a certain resource, we would expect the query sinks to be an array containing exclusively the resource name. If this is not the case, the function should return an error notifying that some underlying queries needs to be looked at before the resource can be dropped.
On the other hand, if the query is only related to the resource to be dropped, then the query should be terminated.
Because the writeQueries object is an array, the routine must be applied to all of its entries.
for_, q:=rangesourceDescription.WriteQueries {
expectedSinks:= []string{RESOURCE_NAME}
ifq.Sinks!=expectedSinks {
returnfmt.Errorf("could not drop '%s', the query '%s' should sinks '%v' but '%v' was found instead.", RESOURCE_NAME, q.ID, expectedSinks, q.Sinks)
}
err:=c.Terminate(q.ID)
iferr!=nil {
returnerr
}
}
Drop the resource
After the precedent steps, it should now be safe to drop the resource. Error occuring at this point should only refer to standard errors caused by network connection or invalid operations flow.
Looking into the cm-update-confluent the final function return in the code should remain:
returnc.qTOerr(req)
The text was updated successfully, but these errors were encountered:
Goals
DROP
caused by the persistent queries dependencies needing prior termination for theSTREAMS
&TABLES
instantiated withCREATE AS SELECT
statement.Problem observed
CREATE AS SELECT
fails onDROP
because their persistent queries needs to be terminated before the drop.TERMINATE
theQUERIES
.Expected behavior
Running a
DROP
on aSTREAMS
or aTABLES
SHOULD terminate the underlying persistent query before the drop if present BUT SHOULD NOT manage cascading drops as this is a resource dependency issue related to Confulent KSQL.Prerequisites
DESCRIBE
query forSTREAMS
&TABLES
information listing.TERMINATE
query forQUERIES
termination.Solution
Run
DESCRIBE
on the resourceIn order to check if there is persistent queries related to a
STREAM
or aTABLE
, theKSQL client
should check the resource status with theDESCRIBE
query before running aDROP
operation.As stated in the doc
Query:
Result:
From a code perspective, this should look like this:
Check if there's some read queries
Read queries should be perceived as downstream dependencies and should therefore imply a
CASCADE DROP
. As this behavior is not intended and is an issue related to the KSQL development, theDROP
should fail under this condition, specifying that a subset of resource depends on the current resource.Concretely, from the received payload from the operation above, the code should look like this:
Try to terminate the write queries related to the current resource.
To determine if a persistent query is running for a certain resource, we would expect the query sinks to be an array containing exclusively the resource name. If this is not the case, the function should return an error notifying that some underlying queries needs to be looked at before the resource can be dropped.
On the other hand, if the query is only related to the resource to be dropped, then the query should be terminated.
Because the
writeQueries
object is an array, the routine must be applied to all of its entries.Drop the resource
After the precedent steps, it should now be safe to drop the resource. Error occuring at this point should only refer to standard errors caused by network connection or invalid operations flow.
Looking into the
cm-update-confluent
the final function return in the code should remain:The text was updated successfully, but these errors were encountered: