From c1809d792f9ced3663caadfb8bf9f4c4b3bab43d Mon Sep 17 00:00:00 2001 From: Jeff Cantrill Date: Wed, 12 Aug 2020 17:05:13 -0400 Subject: [PATCH 1/2] Bug 1866019: Delete indices in batches --- pkg/indexmanagement/scripts.go | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/pkg/indexmanagement/scripts.go b/pkg/indexmanagement/scripts.go index 562cd4e32..28c8cb477 100644 --- a/pkg/indexmanagement/scripts.go +++ b/pkg/indexmanagement/scripts.go @@ -25,6 +25,11 @@ writeIndices=$(curl -s $ES_SERVICE/${POLICY_MAPPING}-*/_alias/${POLICY_MAPPING}- -H"Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" \ -HContent-Type:application/json) +if echo "$writeIndices" | grep "\"error\"" ; then + echo "Error while attemping to determine the active write alias: $writeIndices" + exit 1 +fi + CMD=$(cat < Date: Thu, 27 Aug 2020 14:20:10 -0400 Subject: [PATCH 2/2] Remove space when formating the url --- pkg/indexmanagement/scripts.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/indexmanagement/scripts.go b/pkg/indexmanagement/scripts.go index 28c8cb477..9d894ab94 100644 --- a/pkg/indexmanagement/scripts.go +++ b/pkg/indexmanagement/scripts.go @@ -57,7 +57,7 @@ indices = [index for index in r if int(r[index]['settings']['index']['creation_d if "$writeIndex" in indices: indices.remove("$writeIndex") for i in range(0, len(indices), 25): - print ', '.join(indices[i:i+25]) + print ','.join(indices[i:i+25]) END ) indices=$(echo "${indices}" | python -c "$CMD")