Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve YAML compliance of mgr:jobs report #1794

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
22 changes: 11 additions & 11 deletions src/BodyPipe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ BodyPipe::BodyPipe(Producer *aProducer): theBodySize(-1),
// TODO: teach MemBuf to start with zero minSize
// TODO: limit maxSize by theBodySize, when known?
theBuf.init(2*1024, MaxCapacity);
debugs(91,7, "created BodyPipe" << status());
debugs(91,7, "created BodyPipe " << status());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take advantage of the touch to make this produce the log pattern detected by the scripts/find-alive.pl:

Suggested change
debugs(91,7, "created BodyPipe " << status());
debugs(91,7, "construct, this=" << static_cast<void*>(this) << ", " << status());

}

BodyPipe::~BodyPipe()
{
debugs(91,7, "destroying BodyPipe" << status());
debugs(91,7, "destroying BodyPipe " << status());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take advantage of the touch to make this produce the log pattern detected by the scripts/find-alive.pl:

Suggested change
debugs(91,7, "destroying BodyPipe " << status());
debugs(91,7, "destruct, this=" << static_cast<void*>(this) << ", " << status());

assert(!theProducer);
assert(!theConsumer);
theBuf.clean();
Expand All @@ -155,7 +155,7 @@ void BodyPipe::setBodySize(uint64_t aBodySize)
assert(!theConsumer);

theBodySize = aBodySize;
debugs(91,7, "set body size" << status());
debugs(91,7, "set body size " << status());
}

uint64_t BodyPipe::bodySize() const
Expand Down Expand Up @@ -194,13 +194,13 @@ void
BodyPipe::clearProducer(bool atEof)
{
if (theProducer.set()) {
debugs(91,7, "clearing BodyPipe producer" << status());
debugs(91,7, "clearing BodyPipe producer " << status());
theProducer.clear();
if (atEof) {
if (!bodySizeKnown())
theBodySize = thePutSize;
else if (bodySize() != thePutSize)
debugs(91,3, "aborting on premature eof" << status());
debugs(91,3, "aborting on premature eof " << status());
} else {
// asserta that we can detect the abort if the consumer joins later
assert(!bodySizeKnown() || bodySize() != thePutSize);
Expand Down Expand Up @@ -241,7 +241,7 @@ BodyPipe::setConsumerIfNotLate(const Consumer::Pointer &aConsumer)
Must(!abortedConsumption); // did not promise to never consume

theConsumer = aConsumer;
debugs(91,7, "set consumer" << status());
debugs(91,7, "set consumer " << status());
if (theBuf.hasContent())
scheduleBodyDataNotification();
if (!theProducer)
Expand All @@ -254,7 +254,7 @@ void
BodyPipe::clearConsumer()
{
if (theConsumer.set()) {
debugs(91,7, "clearing consumer" << status());
debugs(91,7, "clearing consumer " << status());
theConsumer.clear();
// do not abort if we have not consumed so that HTTP or ICAP can retry
// benign xaction failures due to persistent connection race conditions
Expand Down Expand Up @@ -316,7 +316,7 @@ void
BodyPipe::enableAutoConsumption()
{
mustAutoConsume = true;
debugs(91,5, "enabled auto consumption" << status());
debugs(91,5, "enabled auto consumption " << status());
startAutoConsumptionIfNeeded();
}

Expand All @@ -336,7 +336,7 @@ BodyPipe::startAutoConsumptionIfNeeded()

theConsumer = new BodySink(this);
AsyncJob::Start(theConsumer);
debugs(91,7, "starting auto consumption" << status());
debugs(91,7, "starting auto consumption " << status());
scheduleBodyDataNotification();
}

Expand Down Expand Up @@ -381,7 +381,7 @@ BodyPipe::postConsume(size_t size)
{
assert(!isCheckedOut);
theGetSize += size;
debugs(91,7, "consumed " << size << " bytes" << status());
debugs(91,7, "consumed " << size << " bytes " << status());
if (mayNeedMoreData()) {
AsyncCall::Pointer call= asyncCall(91, 7,
"BodyProducer::noteMoreBodySpaceAvailable",
Expand All @@ -396,7 +396,7 @@ BodyPipe::postAppend(size_t size)
{
assert(!isCheckedOut);
thePutSize += size;
debugs(91,7, "added " << size << " bytes" << status());
debugs(91,7, "added " << size << " bytes " << status());

// We should not consume here even if mustAutoConsume because the
// caller may not be ready for the data to be consumed during this call.
Expand Down
15 changes: 8 additions & 7 deletions src/HappyConnOpener.cc
Original file line number Diff line number Diff line change
Expand Up @@ -437,17 +437,18 @@ HappyConnOpener::status() const

SBufStream os(buf);

os.write(" [", 2);
os << "{ ";
if (stopReason)
os << "Stopped:" << stopReason;
os << "stopped: \'" << stopReason << '\'';
if (prime)
os << "prime:" << prime;
os << ", prime:" << prime;
if (spare)
os << "spare:" << spare;
os << ", spare:" << spare;
if (n_tries)
os << " tries:" << n_tries;
os << " dst:" << *destinations;
os << ' ' << id << ']';
yadij marked this conversation as resolved.
Show resolved Hide resolved
os << ", tries:" << n_tries;
os << ", dst:" << *destinations;
os << ", id: " << id;
os << " }";

buf = os.buf();
return buf.c_str();
Expand Down
12 changes: 4 additions & 8 deletions src/adaptation/ecap/XactionRep.cc
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ Adaptation::Ecap::XactionRep::doneAll() const
void
Adaptation::Ecap::XactionRep::sinkVb(const char *reason)
{
debugs(93,4, "sink for " << reason << "; status:" << status());
debugs(93,4, "sink for " << reason << "; status: " << status());

// we reset raw().body_pipe when we are done, so use this one for checking
const BodyPipePointer &permPipe = theVirginRep.raw().header->body_pipe;
Expand All @@ -371,7 +371,7 @@ Adaptation::Ecap::XactionRep::sinkVb(const char *reason)
void
Adaptation::Ecap::XactionRep::preserveVb(const char *reason)
{
debugs(93,4, "preserve for " << reason << "; status:" << status());
debugs(93,4, "preserve for " << reason << "; status: " << status());

// we reset raw().body_pipe when we are done, so use this one for checking
const BodyPipePointer &permPipe = theVirginRep.raw().header->body_pipe;
Expand All @@ -387,7 +387,7 @@ Adaptation::Ecap::XactionRep::preserveVb(const char *reason)
void
Adaptation::Ecap::XactionRep::forgetVb(const char *reason)
{
debugs(93,9, "forget vb " << reason << "; status:" << status());
debugs(93,9, "forget vb " << reason << "; status: " << status());

BodyPipePointer &p = theVirginRep.raw().body_pipe;
if (p != nullptr && p->stillConsuming(this))
Expand Down Expand Up @@ -442,7 +442,7 @@ Adaptation::Ecap::XactionRep::useAdapted(const libecap::shared_ptr<libecap::Mess
updateHistory(msg);
sendAnswer(Answer::Forward(msg));

debugs(93,4, "adapter will produce body" << status());
debugs(93,4, "adapter will produce body " << status());
theMaster->abMake(); // libecap will produce
}
}
Expand Down Expand Up @@ -702,8 +702,6 @@ Adaptation::Ecap::XactionRep::status() const
static MemBuf buf;
buf.reset();

buf.append(" [", 2);

if (makingVb)
buf.appendf("M%d", static_cast<int>(makingVb));

Expand Down Expand Up @@ -732,8 +730,6 @@ Adaptation::Ecap::XactionRep::status() const
buf.append(" A?", 3);
}

buf.appendf(" %s%u]", id.prefix(), id.value);

buf.terminate();

return buf.content();
Expand Down
40 changes: 20 additions & 20 deletions src/adaptation/icap/ModXact.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Adaptation::Icap::ModXact::ModXact(Http::Message *virginHeader,
icapReply = new HttpReply;
icapReply->protoPrefix = "ICAP/"; // TODO: make an IcapReply class?

debugs(93,7, "initialized." << status());
debugs(93,7, "initialized. " << status());
}

// initiator wants us to start
Expand Down Expand Up @@ -131,7 +131,7 @@ void Adaptation::Icap::ModXact::waitForService()
disableRetries();
disableRepeats("ICAP service is not available");

debugs(93, 7, "will not wait for the service to be available" <<
debugs(93, 7, "will not wait for the service to be available " <<
status());

throw TexcHere("ICAP service is not available");
Expand Down Expand Up @@ -196,7 +196,7 @@ void Adaptation::Icap::ModXact::startShoveling()
requestBuf.init();

makeRequestHeaders(requestBuf);
debugs(93, 9, "will write" << status() << ":\n" <<
debugs(93, 9, "will write " << status() << ":\n" <<
(requestBuf.terminate(), requestBuf.content()));

// write headers
Expand Down Expand Up @@ -237,7 +237,7 @@ void Adaptation::Icap::ModXact::handleCommWroteHeaders()

void Adaptation::Icap::ModXact::writeMore()
{
debugs(93, 5, "checking whether to write more" << status());
debugs(93, 5, "checking whether to write more " << status());

if (writer != nullptr) // already writing something
return;
Expand Down Expand Up @@ -274,7 +274,7 @@ void Adaptation::Icap::ModXact::writeMore()
void Adaptation::Icap::ModXact::writePreviewBody()
{
debugs(93, 8, "will write Preview body from " <<
virgin.body_pipe << status());
virgin.body_pipe << ' ' << status());
Must(state.writing == State::writingPreview);
Must(virgin.body_pipe != nullptr);

Expand All @@ -298,7 +298,7 @@ void Adaptation::Icap::ModXact::decideWritingAfterPreview(const char *kind)
else
stopWriting(true); // ICAP server reply implies no post-preview writing

debugs(93, 6, "decided on writing after " << kind << " preview" <<
debugs(93, 6, "decided on writing after " << kind << " preview " <<
status());
}

Expand Down Expand Up @@ -490,12 +490,12 @@ void Adaptation::Icap::ModXact::stopWriting(bool nicely)

if (writer != nullptr) {
if (nicely) {
debugs(93, 7, "will wait for the last write" << status());
debugs(93, 7, "will wait for the last write " << status());
state.writing = State::writingAlmostDone; // may already be set
checkConsuming();
return;
}
debugs(93, 3, "will NOT wait for the last write" << status());
debugs(93, 3, "will NOT wait for the last write " << status());

// Comm does not have an interface to clear the writer callback nicely,
// but without clearing the writer we cannot recycle the connection.
Expand All @@ -506,7 +506,7 @@ void Adaptation::Icap::ModXact::stopWriting(bool nicely)
ignoreLastWrite = true;
}

debugs(93, 7, "will no longer write" << status());
debugs(93, 7, "will no longer write " << status());
if (virginBodyWriting.active()) {
virginBodyWriting.disable();
virginConsume();
Expand All @@ -520,7 +520,7 @@ void Adaptation::Icap::ModXact::stopBackup()
if (!virginBodySending.active())
return;

debugs(93, 7, "will no longer backup" << status());
debugs(93, 7, "will no longer backup " << status());
virginBodySending.disable();
virginConsume();
}
Expand Down Expand Up @@ -581,7 +581,7 @@ void Adaptation::Icap::ModXact::echoMore()
const size_t sizeMax = virginContentSize(virginBodySending);
debugs(93,5, "will echo up to " << sizeMax << " bytes from " <<
virgin.body_pipe->status());
debugs(93,5, "will echo up to " << sizeMax << " bytes to " <<
debugs(93,5, "will echo up to " << sizeMax << " bytes to " <<
adapted.body_pipe->status());

if (sizeMax > 0) {
Expand All @@ -595,12 +595,12 @@ void Adaptation::Icap::ModXact::echoMore()
}

if (virginBodyEndReached(virginBodySending)) {
debugs(93, 5, "echoed all" << status());
debugs(93, 5, "echoed all " << status());
stopSending(true);
} else {
debugs(93, 5, "has " <<
virgin.body_pipe->buf().contentSize() << " bytes " <<
"and expects more to echo" << status());
"and expects more to echo " << status());
// TODO: timeout if virgin or adapted pipes are broken
}
}
Expand All @@ -619,7 +619,7 @@ void Adaptation::Icap::ModXact::stopSending(bool nicely)
debugs(93, 7, "Proceed with stop sending ");

if (state.sending != State::sendingUndecided) {
debugs(93, 7, "will no longer send" << status());
debugs(93, 7, "will no longer send " << status());
if (adapted.body_pipe != nullptr) {
virginBodySending.disable();
// we may leave debts if we were echoing and the virgin
Expand All @@ -628,7 +628,7 @@ void Adaptation::Icap::ModXact::stopSending(bool nicely)
stopProducingFor(adapted.body_pipe, nicely && !leftDebts);
}
} else {
debugs(93, 7, "will not start sending" << status());
debugs(93, 7, "will not start sending " << status());
Must(!adapted.body_pipe);
}

Expand All @@ -643,13 +643,13 @@ void Adaptation::Icap::ModXact::checkConsuming()
if (!virgin.body_pipe || !state.doneConsumingVirgin())
return;

debugs(93, 7, "will stop consuming" << status());
debugs(93, 7, "will stop consuming " << status());
stopConsumingFrom(virgin.body_pipe);
}

void Adaptation::Icap::ModXact::parseMore()
{
debugs(93, 5, "have " << readBuf.length() << " bytes to parse" << status());
debugs(93, 5, "have " << readBuf.length() << " bytes to parse " << status());
debugs(93, 5, "\n" << readBuf);

if (state.parsingHeaders())
Expand Down Expand Up @@ -708,7 +708,7 @@ void Adaptation::Icap::ModXact::bypassFailure()
reuseConnection = false; // be conservative
cancelRead(); // may not work; and we cannot stop connecting either
if (!doneWithIo())
debugs(93, 7, "Warning: bypass failed to stop I/O" << status());
debugs(93, 7, "Warning: bypass failed to stop I/O " << status());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
debugs(93, 7, "Warning: bypass failed to stop I/O " << status());
debugs(93, 7, "WARNING: bypass failed to stop I/O " << status());

}

service().noteFailure(); // we are bypassing, but this is still a failure
Expand Down Expand Up @@ -1218,7 +1218,7 @@ void Adaptation::Icap::ModXact::stopParsing(const bool checkUnparsedData)
if (checkUnparsedData)
Must(readBuf.isEmpty());

debugs(93, 7, "will no longer parse" << status());
debugs(93, 7, "will no longer parse " << status());

delete bodyParser;
bodyParser = nullptr;
Expand Down Expand Up @@ -1292,7 +1292,7 @@ Adaptation::Icap::ModXact::~ModXact()
// internal cleanup
void Adaptation::Icap::ModXact::swanSong()
{
debugs(93, 5, "swan sings" << status());
debugs(93, 5, "swan sings " << status());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

method name "swanSong" makes the content text redundant.

Suggested change
debugs(93, 5, "swan sings " << status());
debugs(93, 5, status());


stopWriting(false);
stopSending(false);
Expand Down
2 changes: 1 addition & 1 deletion src/adaptation/icap/OptXact.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void Adaptation::Icap::OptXact::handleCommRead(size_t)

bool Adaptation::Icap::OptXact::parseResponse()
{
debugs(93, 5, "have " << readBuf.length() << " bytes to parse" << status());
debugs(93, 5, "have " << readBuf.length() << " bytes to parse " << status());
debugs(93, DBG_DATA, "\n" << readBuf);

HttpReply::Pointer r(new HttpReply);
Expand Down
7 changes: 3 additions & 4 deletions src/adaptation/icap/ServiceRep.cc
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ void Adaptation::Icap::ServiceRep::callException(const std::exception &e)
{
clearAdaptation(theOptionsFetcher);
debugs(93,2, "ICAP probably failed to fetch options (" << e.what() <<
")" << status());
") " << status());
handleNewOptions(nullptr);
}

Expand Down Expand Up @@ -674,12 +674,12 @@ Adaptation::Icap::ServiceRep::makeXactLauncher(Http::Message *virgin,
}

// returns a temporary string depicting service status, for debugging
const char *Adaptation::Icap::ServiceRep::status() const
const char *
Adaptation::Icap::ServiceRep::status() const
{
static MemBuf buf;

buf.reset();
buf.append("[", 1);

if (up())
buf.append("up", 2);
Expand Down Expand Up @@ -708,7 +708,6 @@ const char *Adaptation::Icap::ServiceRep::status() const
if (const int failures = theSessionFailures.remembered())
buf.appendf(",fail%d", failures);

buf.append("]", 1);
buf.terminate();

return buf.content();
Expand Down
Loading
Loading