19 namespace system_validator {
21 std::ostringstream validation_result;
23 for (
const auto& table :
tables) {
25 const auto table_epochs =
31 if (validation_result.str().length() > 0) {
32 return validation_result.str();
46 const std::vector<Catalog_Namespace::TableEpochInfo>& table_epochs,
47 const std::string& table_name,
48 const bool is_cluster_validation) {
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;
60 if (epochs_are_inconsistent) {
61 validation_result <<
"\nEpoch values for table \"" << table_name
62 <<
"\" are inconsistent:\n"
65 if (is_cluster_validation) {
66 validation_result << std::setw(10) <<
"Node";
68 validation_result << std::setw(10) <<
"Table Id" << std::setw(10) <<
"Epoch"
69 <<
"\n========= ========= ";
71 if (is_cluster_validation) {
72 validation_result <<
"========= ";
74 for (
const auto& table_epoch : table_epochs) {
75 validation_result <<
"\n";
77 if (is_cluster_validation) {
78 validation_result << std::setw(10)
81 validation_result << std::setw(10) << table_epoch.table_id << std::setw(10)
82 << table_epoch.table_epoch;
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 <<
".";
90 return validation_result.str();
std::string validate() const
std::list< const TableDescriptor * > getAllTableMetadata() const
bool isForeignTable() const
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
bool should_validate_epoch(const TableDescriptor *table_descriptor)
bool isTemporaryTable() const
std::vector< TableEpochInfo > getTableEpochs(const int32_t db_id, const int32_t table_id) const