if (last_log_sent == last_log)
return NULL;
- unsigned i = last_log - last_log_sent;
+ // limit entries per message
+ unsigned num = last_log - last_log_sent;
+ unsigned i;
+ if (cct->_conf->mon_client_max_log_entries_per_message > 0)
+ i = MIN(num, cct->_conf->mon_client_max_log_entries_per_message);
+ else
+ i = num;
+
ldout(cct,10) << " log_queue is " << log_queue.size() << " last_log " << last_log << " sent " << last_log_sent
- << " i " << i << dendl;
+ << " num " << num << " sending " << i << dendl;
std::deque<LogEntry> o(i);
- std::deque<LogEntry>::reverse_iterator p = log_queue.rbegin();
- while (i > 0) {
- i--;
- o[i] = *p++;
- ldout(cct,10) << " will send " << o[i] << dendl;
+ std::deque<LogEntry>::iterator p = log_queue.begin();
+ std::deque<LogEntry>::iterator q = o.begin();
+ while (q != o.end()) {
+ *q = *p;
+ last_log_sent = p->seq;
+ ldout(cct,10) << " will send " << *p << dendl;
+ p++;
+ q++;
}
-
- last_log_sent = last_log;
MLog *log = new MLog(monmap->get_fsid());
log->entries.swap(o);
OPTION(auth_service_ticket_ttl, OPT_DOUBLE, 60*60)
OPTION(mon_client_hunt_interval, OPT_DOUBLE, 3.0) // try new mon every N seconds until we connect
OPTION(mon_client_ping_interval, OPT_DOUBLE, 10.0) // ping every N seconds
+OPTION(mon_client_max_log_entries_per_message, OPT_INT, 1000)
OPTION(client_cache_size, OPT_INT, 16384)
OPTION(client_cache_mid, OPT_FLOAT, .75)
OPTION(client_cache_stat_ttl, OPT_INT, 0) // seconds until cached stat results become invalid