Since transitioning to proto3, it was not possible to distinguish between the absence of
LoggingRequest::rpc_logging and it being set to false. This led to a bug that ignored
log-disabling messages in some implementations, which meant that logging was never
disabled. This fix adds explicit fields in LoggingRequest for enabling and disabling RPC
logging.
PiperOrigin-RevId:
196782547
// it on/off and don't make use of the responses.
for (auto& p : partitions_) {
LoggingRequest* req = new LoggingRequest;
- req->set_rpc_logging(active);
+ if (active) {
+ req->set_enable_rpc_logging(true);
+ } else {
+ req->set_disable_rpc_logging(true);
+ }
LoggingResponse* resp = new LoggingResponse;
Ref();
p.worker->LoggingAsync(req, resp, [this, req, resp](const Status& s) {
if (env) {
auto session_mgr = env->session_mgr;
if (session_mgr) {
- session_mgr->SetLogging(request->rpc_logging());
+ if (request->enable_rpc_logging()) {
+ session_mgr->SetLogging(true);
+ }
+ // NOTE(mrry): Handle old masters that disable RPC logging by setting
+ // `request->enable_rpc_logging` to `false`.
+ if (request->disable_rpc_logging() ||
+ (!request->enable_rpc_logging() &&
+ request->fetch_step_id_size() == 0)) {
+ session_mgr->SetLogging(false);
+ }
for (const auto& step_id : request->fetch_step_id()) {
session_mgr->RetrieveLogs(step_id, response);
}
// Out-of-band request to begin or end logging, or
// to retrieve logs for particular steps.
message LoggingRequest {
- // If true, RPC logging will be activated.
- bool rpc_logging = 1;
+ // If true, RPC logging will be enabled.
+ bool enable_rpc_logging = 1;
+
+ // If true, RPC logging will be disabled.
+ bool disable_rpc_logging = 4;
// If true, discard any saved logging data (for all steps).
bool clear = 2;