client, server: interpret monitor ackAny percentage as a fraction

A "N%" ackAny was computed as percent*queueSize on the client and
percent*limit on the server, without dividing by 100, then clamped to
the queue size.  Any percentage >= 1% therefore saturated to the full
queue, so ackAny="50%" behaved as 100% and defeated percentage-style
ack control.

Divide the clamped percent by 100 on both the client (clientmon.cpp)
and server (servermon.cpp) parsing paths.

Note: this changes the negotiated ack threshold for existing
percentage ackAny requests.
This commit is contained in:
Sang Woo Kim
2026-05-23 17:07:25 -07:00
committed by Michael Davidsaver
parent e5ec952e1d
commit 7ae3ca84c0
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -782,7 +782,7 @@ std::shared_ptr<Subscription> MonitorBuilder::exec()
try {
auto percent = parseTo<double>(sval.substr(0, sval.size()-1u));
if(percent>0.0 && percent<=100.0) {
op->ackAt = uint32_t(percent * op->queueSize);
op->ackAt = uint32_t(percent / 100.0 * op->queueSize);
} else {
throw std::invalid_argument("not in range (0%, 100%]");
}
+1 -1
View File
@@ -561,7 +561,7 @@ void ServerConn::handle_MONITOR()
if(sval.size()>1 && sval.back()=='%') {
try {
auto percent = parseTo<double>(sval.substr(0, sval.size()-1u));
op->ackAt = std::max(0.0, std::min(percent, 100.0)) * op->limit;
op->ackAt = std::max(0.0, std::min(percent, 100.0)) / 100.0 * op->limit;
}catch(std::exception& e){
logRemote(ioid, Level::Crit,
SB()<<"Unable to parse% "<<pvRequest.nameOf(ackAny)<<" : "<<sval<<" : "<<e.what());