We have a bunch of topics, which were created with 4 partitions, whereas they should each have one.
Because the partitions-count cannot be lowered, I'm trying to delete each such topic, and then recreate it anew. The body of the loop iterating over the list of topics is:
orderid=$(post $ORDERS -d '{}')
post --data-binary @- $ORDERS/$orderid/items <<- EOJ
{
"productType": "KafkaTopic",
"actionType": "delete",
"parameters": {
"name": "$topic",
"clusterId": "$cluster",
"ownerDeployment": "$owner"
}
}
EOJ
post --data-binary @- $ORDERS/$orderid/items <<- EOJ
{
"productType": "KafkaTopic",
"actionType": "create",
"parameters": {
"name": "$topic",
"clusterId": "$cluster",
"ownerDeployment": "$owner",
"numPartitions": 1
}
}
EOJ
post $ORDERS/$orderid/submit | python3.11 -m json.tool
However, the order-submissions all fail with "A topic named 'thetopic' already exists on cluster thecluster."
Must I separate the deletion and the (re)creation into separate orders? Would rather not...
Is there some other trick to it?