mirror of
https://github.com/facebook/rocksdb.git
synced 2024-11-26 07:30:54 +00:00
Use aggregate initialization for FlushJobInfo/CompactionJobInfo (#5997)
Summary: FlushJobInfo and CompactionJobInfo are aggregates; we should use the aggregate initialization syntax to ensure members (specifically those of built-in types) are value-initialized. Pull Request resolved: https://github.com/facebook/rocksdb/pull/5997 Test Plan: make check Differential Revision: D18273398 Pulled By: ltamasi fbshipit-source-id: 35b1a63ad9ca01605d288329858af72fffd7f392
This commit is contained in:
parent
5b656584af
commit
a44670e71b
|
@ -387,7 +387,7 @@ TEST_F(CompactFilesTest, GetCompactionJobInfo) {
|
||||||
auto l0_files_1 = collector->GetFlushedFiles();
|
auto l0_files_1 = collector->GetFlushedFiles();
|
||||||
CompactionOptions co;
|
CompactionOptions co;
|
||||||
co.compression = CompressionType::kLZ4Compression;
|
co.compression = CompressionType::kLZ4Compression;
|
||||||
CompactionJobInfo compaction_job_info;
|
CompactionJobInfo compaction_job_info{};
|
||||||
ASSERT_OK(
|
ASSERT_OK(
|
||||||
db->CompactFiles(co, l0_files_1, 0, -1, nullptr, &compaction_job_info));
|
db->CompactFiles(co, l0_files_1, 0, -1, nullptr, &compaction_job_info));
|
||||||
ASSERT_EQ(compaction_job_info.base_input_level, 0);
|
ASSERT_EQ(compaction_job_info.base_input_level, 0);
|
||||||
|
|
|
@ -570,7 +570,7 @@ void DBImpl::NotifyOnFlushBegin(ColumnFamilyData* cfd, FileMetaData* file_meta,
|
||||||
// release lock while notifying events
|
// release lock while notifying events
|
||||||
mutex_.Unlock();
|
mutex_.Unlock();
|
||||||
{
|
{
|
||||||
FlushJobInfo info;
|
FlushJobInfo info{};
|
||||||
info.cf_id = cfd->GetID();
|
info.cf_id = cfd->GetID();
|
||||||
info.cf_name = cfd->GetName();
|
info.cf_name = cfd->GetName();
|
||||||
// TODO(yhchiang): make db_paths dynamic in case flush does not
|
// TODO(yhchiang): make db_paths dynamic in case flush does not
|
||||||
|
@ -1107,7 +1107,7 @@ void DBImpl::NotifyOnCompactionBegin(ColumnFamilyData* cfd, Compaction* c,
|
||||||
mutex_.Unlock();
|
mutex_.Unlock();
|
||||||
TEST_SYNC_POINT("DBImpl::NotifyOnCompactionBegin::UnlockMutex");
|
TEST_SYNC_POINT("DBImpl::NotifyOnCompactionBegin::UnlockMutex");
|
||||||
{
|
{
|
||||||
CompactionJobInfo info;
|
CompactionJobInfo info{};
|
||||||
info.cf_name = cfd->GetName();
|
info.cf_name = cfd->GetName();
|
||||||
info.status = st;
|
info.status = st;
|
||||||
info.thread_id = env_->GetThreadID();
|
info.thread_id = env_->GetThreadID();
|
||||||
|
@ -1181,7 +1181,7 @@ void DBImpl::NotifyOnCompactionCompleted(
|
||||||
mutex_.Unlock();
|
mutex_.Unlock();
|
||||||
TEST_SYNC_POINT("DBImpl::NotifyOnCompactionCompleted::UnlockMutex");
|
TEST_SYNC_POINT("DBImpl::NotifyOnCompactionCompleted::UnlockMutex");
|
||||||
{
|
{
|
||||||
CompactionJobInfo info;
|
CompactionJobInfo info{};
|
||||||
BuildCompactionJobInfo(cfd, c, st, compaction_job_stats, job_id, current,
|
BuildCompactionJobInfo(cfd, c, st, compaction_job_stats, job_id, current,
|
||||||
&info);
|
&info);
|
||||||
for (auto listener : immutable_db_options_.listeners) {
|
for (auto listener : immutable_db_options_.listeners) {
|
||||||
|
|
|
@ -431,7 +431,7 @@ Status FlushJob::WriteLevel0Table() {
|
||||||
#ifndef ROCKSDB_LITE
|
#ifndef ROCKSDB_LITE
|
||||||
std::unique_ptr<FlushJobInfo> FlushJob::GetFlushJobInfo() const {
|
std::unique_ptr<FlushJobInfo> FlushJob::GetFlushJobInfo() const {
|
||||||
db_mutex_->AssertHeld();
|
db_mutex_->AssertHeld();
|
||||||
std::unique_ptr<FlushJobInfo> info(new FlushJobInfo);
|
std::unique_ptr<FlushJobInfo> info(new FlushJobInfo{});
|
||||||
info->cf_id = cfd_->GetID();
|
info->cf_id = cfd_->GetID();
|
||||||
info->cf_name = cfd_->GetName();
|
info->cf_name = cfd_->GetName();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue