OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SystemValidator.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <Shared/measure.h>
20 #include "Catalog/Catalog.h"
21 #include "Logger/Logger.h"
22 
23 #include "LeafAggregator.h"
24 #include "QueryState.h"
25 
26 class DBHandler;
27 
28 namespace system_validator {
29 std::string validate_table_epochs(
30  const std::vector<Catalog_Namespace::TableEpochInfo>& table_epochs,
31  const std::string& table_name,
32  const bool is_cluster_validation);
33 
34 bool should_validate_epoch(const TableDescriptor* table_descriptor);
35 
42  public:
43  DistributedValidate(const std::string& type,
44  const bool is_repair_type_remove,
46  LeafAggregator& leaf_aggregator,
47  const Catalog_Namespace::SessionInfo session_info,
48  DBHandler& db_handler)
49  : cat_(cat)
50  , type_(type)
51  , is_repair_type_remove_(is_repair_type_remove)
52  , leaf_aggregator_(leaf_aggregator)
53  , session_info_(session_info)
54  , db_handler_(db_handler) {
55  if (to_upper(type) != "CLUSTER") {
56  throw std::runtime_error{
57  "Unexpected validation type specified. Only the \"VALIDATE CLUSTER;\" command "
58  "is currently supported."};
59  }
60  }
61 
65  std::string validate(query_state::QueryStateProxy query_state_proxy) const {
66  return nullptr;
67  };
68 
69  private:
70  std::string validateEpochs(const std::vector<TTableMeta>& table_meta_vector) const;
71 
73  const std::string type_;
78 };
79 
84  public:
85  SingleNodeValidator(const std::string& type, Catalog_Namespace::Catalog& catalog)
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  }
93 
94  std::string validate() const;
95 
96  private:
98 };
99 } // namespace system_validator
std::string cat(Ts &&...args)
class for a per-database catalog. also includes metadata for the current database and the current use...
Definition: Catalog.h:143
Catalog_Namespace::Catalog & catalog_
Catalog_Namespace::Catalog & cat_
std::string validate_table_epochs(const std::vector< Catalog_Namespace::TableEpochInfo > &table_epochs, const std::string &table_name, const bool is_cluster_validation)
Driver for running validation on a single node.
This file contains the class specification and related data structures for Catalog.
std::string validate(query_state::QueryStateProxy query_state_proxy) const
Compares Aggregators and Leaves metatdata reporting what is different.
const Catalog_Namespace::SessionInfo session_info_
Driver for running distributed validation on metadata across cluster. DistributedValidate provides fu...
bool should_validate_epoch(const TableDescriptor *table_descriptor)
std::string to_upper(const std::string &str)
DistributedValidate(const std::string &type, const bool is_repair_type_remove, Catalog_Namespace::Catalog &cat, LeafAggregator &leaf_aggregator, const Catalog_Namespace::SessionInfo session_info, DBHandler &db_handler)
std::string validateEpochs(const std::vector< TTableMeta > &table_meta_vector) const
SingleNodeValidator(const std::string &type, Catalog_Namespace::Catalog &catalog)