force FINALIZE partition detach after detecting shorter error (#3728)

This commit is contained in:
Ivan FB 2026-02-17 00:18:46 +01:00 committed by Ivan Folgueira Bande
parent 84e0af8dc0
commit 3e7aa18a42
No known key found for this signature in database
GPG Key ID: 3C117481F89E24A7

View File

@ -1403,8 +1403,10 @@ proc detachAndDropPartition(
(await self.performWriteQuery(detachPartitionQuery)).isOkOr:
info "detected error when trying to detach partition", error
if ($error).contains("FINALIZE") or
($error).contains("already pending detach in part"):
if ($error).contains("FINALIZE") or ($error).contains("already pending"):
## We assume "already pending detach in partitioned table ..." as possible error
debug "enforce detach with FINALIZE because of detected error", error
## We assume the database is suggesting to use FINALIZE when detaching a partition
let detachPartitionFinalizeQuery =
"ALTER TABLE messages DETACH PARTITION " & partitionName & " FINALIZE;"