patch 4.0
This commit is contained in:
@ -19,9 +19,12 @@
|
||||
#include "share/inner_table/ob_inner_table_schema.h"
|
||||
#include <string>
|
||||
|
||||
namespace oceanbase {
|
||||
namespace share {
|
||||
namespace schema {
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace share
|
||||
{
|
||||
namespace schema
|
||||
{
|
||||
|
||||
// Mysql server backend intialize helper for unittest.
|
||||
//
|
||||
@ -32,35 +35,27 @@ namespace schema {
|
||||
// pass: ""
|
||||
// database: ${USER//./_}_unittest
|
||||
//
|
||||
// 2. create OceanBase system table schema in mysql server.
|
||||
// 2. create ocenabase system table schema in mysql server.
|
||||
//
|
||||
class DBInitializer {
|
||||
class DBInitializer
|
||||
{
|
||||
public:
|
||||
DBInitializer()
|
||||
{}
|
||||
DBInitializer() : is_inited_(false) {}
|
||||
virtual ~DBInitializer();
|
||||
|
||||
inline int init();
|
||||
inline std::string get_db_name()
|
||||
{
|
||||
return db_.db_;
|
||||
}
|
||||
inline int create_system_table(bool only_core_tables);
|
||||
inline int fill_sys_stat_table(const uint64_t tenant_id = common::OB_SYS_TENANT_ID);
|
||||
inline int create_tenant_space_tables(const uint64_t tenant_id);
|
||||
inline int create_tenant_space(const uint64_t tenant_id);
|
||||
inline int create_virtual_table(const schema_create_func create_func);
|
||||
common::ObMySQLProxy& get_sql_proxy()
|
||||
{
|
||||
return sql_proxy_;
|
||||
}
|
||||
common::ObServerConfig& get_config()
|
||||
{
|
||||
return common::ObServerConfig::get_instance();
|
||||
}
|
||||
int init();
|
||||
std::string get_db_name() { return db_.db_; }
|
||||
int create_system_table(bool only_core_tables, const uint64_t tenant_id = common::OB_SYS_TENANT_ID);
|
||||
int fill_sys_stat_table(const uint64_t tenant_id = common::OB_SYS_TENANT_ID);
|
||||
int create_tenant_space_tables(const uint64_t tenant_id);
|
||||
int create_tenant_space(const uint64_t tenant_id);
|
||||
int create_virtual_table(const schema_create_func create_func);
|
||||
common::ObMySQLProxy &get_sql_proxy() { return sql_proxy_; }
|
||||
common::ObServerConfig &get_config() { return common::ObServerConfig::get_instance(); }
|
||||
|
||||
private:
|
||||
struct DBConfig {
|
||||
struct DBConfig
|
||||
{
|
||||
std::string host_;
|
||||
int port_;
|
||||
std::string user_;
|
||||
@ -68,24 +63,30 @@ private:
|
||||
std::string db_;
|
||||
};
|
||||
|
||||
std::string to_var_name(const std::string& from) const;
|
||||
std::string get_env_value(const char* name, const char* def_val);
|
||||
private:
|
||||
std::string to_var_name(const std::string &from) const;
|
||||
std::string get_env_value(const char *name, const char *def_val);
|
||||
int db_gc();
|
||||
int mysql_host_detect();
|
||||
int create_db();
|
||||
int init_sql_proxy();
|
||||
int log_init_core_operation();
|
||||
|
||||
private:
|
||||
bool is_inited_;
|
||||
DBConfig db_;
|
||||
|
||||
inline int log_init_core_operation();
|
||||
common::sqlclient::ObSingleMySQLConnectionPool sql_conn_pool_;
|
||||
common::ObMySQLProxy sql_proxy_;
|
||||
uint64_t tenant_id_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(DBInitializer);
|
||||
};
|
||||
|
||||
} // end namespace schema
|
||||
} // end namespace share
|
||||
} // end namespace oceanbase
|
||||
} // end namespace schema
|
||||
} // end namespace share
|
||||
} // end namespace oceanbase
|
||||
|
||||
// all implemented in .h file for convenient: no need to link
|
||||
#include "db_initializer.ipp"
|
||||
|
||||
#endif // OCEANBASE_SCHEMA_DB_INITIALIZER_H_
|
||||
#endif // OCEANBASE_SCHEMA_DB_INITIALIZER_H_
|
||||
|
||||
Reference in New Issue
Block a user