Skip to content

Commit

Permalink
Small logs enrichment (#875)
Browse files Browse the repository at this point in the history
* enrich assert on confdata binlog updating

* add log about RPC errors
  • Loading branch information
DrDet authored Jul 26, 2023
1 parent 2eeddb3 commit 52c31bc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
11 changes: 9 additions & 2 deletions runtime/rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@
#include "runtime/tl/rpc_server.h"
#include "runtime/tl/rpc_tl_query.h"
#include "runtime/tl/tl_builtins.h"
#include "runtime/tl/tl_magics_decoding.h"
#include "runtime/zlib.h"
#include "server/php-queries.h"

DEFINE_VERBOSITY(rpc);

static const int GZIP_PACKED = 0x3072cfa1;

const string tl_str_("");
Expand Down Expand Up @@ -816,8 +819,12 @@ void process_rpc_error(int32_t request_id, int32_t error_code, const char *error
php_assert (request->resumable_id != -1);
return;
}
if (!is_fake_error && kphp_tracing::is_turned_on()) {
kphp_tracing::on_rpc_query_fail(request_id, error_code);
if (!is_fake_error) {
tvkprintf(rpc, 1, "RPC error: error_code=%d, request_id=%d, tl_function=%s(0x%08x), actor_id=%d\n",
error_code, request_id, tl_magic_convert_to_name(request->function_magic), request->function_magic, request->actor_or_port);
if (kphp_tracing::is_turned_on()) {
kphp_tracing::on_rpc_query_fail(request_id, error_code);
}
}
int64_t resumable_id = request->resumable_id;
request->resumable_id = -2;
Expand Down
3 changes: 3 additions & 0 deletions runtime/rpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
#include <memory>

#include "common/algorithms/hashes.h"
#include "common/kprintf.h"
#include "runtime/dummy-visitor-methods.h"
#include "runtime/kphp_core.h"
#include "runtime/net_events.h"
#include "runtime/resumable.h"
#include "runtime/to-array-processor.h"

DECLARE_VERBOSITY(rpc);

struct rpc_request {
int64_t resumable_id; // == 0 - default, > 0 if not finished, -1 if received an answer, -2 if received an error, -3 if answer was gotten
union {
Expand Down
5 changes: 4 additions & 1 deletion server/confdata-binlog-replay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <map>

#include "common/binlog/binlog-replayer.h"
#include "common/dl-utils-lite.h"
#include "common/precise-time.h"
#include "common/server/engine-settings.h"
#include "common/server/init-binlog.h"
Expand Down Expand Up @@ -189,7 +190,9 @@ class ConfdataBinlogReplayer : vk::binlog::replayer {
*updating_confdata_storage_ = previous_confdata_storage;
} else {
// strictly speaking, they should be identical, but it's too hard to verify
assert(updating_confdata_storage_->size() == previous_confdata_storage.size());
dl_assert(updating_confdata_storage_->size() == previous_confdata_storage.size(),
dl_pstr("Can't update confdata from binlog: 'updating_confdata' and 'previous_confdata' must be identical, "
"but they have different sizes (%zu != %zu)\n", updating_confdata_storage_->size(), previous_confdata_storage.size()));
}
}
}
Expand Down

0 comments on commit 52c31bc

Please sign in to comment.