Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mimic: rgw/OutputDataSocket: append_output(buffer::list&) says it will (but does not) discard output at data_max_backlog #29279

Merged
merged 1 commit into from
Aug 6, 2019
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
17 changes: 12 additions & 5 deletions src/common/OutputDataSocket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ OutputDataSocket::OutputDataSocket(CephContext *cct, uint64_t _backlog)
m_shutdown_wr_fd(-1),
going_down(false),
data_size(0),
skipped(0),
m_lock("OutputDataSocket::m_lock")
{
}
Expand Down Expand Up @@ -290,12 +291,12 @@ void OutputDataSocket::handle_connection(int fd)
int OutputDataSocket::dump_data(int fd)
{
m_lock.Lock();
list<bufferlist> l = std::move(data);
vector<buffer::list> l = std::move(data);
data.clear();
data_size = 0;
m_lock.Unlock();

for (list<bufferlist>::iterator iter = l.begin(); iter != l.end(); ++iter) {
for (auto iter = l.begin(); iter != l.end(); ++iter) {
bufferlist& bl = *iter;
int ret = safe_write(fd, bl.c_str(), bl.length());
if (ret >= 0) {
Expand Down Expand Up @@ -384,11 +385,17 @@ void OutputDataSocket::append_output(bufferlist& bl)
Mutex::Locker l(m_lock);

if (data_size + bl.length() > data_max_backlog) {
ldout(m_cct, 20) << "dropping data output, max backlog reached" << dendl;
if (skipped % 100 == 0) {
ldout(m_cct, 0) << "dropping data output, max backlog reached (skipped=="
<< skipped << ")"
<< dendl;
skipped = 1;
} else
++skipped;
return;
}
data.push_back(bl);

data.push_back(bl);
data_size += bl.length();

cond.Signal();
}
6 changes: 3 additions & 3 deletions src/common/OutputDataSocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ class OutputDataSocket : public Thread
bool going_down;

uint64_t data_size;
uint32_t skipped;

std::list<bufferlist> data;
std::vector<buffer::list> data;

Mutex m_lock;
Cond cond;

bufferlist delim;
buffer::list delim;
};

#endif