cosmetics
Change-Id: Ifae805ae1e2dac95324e054af09a7b70f5d5b60c
This commit is contained in:
@ -144,11 +144,11 @@ void Database::cmdline_setup() {
|
||||
CommandLine &cmd = CommandLine::Inst();
|
||||
|
||||
DATABASE = cmd.addOption("d", "database", Arg::Required,
|
||||
"-d/--database\t MYSQL Database (default: taken from ~/.my.cnf)");
|
||||
"-d/--database \tMYSQL Database (default: taken from ~/.my.cnf)");
|
||||
HOSTNAME = cmd.addOption("H", "hostname", Arg::Required,
|
||||
"-h/--hostname\t MYSQL Hostname (default: taken from ~/.my.cnf)");
|
||||
"-h/--hostname \tMYSQL Hostname (default: taken from ~/.my.cnf)");
|
||||
USERNAME = cmd.addOption("u", "username", Arg::Required,
|
||||
"-u/--username\t MYSQL Username (default: taken from ~/.my.cnf, or your current user)");
|
||||
"-u/--username \tMYSQL Username (default: taken from ~/.my.cnf, or your current user)");
|
||||
}
|
||||
|
||||
Database * Database::cmdline_connect() {
|
||||
|
||||
@ -251,7 +251,7 @@ int DatabaseProtobufAdapter::TypeBridge_message::gatherTypes(StringJoiner &inser
|
||||
bool can_be_repeated = true; // default value
|
||||
|
||||
// For repeated messages
|
||||
TypeBridge_message *top_level_msg;
|
||||
TypeBridge_message *top_level_msg = 0;
|
||||
|
||||
const FieldOptions& field_options = field->options();
|
||||
if (field_options.GetExtension(sql_ignore)) {
|
||||
@ -411,9 +411,7 @@ int DatabaseProtobufAdapter::field_size_at_pos(const Message *msg, std::vector<i
|
||||
}
|
||||
|
||||
bool DatabaseProtobufAdapter::insert_row(const google::protobuf::Message *msg) {
|
||||
const Reflection *ref = msg->GetReflection();
|
||||
const Descriptor *d = msg->GetDescriptor();
|
||||
assert (d != 0 && ref != 0);
|
||||
assert (msg->GetDescriptor() != 0 && msg->GetReflection() != 0);
|
||||
|
||||
MYSQL_BIND *bind = new MYSQL_BIND[top_level_msg.field_count];
|
||||
|
||||
|
||||
@ -28,7 +28,10 @@ private:
|
||||
|
||||
int nextpick;
|
||||
// We need a window at least as wide as the number of clients we serve.
|
||||
enum { pick_window_size = 2000 };
|
||||
// FIXME better solution: when inbound queue is empty, *copy* in-flight map
|
||||
// to a vector, iterate but don't delete; when at the end, copy in-flight
|
||||
// map again and repeat
|
||||
enum { pick_window_size = 50000 };
|
||||
|
||||
public:
|
||||
SynchronizedMap() : nextpick(0) { }
|
||||
|
||||
@ -33,7 +33,7 @@ public:
|
||||
#endif
|
||||
return m_queue.size();
|
||||
}
|
||||
// Add data to the queue and notify others
|
||||
// Add data to the queue and notify others
|
||||
void Enqueue(const T& data)
|
||||
{
|
||||
// Acquire lock on the queue
|
||||
@ -47,13 +47,13 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
// Add the data to the queue
|
||||
// Add the data to the queue
|
||||
m_queue.push(data);
|
||||
// Notify others that data is ready
|
||||
// Notify others that data is ready
|
||||
#ifndef __puma
|
||||
m_cond.notify_one();
|
||||
#endif
|
||||
} // Lock is automatically released here
|
||||
} // Lock is automatically released here
|
||||
|
||||
/**
|
||||
* Get data from the queue. Wait for data if not available
|
||||
@ -64,15 +64,17 @@ public:
|
||||
#ifndef __puma
|
||||
boost::unique_lock<boost::mutex> lock(m_mutex);
|
||||
#endif
|
||||
// When there is no data, wait till someone fills it.
|
||||
// When there is no data, wait till someone fills it.
|
||||
// Lock is automatically released in the wait and obtained
|
||||
// again after the wait
|
||||
#ifndef __puma
|
||||
while (m_queue.size() == 0)
|
||||
while (m_queue.size() == 0) {
|
||||
m_cond.wait(lock);
|
||||
}
|
||||
#endif
|
||||
// Retrieve the data from the queue
|
||||
T result=m_queue.front(); m_queue.pop();
|
||||
T result = m_queue.front();
|
||||
m_queue.pop();
|
||||
|
||||
// Notify others that we have free slots
|
||||
#ifndef __puma
|
||||
@ -101,7 +103,8 @@ public:
|
||||
// again after the wait
|
||||
if (m_queue.size() > 0) {
|
||||
// Retrieve the data from the queue
|
||||
d = m_queue.front(); m_queue.pop();
|
||||
d = m_queue.front();
|
||||
m_queue.pop();
|
||||
// Notify others that we have free slots
|
||||
#ifndef __puma
|
||||
if (m_queue.size() < capacity) {
|
||||
|
||||
Reference in New Issue
Block a user