52 if (!
m_context->namemap->name_to_id(name, table_id))
58 if (!
m_context->hyperspace->attr_exists(handle,
"schema"))
61 m_context->hyperspace->attr_get(handle,
"schema", value_buf);
67 if (old_schema->get_generation() < new_schema->get_generation()) {
68 m_context->hyperspace->attr_set(handle,
"schema", schema_str.c_str(),
70 HT_INFOF(
"Upgraded schema for '%s' from generation %lld to %lld", name.c_str(),
71 (
Lld)old_schema->get_generation(), (
Lld)new_schema->get_generation());
96 HT_FATALF(
"Unrecognized state %d", state);
103 return "OperationSystemUpgrade";
107 return String(
"SystemUpgrade");
Retrieves system information (hardware, installation directory, etc)
The FailureInducer simulates errors.
ContextPtr m_context
Pointer to Master context.
bool update_schema(const String &name, const String &schema_file)
Abstract base class for ephemeral operations.
std::string String
A String is simply a typedef to std::string.
static const char * METADATA_NAME
#define HT_ON_SCOPE_EXIT(...)
A dynamic, resizable and reference counted memory buffer.
std::shared_ptr< Context > ContextPtr
Smart pointer to Context.
virtual const String label()
Human readable label for operation.
void close_handle_ptr(SessionPtr hyperspace, uint64_t *handlep)
Compatibility Macros for C/C++.
OperationSystemUpgrade(ContextPtr &context)
static Schema * new_instance(const std::string &buf)
Creates schema object from XML schema string.
#define HT_FATALF(msg,...)
long long int Lld
Shortcut for printf formats.
Declarations for general-purpose utility functions.
#define HT_INFOF(msg,...)
atomically open and lock file exclusive, fail if can't
uint8_t * base
Pointer to the allocated memory buffer.
static String install_dir
The installation directory.
std::shared_ptr< Schema > SchemaPtr
Smart pointer to Schema.
void complete_ok(std::vector< MetaLog::EntityPtr > &additional)
Error codes, Exception handling, error logging.
static String file_to_string(const String &fname)
Reads a full file into a String.
virtual const String name()
Name of operation used for exclusivity.
virtual void execute()
Executes (carries out) the operation.
Executes user-defined functions when leaving the current scope.