Minor fixes.
GitOrigin-RevId: 6d9a609ab9c773d1e4f3fe81f84947e142e15f35
This commit is contained in:
parent
e75860b2ae
commit
5749ddf33d
@ -667,7 +667,7 @@ void Binlog::do_reindex() {
|
|||||||
<< fd_size_ << ' ' << detail::file_size(path_) << ' ' << fd_events_ << ' ' << path_;
|
<< fd_size_ << ' ' << detail::file_size(path_) << ' ' << fd_events_ << ' ' << path_;
|
||||||
|
|
||||||
double ratio = static_cast<double>(start_size) / static_cast<double>(finish_size + 1);
|
double ratio = static_cast<double>(start_size) / static_cast<double>(finish_size + 1);
|
||||||
LOG(ERROR) << "Regenerate index " << tag("name", path_) << tag("time", format::as_time(finish_time - start_time))
|
LOG(INFO) << "Regenerate index " << tag("name", path_) << tag("time", format::as_time(finish_time - start_time))
|
||||||
<< tag("before_size", format::as_size(start_size)) << tag("after_size", format::as_size(finish_size))
|
<< tag("before_size", format::as_size(start_size)) << tag("after_size", format::as_size(finish_size))
|
||||||
<< tag("ratio", ratio) << tag("before_events", start_events) << tag("after_events", finish_events);
|
<< tag("ratio", ratio) << tag("before_events", start_events) << tag("after_events", finish_events);
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
#include "td/utils/buffer.h"
|
#include "td/utils/buffer.h"
|
||||||
|
|
||||||
#include "td/utils/port/thread_local.h"
|
#include "td/utils/port/thread_local.h"
|
||||||
|
|
||||||
#include "td/utils/ThreadSafeCounter.h"
|
#include "td/utils/ThreadSafeCounter.h"
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
@ -26,7 +25,7 @@ TD_THREAD_LOCAL BufferAllocator::BufferRawTls *BufferAllocator::buffer_raw_tls;
|
|||||||
|
|
||||||
std::atomic<size_t> BufferAllocator::buffer_mem;
|
std::atomic<size_t> BufferAllocator::buffer_mem;
|
||||||
|
|
||||||
static td::ThreadSafeCounter buffer_slice_size_;
|
static ThreadSafeCounter buffer_slice_size_;
|
||||||
|
|
||||||
int64 BufferAllocator::get_buffer_slice_size() {
|
int64 BufferAllocator::get_buffer_slice_size() {
|
||||||
return buffer_slice_size_.sum();
|
return buffer_slice_size_.sum();
|
||||||
|
@ -116,6 +116,8 @@ class BufferSlice {
|
|||||||
: buffer_(std::move(buffer_ptr)), begin_(begin), end_(end) {
|
: buffer_(std::move(buffer_ptr)), begin_(begin), end_(end) {
|
||||||
debug_track();
|
debug_track();
|
||||||
}
|
}
|
||||||
|
BufferSlice(const BufferSlice &other) = delete;
|
||||||
|
BufferSlice &operator=(const BufferSlice &other) = delete;
|
||||||
BufferSlice(BufferSlice &&other) : BufferSlice(std::move(other.buffer_), other.begin_, other.end_) {
|
BufferSlice(BufferSlice &&other) : BufferSlice(std::move(other.buffer_), other.begin_, other.end_) {
|
||||||
debug_untrack(); // yes, debug_untrack
|
debug_untrack(); // yes, debug_untrack
|
||||||
}
|
}
|
||||||
|
@ -9,11 +9,11 @@
|
|||||||
#include "td/db/binlog/BinlogHelper.h"
|
#include "td/db/binlog/BinlogHelper.h"
|
||||||
#include "td/db/TQueue.h"
|
#include "td/db/TQueue.h"
|
||||||
|
|
||||||
#include "td/utils/Random.h"
|
|
||||||
#include "td/utils/buffer.h"
|
#include "td/utils/buffer.h"
|
||||||
#include "td/utils/int_types.h"
|
#include "td/utils/int_types.h"
|
||||||
#include "td/utils/misc.h"
|
#include "td/utils/misc.h"
|
||||||
#include "td/utils/port/path.h"
|
#include "td/utils/port/path.h"
|
||||||
|
#include "td/utils/Random.h"
|
||||||
#include "td/utils/Slice.h"
|
#include "td/utils/Slice.h"
|
||||||
#include "td/utils/Span.h"
|
#include "td/utils/Span.h"
|
||||||
#include "td/utils/Status.h"
|
#include "td/utils/Status.h"
|
||||||
@ -196,7 +196,7 @@ TEST(TQueue, random) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TQueue, memory_leak) {
|
TEST(TQueue, memory_leak) {
|
||||||
//return;
|
return;
|
||||||
auto tqueue = td::TQueue::create();
|
auto tqueue = td::TQueue::create();
|
||||||
auto tqueue_binlog = td::make_unique<td::TQueueBinlog<td::Binlog>>();
|
auto tqueue_binlog = td::make_unique<td::TQueueBinlog<td::Binlog>>();
|
||||||
std::string binlog_path = "test_tqueue.binlog";
|
std::string binlog_path = "test_tqueue.binlog";
|
||||||
@ -213,8 +213,8 @@ TEST(TQueue, memory_leak) {
|
|||||||
while (true) {
|
while (true) {
|
||||||
auto id = tqueue->push(1, "a", now + 600000, 0, {}).move_as_ok();
|
auto id = tqueue->push(1, "a", now + 600000, 0, {}).move_as_ok();
|
||||||
ids.push_back(id);
|
ids.push_back(id);
|
||||||
if (ids.size() > rnd() % 100000) {
|
if (ids.size() > static_cast<std::size_t>(rnd()) % 100000) {
|
||||||
auto it = rnd() % ids.size();
|
auto it = static_cast<std::size_t>(rnd()) % ids.size();
|
||||||
std::swap(ids.back(), ids[it]);
|
std::swap(ids.back(), ids[it]);
|
||||||
tqueue->forget(1, ids.back());
|
tqueue->forget(1, ids.back());
|
||||||
ids.pop_back();
|
ids.pop_back();
|
||||||
|
Loading…
Reference in New Issue
Block a user