limowang commented on code in PR #2191:
URL:
https://github.com/apache/incubator-pegasus/pull/2191#discussion_r1957523274
##########
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 (enqueue[1] != "-" && start[1] ==
"-") {count++}} END {print count}' "$query_log_file")
+ running_count=$(awk 'BEGIN {count=0} {match($0,
/"recent_start_at":"([^"]+)"/, start); if (start[1] != "-" && length(start[1])
> 0) {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 'BEGIN {count=0} {match($0,
/"last_finish":"([^"]+)"/, finish); if (finish[1] != "-" && length(finish[1]) >
0) {count++}} END {print count}' "$query_log_file")
Review Comment:
The parameter _manual_compact_last_finish_time_ms will persist after the
execution of manual_compact and will not be reset. If the value of
${trigger_time} is smaller than this value, the task will not be executed,
which could result in incorrect task progress judgment. Therefore, the change
is made to:
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")
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]