MCPcopy Create free account
hub / github.com/ByConity/ByConity / createDatabaseInCatalog

Function createDatabaseInCatalog

src/Interpreters/CnchSystemLogHelper.cpp:37–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35{
36
37bool createDatabaseInCatalog(
38 const ContextPtr & global_context,
39 const String & database_name,
40 Poco::Logger * log)
41{
42 bool ret = true;
43 try
44 {
45 TxnTimestamp start_time = global_context->getTimestamp();
46 auto catalog = global_context->getCnchCatalog();
47 if (!catalog->isDatabaseExists(database_name, start_time))
48 {
49 try
50 {
51 LOG_INFO(log, "Creating database {} in catalog", database_name);
52 catalog->createDatabase(database_name, UUIDHelpers::generateV4(), start_time, start_time);
53 }
54 catch (Exception & e)
55 {
56 LOG_WARNING(log, "Failed to create database {}, got exception {}", database_name, e.message());
57 ret = false;
58 }
59 }
60 }
61 catch (Exception & e)
62 {
63 LOG_WARNING(log, "Unable to get timestamp, got exception: {}", e.message());
64 ret = false;
65 }
66
67 return ret;
68}
69
70String makeAlterColumnQuery(const String& database, const String& table, const Block& expected, const Block& actual)
71{

Callers 1

prepareDatabaseAndTableFunction · 0.85

Calls 5

generateV4Function · 0.85
isDatabaseExistsMethod · 0.80
getTimestampMethod · 0.45
getCnchCatalogMethod · 0.45
createDatabaseMethod · 0.45

Tested by

no test coverage detected