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

Classes

class  DistributedValidate
 Driver for running distributed validation on metadata across cluster. DistributedValidate provides functions for running a validation on system metadata across a cluster, with options to remove broken objects that have been identified. More...
 
class  SingleNodeValidator
 Driver for running validation on a single node. More...
 

Functions

bool should_validate_epoch (const TableDescriptor *table_descriptor)
 
std::string validate_table_epochs (const std::vector< Catalog_Namespace::TableEpochInfo > &table_epochs, const std::string &table_name, const bool is_cluster_validation)
 

Function Documentation

bool system_validator::should_validate_epoch ( const TableDescriptor table_descriptor)

Definition at line 38 of file SystemValidator.cpp.

References TableDescriptor::isForeignTable(), TableDescriptor::isTemporaryTable(), TableDescriptor::isView, and TableDescriptor::shard.

Referenced by system_validator::SingleNodeValidator::validate().

38  {
39  // Epoch validation only applies to persisted local tables. Validation uses the logical
40  // table id to validate epoch consistency across shards.
41  return (table_descriptor->shard == -1 && !table_descriptor->isForeignTable() &&
42  !table_descriptor->isTemporaryTable() && !table_descriptor->isView);
43 }
bool isForeignTable() const
bool isTemporaryTable() const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string system_validator::validate_table_epochs ( const std::vector< Catalog_Namespace::TableEpochInfo > &  table_epochs,
const std::string &  table_name,
const bool  is_cluster_validation 
)

Definition at line 45 of file SystemValidator.cpp.

References CHECK, and to_string().

Referenced by system_validator::SingleNodeValidator::validate().

48  {
49  std::ostringstream validation_result;
50  CHECK(!table_epochs.empty());
51  bool epochs_are_inconsistent{false};
52  auto first_epoch = table_epochs[0].table_epoch;
53  for (const auto& table_epoch : table_epochs) {
54  if (first_epoch != table_epoch.table_epoch) {
55  epochs_are_inconsistent = true;
56  break;
57  }
58  }
59 
60  if (epochs_are_inconsistent) {
61  validation_result << "\nEpoch values for table \"" << table_name
62  << "\" are inconsistent:\n"
63  << std::left;
64  // Only add "Node" header for cluster validation
65  if (is_cluster_validation) {
66  validation_result << std::setw(10) << "Node";
67  }
68  validation_result << std::setw(10) << "Table Id" << std::setw(10) << "Epoch"
69  << "\n========= ========= ";
70  // Add separator for "Node" header if this is a cluster validation
71  if (is_cluster_validation) {
72  validation_result << "========= ";
73  }
74  for (const auto& table_epoch : table_epochs) {
75  validation_result << "\n";
76  // Only add leaf index for cluster validation
77  if (is_cluster_validation) {
78  validation_result << std::setw(10)
79  << ("Leaf " + std::to_string(table_epoch.leaf_index));
80  }
81  validation_result << std::setw(10) << table_epoch.table_id << std::setw(10)
82  << table_epoch.table_epoch;
83  }
84  validation_result << "\n";
85  } else if (first_epoch < 0) {
86  validation_result << "\nNegative epoch value found for table \"" << table_name
87  << "\". Epoch: " << first_epoch << ".";
88  }
89 
90  return validation_result.str();
91 }
std::string to_string(char const *&&v)
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the call graph for this function:

+ Here is the caller graph for this function: