| 35 | { |
| 36 | |
| 37 | bool 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 | |
| 70 | String makeAlterColumnQuery(const String& database, const String& table, const Block& expected, const Block& actual) |
| 71 | { |
no test coverage detected