Skip to content

Commit

Permalink
Handle exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
lordgamez committed Mar 29, 2023
1 parent 9f393bd commit 453104b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
12 changes: 10 additions & 2 deletions extensions/rocksdb-repos/DatabaseContentRepository.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,19 @@ std::optional<RepositoryMetricsSource::RocksDbStats> DatabaseContentRepository::

std::string table_readers;
opendb->GetProperty("rocksdb.estimate-table-readers-mem", &table_readers);
stats.table_readers_size = std::stoull(table_readers);
try {
stats.table_readers_size = std::stoull(table_readers);
} catch (const std::exception&) {
logger_->log_error("Could not retrieve valid 'rocksdb.estimate-table-readers-mem' property value from rocksdb content repository!");
}

std::string all_memtables;
opendb->GetProperty("rocksdb.cur-size-all-mem-tables", &all_memtables);
stats.all_memory_tables_size = std::stoull(all_memtables);
try {
stats.all_memory_tables_size = std::stoull(all_memtables);
} catch (const std::exception&) {
logger_->log_error("Could not retrieve valid 'rocksdb.cur-size-all-mem-tables' property value from rocksdb content repository!");
}

return stats;
}
Expand Down
12 changes: 10 additions & 2 deletions extensions/rocksdb-repos/RocksDbRepository.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,19 @@ std::optional<RepositoryMetricsSource::RocksDbStats> RocksDbRepository::getRocks

std::string table_readers;
opendb->GetProperty("rocksdb.estimate-table-readers-mem", &table_readers);
stats.table_readers_size = std::stoull(table_readers);
try {
stats.table_readers_size = std::stoull(table_readers);
} catch (const std::exception&) {
logger_->log_error("Could not retrieve valid 'rocksdb.estimate-table-readers-mem' property value from rocksdb content repository!");
}

std::string all_memtables;
opendb->GetProperty("rocksdb.cur-size-all-mem-tables", &all_memtables);
stats.all_memory_tables_size = std::stoull(all_memtables);
try {
stats.all_memory_tables_size = std::stoull(all_memtables);
} catch (const std::exception&) {
logger_->log_error("Could not retrieve valid 'rocksdb.cur-size-all-mem-tables' property value from rocksdb content repository!");
}

return stats;
}
Expand Down

0 comments on commit 453104b

Please sign in to comment.