Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

refactor: change large write size request forbiden log #458

Merged
merged 20 commits into from
May 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions include/dsn/dist/replication/replication_app_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ class replication_app_base : public replica_base
// Thread-safe.
virtual void set_partition_version(int32_t partition_version){};

// dump the write request some info to string, it may need overload
virtual std::string dump_write_request(dsn::message_ex *request) { return "write request"; };

public:
//
// utility functions to be used by app
Expand Down
5 changes: 4 additions & 1 deletion src/dist/replication/lib/replica_2pc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,12 @@ void replica::on_client_write(dsn::message_ex *request, bool ignore_throttling)

if (dsn_unlikely(_stub->_max_allowed_write_size &&
request->body_size() > _stub->_max_allowed_write_size)) {
dwarn_replica("client from {} write request body size exceed threshold, request_body_size "
std::string request_info = _app->dump_write_request(request);
dwarn_replica("client from {} write request body size exceed threshold, request = [{}], "
"request_body_size "
"= {}, max_allowed_write_size = {}, it will be rejected!",
request->header->from_address.to_string(),
request_info,
request->body_size(),
_stub->_max_allowed_write_size);
_stub->_counter_recent_write_size_exceed_threshold_count->increment();
Expand Down