OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
system_validator::SingleNodeValidator Class Reference

Driver for running validation on a single node. More...

#include <SystemValidator.h>

+ Collaboration diagram for system_validator::SingleNodeValidator:

Public Member Functions

 SingleNodeValidator (const std::string &type, Catalog_Namespace::Catalog &catalog)
 
std::string validate () const
 

Private Attributes

Catalog_Namespace::Catalogcatalog_
 

Detailed Description

Driver for running validation on a single node.

Definition at line 83 of file SystemValidator.h.

Constructor & Destructor Documentation

system_validator::SingleNodeValidator::SingleNodeValidator ( const std::string &  type,
Catalog_Namespace::Catalog catalog 
)
inline

Definition at line 85 of file SystemValidator.h.

86  : catalog_(catalog) {
87  if (!type.empty()) {
88  throw std::runtime_error{
89  "Unexpected validation type specified. Only the \"VALIDATE;\" command is "
90  "currently supported."};
91  }
92  }
Catalog_Namespace::Catalog & catalog_

Member Function Documentation

std::string system_validator::SingleNodeValidator::validate ( ) const

Definition at line 20 of file SystemValidator.cpp.

References catalog_, Catalog_Namespace::Catalog::getAllTableMetadata(), Catalog_Namespace::Catalog::getDatabaseId(), Catalog_Namespace::Catalog::getTableEpochs(), system_validator::should_validate_epoch(), run_benchmark_import::tables, and system_validator::validate_table_epochs().

Referenced by DBHandler::sql_execute_impl().

20  {
21  std::ostringstream validation_result;
22  const auto tables = catalog_.getAllTableMetadata();
23  for (const auto& table : tables) {
24  if (should_validate_epoch(table)) {
25  const auto table_epochs =
26  catalog_.getTableEpochs(catalog_.getDatabaseId(), table->tableId);
27  validation_result << validate_table_epochs(table_epochs, table->tableName, false);
28  }
29  }
30 
31  if (validation_result.str().length() > 0) {
32  return validation_result.str();
33  } else {
34  return "Instance OK";
35  }
36 }
std::list< const TableDescriptor * > getAllTableMetadata() const
Definition: Catalog.cpp:2191
Catalog_Namespace::Catalog & catalog_
std::string validate_table_epochs(const std::vector< Catalog_Namespace::TableEpochInfo > &table_epochs, const std::string &table_name, const bool is_cluster_validation)
int getDatabaseId() const
Definition: Catalog.h:326
bool should_validate_epoch(const TableDescriptor *table_descriptor)
std::vector< TableEpochInfo > getTableEpochs(const int32_t db_id, const int32_t table_id) const
Definition: Catalog.cpp:3831

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

Catalog_Namespace::Catalog& system_validator::SingleNodeValidator::catalog_
private

Definition at line 97 of file SystemValidator.h.

Referenced by validate().


The documentation for this class was generated from the following files: