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

Commit

Permalink
refactor: change large write size request forbiden log (#458)
Browse files Browse the repository at this point in the history
  • Loading branch information
foreverneverer authored and neverchanje committed May 28, 2020
1 parent 704e1f0 commit 253203a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
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

0 comments on commit 253203a

Please sign in to comment.