-
Notifications
You must be signed in to change notification settings - Fork 528
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Report cache_peer context in probe and standby pool messages (#1960)
The absence of the usual "current master transaction:..." detail in certain errors raises "Has Squid lost the current transaction context?" red flags: ERROR: Connection to peerXyz failed In some cases, Squid may have lost that context, but for cache_peer TCP probes, Squid has not because those probes are not associated with master transactions. It is difficult to distinguish the two cases because no processing context is reported. To address those concerns, we now report current cache_peer probing context (instead of just not reporting absent master transaction context): ERROR: Connection to peerXyz failed current cache_peer probe: peerXyzIP When maintaining a cache_peer standy=N connection pool, Squid has and now reports both contexts, attributing messages to pool maintenance: ERROR: Connection to peerXyz failed current cache_peer standby pool: peerXyz current master transaction: master1234 The new PrecomputedCodeContext class handles both reporting cases and can be reused whenever the cost of pre-computing detailCodeContext() output is acceptable.
- Loading branch information
1 parent
75c97d2
commit 16cafa1
Showing
8 changed files
with
83 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright (C) 1996-2024 The Squid Software Foundation and contributors | ||
* | ||
* Squid software is distributed under GPLv2+ license and includes | ||
* contributions from numerous individuals and organizations. | ||
* Please see the COPYING and CONTRIBUTORS files for details. | ||
*/ | ||
|
||
#ifndef SQUID_SRC_BASE_PRECOMPUTEDCODECONTEXT_H | ||
#define SQUID_SRC_BASE_PRECOMPUTEDCODECONTEXT_H | ||
|
||
#include "base/CodeContext.h" | ||
#include "base/InstanceId.h" | ||
#include "sbuf/SBuf.h" | ||
|
||
#include <ostream> | ||
|
||
/// CodeContext with constant details known at construction time | ||
class PrecomputedCodeContext: public CodeContext | ||
{ | ||
public: | ||
typedef RefCount<PrecomputedCodeContext> Pointer; | ||
|
||
PrecomputedCodeContext(const char *gist, const SBuf &detail): gist_(gist), detail_(detail) | ||
{} | ||
|
||
/* CodeContext API */ | ||
ScopedId codeContextGist() const override { return ScopedId(gist_); } | ||
std::ostream &detailCodeContext(std::ostream &os) const override { return os << Debug::Extra << detail_; } | ||
|
||
private: | ||
const char *gist_; ///< the id used in codeContextGist() | ||
const SBuf detail_; ///< the detail used in detailCodeContext() | ||
}; | ||
|
||
#endif /* SQUID_SRC_BASE_PRECOMPUTEDCODECONTEXT_H */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters