This is an automated email from the ASF dual-hosted git repository.
laiyingchun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git
The following commit(s) were added to refs/heads/master by this push:
new e72bb7700 fix(scripts): Fix the way the wait_manual_compact function
parses the output of the remote_command -t replica-server replica.query-compact
shell command (#2191)
e72bb7700 is described below
commit e72bb7700860b032ddb553b1c07752987a51c66a
Author: Guangshuo Wang <[email protected]>
AuthorDate: Mon Feb 17 14:37:30 2025 +0800
fix(scripts): Fix the way the wait_manual_compact function parses the
output of the remote_command -t replica-server replica.query-compact shell
command (#2191)
The [commit
2d68748](https://github.com/apache/incubator-pegasus/commit/2d68748264500a3fb3850a0dcfc8af8e8595a19a#:~:text=info%5B%22recent_enqueue_at%22%5D)
changed the output format of the shell command remote_command -t
replica-server replica.query-compact ${app_id},
which caused the wait_manual_compact function to still parse the output
based on the original format, leading to
incorrect behavior. It has now been fixed by modifying the parsing method.
---
admin_tools/pegasus_manual_compact.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/admin_tools/pegasus_manual_compact.sh
b/admin_tools/pegasus_manual_compact.sh
index cd9c2da6c..faf53ae45 100755
--- a/admin_tools/pegasus_manual_compact.sh
+++ b/admin_tools/pegasus_manual_compact.sh
@@ -119,10 +119,10 @@ function wait_manual_compact()
query_log_file="/tmp/$UID.$PID.pegasus.query_compact.${app_id}"
echo "${query_cmd}" | ./run.sh shell --cluster ${cluster}
&>${query_log_file}
- queue_count=`grep 'recent enqueue at' ${query_log_file} | grep -v
'recent start at' | wc -l`
- running_count=`grep 'recent start at' ${query_log_file} | wc -l`
+ queue_count=$(awk 'BEGIN {count=0} {match($0,
/"recent_enqueue_at":"([^"]+)"/, enqueue); match($0,
/"recent_start_at":"([^"]+)"/, start); if (1 in enqueue && enqueue[1] != "-" &&
start[1] == "-") {count++}} END {print count}' "$query_log_file")
+ running_count=$(awk 'BEGIN {count=0} {match($0,
/"recent_start_at":"([^"]+)"/, start); if (1 in start && start[1] != "-")
{count++}} END {print count}' "$query_log_file")
processing_count=$((queue_count+running_count))
- finish_count=`grep "last finish at" ${query_log_file} | grep -v
"recent enqueue at" | grep -v "recent start at" | grep -o 'last finish at
[^,]*' | sed 's/\[/,/;s/\]//' | awk -F"," -v date="$earliest_finish_time_ms"
'BEGIN{count=0}{if(length($2)==23 && $2>=date){count++;}}END{print count}'`
+ finish_count=$(awk -v date="$earliest_finish_time_ms" 'BEGIN {count=0}
{match($0, /"recent_enqueue_at":"([^"]+)"/, enqueue); match($0,
/"recent_start_at":"([^"]+)"/, start); match($0, /"last_finish":"([^"]+)"/,
finish); if (enqueue[1] == "-" && start[1] == "-" && 1 in finish && finish[1]
>= date) {count++}} END {print count}' "$query_log_file")
not_finish_count=$((total_replica_count-finish_count))
if [ ${processing_count} -eq 0 -a ${finish_count} -eq
${total_replica_count} ]; then
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]