Improve NetQueryDebug field names.
GitOrigin-RevId: 56c8c1804e9962caceda0105591cfd16446cd56c
This commit is contained in:
parent
fcb7a51eb0
commit
1e6bdbb7a5
|
@ -82,13 +82,14 @@ void dump_pending_network_queries() {
|
||||||
was_gap = false;
|
was_gap = false;
|
||||||
}
|
}
|
||||||
const NetQueryDebug &debug = cur->get_data_unsafe();
|
const NetQueryDebug &debug = cur->get_data_unsafe();
|
||||||
LOG(WARNING) << tag("id", debug.my_id_) << *static_cast<const NetQuery *>(cur)
|
const NetQuery &nq = *static_cast<const NetQuery *>(cur);
|
||||||
<< /*tag("total_flood", format::as_time(debug.total_timeout_)) <<*/ " "
|
LOG(WARNING) << tag("user id", debug.my_id_) << nq << tag("total flood", format::as_time(nq.total_timeout))
|
||||||
<< tag("since start", format::as_time(Time::now_cached() - debug.start_timestamp_))
|
<< tag("since start", format::as_time(Time::now_cached() - debug.start_timestamp_))
|
||||||
<< tag("state", debug.debug_str_)
|
<< tag("state", debug.state_)
|
||||||
<< tag("since state", format::as_time(Time::now_cached() - debug.debug_timestamp_))
|
<< tag("in this state", format::as_time(Time::now_cached() - debug.state_timestamp_))
|
||||||
<< tag("resend_cnt", debug.debug_resend_cnt_) << tag("fail_cnt", debug.debug_send_failed_cnt_)
|
<< tag("state changed", debug.state_change_count_) << tag("resend count", debug.resend_count_)
|
||||||
<< tag("ack", debug.debug_ack_) << tag("unknown", debug.debug_unknown_);
|
<< tag("fail count", debug.send_failed_count_) << tag("ack state", debug.ack_state_)
|
||||||
|
<< tag("unknown", debug.unknown_state_);
|
||||||
} else {
|
} else {
|
||||||
was_gap = true;
|
was_gap = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,13 +43,13 @@ class NetQueryCallback : public Actor {
|
||||||
struct NetQueryDebug {
|
struct NetQueryDebug {
|
||||||
double start_timestamp_ = 0;
|
double start_timestamp_ = 0;
|
||||||
int32 my_id_ = 0;
|
int32 my_id_ = 0;
|
||||||
int32 debug_resend_cnt_ = 0;
|
int32 resend_count_ = 0;
|
||||||
string debug_str_ = "empty";
|
string state_ = "empty";
|
||||||
double debug_timestamp_ = 0;
|
double state_timestamp_ = 0;
|
||||||
int32 debug_cnt_ = 0;
|
int32 state_change_count_ = 0;
|
||||||
int32 debug_send_failed_cnt_ = 0;
|
int32 send_failed_count_ = 0;
|
||||||
int debug_ack_ = 0;
|
int ack_state_ = 0;
|
||||||
bool debug_unknown_ = false;
|
bool unknown_state_ = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
class NetQuery : public TsListNode<NetQueryDebug> {
|
class NetQuery : public TsListNode<NetQueryDebug> {
|
||||||
|
@ -90,7 +90,7 @@ class NetQuery : public TsListNode<NetQueryDebug> {
|
||||||
VLOG(net_query) << "Resend" << *this;
|
VLOG(net_query) << "Resend" << *this;
|
||||||
{
|
{
|
||||||
auto guard = lock();
|
auto guard = lock();
|
||||||
get_data_unsafe().debug_resend_cnt_++;
|
get_data_unsafe().resend_count_++;
|
||||||
}
|
}
|
||||||
dc_id_ = new_dc_id;
|
dc_id_ = new_dc_id;
|
||||||
status_ = Status::OK();
|
status_ = Status::OK();
|
||||||
|
@ -228,7 +228,7 @@ class NetQuery : public TsListNode<NetQueryDebug> {
|
||||||
void clear() {
|
void clear() {
|
||||||
if (!is_ready()) {
|
if (!is_ready()) {
|
||||||
auto guard = lock();
|
auto guard = lock();
|
||||||
LOG(ERROR) << "Destroy not ready query " << *this << " " << tag("debug", get_data_unsafe().debug_str_);
|
LOG(ERROR) << "Destroy not ready query " << *this << " " << tag("state", get_data_unsafe().state_);
|
||||||
}
|
}
|
||||||
// TODO: CHECK if net_query is lost here
|
// TODO: CHECK if net_query is lost here
|
||||||
cancel_slot_.close();
|
cancel_slot_.close();
|
||||||
|
@ -245,19 +245,19 @@ class NetQuery : public TsListNode<NetQueryDebug> {
|
||||||
|
|
||||||
void debug_send_failed() {
|
void debug_send_failed() {
|
||||||
auto guard = lock();
|
auto guard = lock();
|
||||||
get_data_unsafe().debug_send_failed_cnt_++;
|
get_data_unsafe().send_failed_count_++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void debug(string str, bool may_be_lost = false) {
|
void debug(string state, bool may_be_lost = false) {
|
||||||
may_be_lost_ = may_be_lost;
|
may_be_lost_ = may_be_lost;
|
||||||
{
|
{
|
||||||
auto guard = lock();
|
auto guard = lock();
|
||||||
auto &data = get_data_unsafe();
|
auto &data = get_data_unsafe();
|
||||||
data.debug_str_ = str;
|
data.state_ = state;
|
||||||
data.debug_timestamp_ = Time::now();
|
data.state_timestamp_ = Time::now();
|
||||||
data.debug_cnt_++;
|
data.state_change_count_++;
|
||||||
}
|
}
|
||||||
VLOG(net_query) << *this << " " << tag("debug", str);
|
VLOG(net_query) << *this << " " << tag("state", state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_callback(ActorShared<NetQueryCallback> callback) {
|
void set_callback(ActorShared<NetQueryCallback> callback) {
|
||||||
|
|
|
@ -619,7 +619,7 @@ void Session::on_message_ack_impl_inner(uint64 id, int32 type, bool in_container
|
||||||
it->second.ack = true;
|
it->second.ack = true;
|
||||||
{
|
{
|
||||||
auto lock = it->second.query->lock();
|
auto lock = it->second.query->lock();
|
||||||
it->second.query->get_data_unsafe().debug_ack_ |= type;
|
it->second.query->get_data_unsafe().ack_state_ |= type;
|
||||||
}
|
}
|
||||||
it->second.query->quick_ack_promise_.set_value(Unit());
|
it->second.query->quick_ack_promise_.set_value(Unit());
|
||||||
if (!in_container) {
|
if (!in_container) {
|
||||||
|
@ -657,7 +657,7 @@ void Session::cleanup_container(uint64 message_id, Query *query) {
|
||||||
void Session::mark_as_known(uint64 id, Query *query) {
|
void Session::mark_as_known(uint64 id, Query *query) {
|
||||||
{
|
{
|
||||||
auto lock = query->query->lock();
|
auto lock = query->query->lock();
|
||||||
query->query->get_data_unsafe().debug_unknown_ = false;
|
query->query->get_data_unsafe().unknown_state_ = false;
|
||||||
}
|
}
|
||||||
if (!query->unknown) {
|
if (!query->unknown) {
|
||||||
return;
|
return;
|
||||||
|
@ -673,7 +673,7 @@ void Session::mark_as_known(uint64 id, Query *query) {
|
||||||
void Session::mark_as_unknown(uint64 id, Query *query) {
|
void Session::mark_as_unknown(uint64 id, Query *query) {
|
||||||
{
|
{
|
||||||
auto lock = query->query->lock();
|
auto lock = query->query->lock();
|
||||||
query->query->get_data_unsafe().debug_unknown_ = true;
|
query->query->get_data_unsafe().unknown_state_ = true;
|
||||||
}
|
}
|
||||||
if (query->unknown) {
|
if (query->unknown) {
|
||||||
return;
|
return;
|
||||||
|
@ -941,8 +941,8 @@ void Session::connection_send_query(ConnectionInfo *info, NetQueryPtr &&net_quer
|
||||||
LOG_CHECK(sent_queries_.find(message_id) == sent_queries_.end()) << message_id;
|
LOG_CHECK(sent_queries_.find(message_id) == sent_queries_.end()) << message_id;
|
||||||
{
|
{
|
||||||
auto lock = net_query->lock();
|
auto lock = net_query->lock();
|
||||||
net_query->get_data_unsafe().debug_unknown_ = false;
|
net_query->get_data_unsafe().unknown_state_ = false;
|
||||||
net_query->get_data_unsafe().debug_ack_ = 0;
|
net_query->get_data_unsafe().ack_state_ = 0;
|
||||||
}
|
}
|
||||||
if (!net_query->cancel_slot_.empty()) {
|
if (!net_query->cancel_slot_.empty()) {
|
||||||
LOG(DEBUG) << "Set event for net_query cancellation " << tag("message_id", format::as_hex(message_id));
|
LOG(DEBUG) << "Set event for net_query cancellation " << tag("message_id", format::as_hex(message_id));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user