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
main
Levi Tamasi 5 years ago committed by Facebook Github Bot
parent 5b656584af
commit a44670e71b
  1. 2
      db/compact_files_test.cc
  2. 6
      db/db_impl/db_impl_compaction_flush.cc
  3. 2
      db/flush_job.cc

@ -387,7 +387,7 @@ TEST_F(CompactFilesTest, GetCompactionJobInfo) {
auto l0_files_1 = collector->GetFlushedFiles();
CompactionOptions co;
co.compression = CompressionType::kLZ4Compression;
CompactionJobInfo compaction_job_info;
CompactionJobInfo compaction_job_info{};
ASSERT_OK(
db->CompactFiles(co, l0_files_1, 0, -1, nullptr, &compaction_job_info));
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
mutex_.Unlock();
{
FlushJobInfo info;
FlushJobInfo info{};
info.cf_id = cfd->GetID();
info.cf_name = cfd->GetName();
// TODO(yhchiang): make db_paths dynamic in case flush does not
@ -1107,7 +1107,7 @@ void DBImpl::NotifyOnCompactionBegin(ColumnFamilyData* cfd, Compaction* c,
mutex_.Unlock();
TEST_SYNC_POINT("DBImpl::NotifyOnCompactionBegin::UnlockMutex");
{
CompactionJobInfo info;
CompactionJobInfo info{};
info.cf_name = cfd->GetName();
info.status = st;
info.thread_id = env_->GetThreadID();
@ -1181,7 +1181,7 @@ void DBImpl::NotifyOnCompactionCompleted(
mutex_.Unlock();
TEST_SYNC_POINT("DBImpl::NotifyOnCompactionCompleted::UnlockMutex");
{
CompactionJobInfo info;
CompactionJobInfo info{};
BuildCompactionJobInfo(cfd, c, st, compaction_job_stats, job_id, current,
&info);
for (auto listener : immutable_db_options_.listeners) {

@ -431,7 +431,7 @@ Status FlushJob::WriteLevel0Table() {
#ifndef ROCKSDB_LITE
std::unique_ptr<FlushJobInfo> FlushJob::GetFlushJobInfo() const {
db_mutex_->AssertHeld();
std::unique_ptr<FlushJobInfo> info(new FlushJobInfo);
std::unique_ptr<FlushJobInfo> info(new FlushJobInfo{});
info->cf_id = cfd_->GetID();
info->cf_name = cfd_->GetName();

Loading…
Cancel
Save