OmniSciDB
a5dc49c757
|
#include <AlterColumnRecovery.h>
Classes | |
struct | ColumnAltered |
struct | RecoveryInfo |
struct | RecoveryParamFilepathInfo |
Public Types | |
using | TypePairs = alter_column_shared::TypePairs |
Public Member Functions | |
AlterTableAlterColumnCommandRecoveryMgr (Catalog_Namespace::Catalog &catalog) | |
void | rollback (const TableDescriptor *td, const RecoveryInfo ¶m) |
void | cleanup (const TableDescriptor *td, const TypePairs &src_dst_cds) |
void | checkpoint (const TableDescriptor *td, const TypePairs &src_dst_cds) |
RecoveryInfo | deserializeRecoveryInformation (const std::string &filename) |
std::string | serializeRecoveryInformation (const RecoveryInfo ¶m) |
void | writeSerializedRecoveryInformation (const RecoveryInfo ¶m, const RecoveryParamFilepathInfo &filepath_info) |
void | readSerializedRecoveryInformation (RecoveryInfo ¶m, const RecoveryParamFilepathInfo &filepath_info) |
std::string | recoveryFilepath (const RecoveryParamFilepathInfo &filepath_info) |
RecoveryParamFilepathInfo | getRecoveryFilepathInfo (const int32_t table_id=-1) |
Static Public Member Functions | |
static void | resolveIncompleteAlterColumnCommandsForAllCatalogs () |
Static Public Attributes | |
static const std::string | kRecoveryDirectoryName = "crash_recovery" |
Private Member Functions | |
void | cleanupDeleteDictionaries (const TableDescriptor *td, const TypePairs &src_dst_cds) |
void | cleanupClearChunk (const ChunkKey &key, const MemoryLevel mem_level) |
void | cleanupClearChunk (const ChunkKey &key) |
void | cleanupClearRemainingChunks (const TableDescriptor *td, const TypePairs &src_dst_cds) |
void | cleanupDropSourceGeoColumns (const TableDescriptor *td, const TypePairs &src_dst_cds) |
std::list< std::pair < ColumnDescriptor, ColumnDescriptor > > | toPairedCds (const std::list< ColumnAltered > &altered_columns) |
void | recoverAlterTableAlterColumnFromFile (const std::string &filename) |
std::list< std::filesystem::path > | getRecoveryFiles () |
TypePairs | getSrcDstCds (int table_id, std::list< std::pair< ColumnDescriptor, ColumnDescriptor >> &pairs_list) |
void | resolveIncompleteAlterColumnCommands () |
Static Private Member Functions | |
static std::list< ColumnAltered > | fromPairedCds (const std::list< std::pair< ColumnDescriptor, ColumnDescriptor >> &altered_columns) |
static std::filesystem::path | getRecoveryPrefix (const std::string &base_path) |
static std::map< std::string, AlterTableAlterColumnCommandRecoveryMgr > | createRecoveryManagersForCatalogs () |
Private Attributes | |
Catalog_Namespace::Catalog & | catalog_ |
Definition at line 22 of file AlterColumnRecovery.h.
Definition at line 26 of file AlterColumnRecovery.h.
AlterTableAlterColumnCommandRecoveryMgr::AlterTableAlterColumnCommandRecoveryMgr | ( | Catalog_Namespace::Catalog & | catalog | ) |
Definition at line 27 of file AlterColumnRecovery.cpp.
void AlterTableAlterColumnCommandRecoveryMgr::checkpoint | ( | const TableDescriptor * | td, |
const TypePairs & | src_dst_cds | ||
) |
Definition at line 348 of file AlterColumnRecovery.cpp.
References catalog_, Catalog_Namespace::Catalog::checkpointWithAutoRollback(), ddl_utils::alter_column_utils::compare_column_descriptors(), Catalog_Namespace::Catalog::getMetadataForDict(), ddl_utils::alter_column_utils::CompareResult::sql_types_match, and TableDescriptor::tableId.
Referenced by AlterTableAlterColumnCommand::alterColumnTypes(), and cleanup().
void AlterTableAlterColumnCommandRecoveryMgr::cleanup | ( | const TableDescriptor * | td, |
const TypePairs & | src_dst_cds | ||
) |
Definition at line 317 of file AlterColumnRecovery.cpp.
References catalog_, checkpoint(), cleanupClearRemainingChunks(), cleanupDeleteDictionaries(), cleanupDropSourceGeoColumns(), LOG, Catalog_Namespace::Catalog::resetTableEpochFloor(), TableDescriptor::tableId, and logger::WARNING.
Referenced by AlterTableAlterColumnCommand::alterColumnTypes(), and recoverAlterTableAlterColumnFromFile().
|
private |
Definition at line 115 of file AlterColumnRecovery.cpp.
References catalog_, Data_Namespace::DataMgr::deleteChunk(), and Catalog_Namespace::Catalog::getDataMgr().
Referenced by cleanupClearChunk(), and cleanupClearRemainingChunks().
|
private |
Definition at line 129 of file AlterColumnRecovery.cpp.
References cleanupClearChunk(), Data_Namespace::CPU_LEVEL, Data_Namespace::DISK_LEVEL, and Data_Namespace::GPU_LEVEL.
|
private |
Definition at line 135 of file AlterColumnRecovery.cpp.
References catalog_, CHUNK_KEY_FRAGMENT_IDX, cleanupClearChunk(), Data_Namespace::DataMgr::getChunkMetadataVecForKeyPrefix(), Catalog_Namespace::Catalog::getDatabaseId(), Catalog_Namespace::Catalog::getDataMgr(), and TableDescriptor::tableId.
Referenced by cleanup().
|
private |
Definition at line 101 of file AlterColumnRecovery.cpp.
References catalog_, ddl_utils::alter_column_utils::compare_column_descriptors(), Catalog_Namespace::Catalog::delDictionaryTransactional(), and ddl_utils::alter_column_utils::CompareResult::sql_types_match.
Referenced by cleanup().
|
private |
Definition at line 166 of file AlterColumnRecovery.cpp.
References catalog_, Data_Namespace::CPU_LEVEL, Catalog_Namespace::DBMetadata::dbId, Data_Namespace::DataMgr::deleteChunksWithPrefix(), Data_Namespace::DISK_LEVEL, Catalog_Namespace::Catalog::dropColumnTransactional(), Catalog_Namespace::Catalog::getCurrentDB(), Catalog_Namespace::Catalog::getDataMgr(), Catalog_Namespace::Catalog::getMetadataForColumn(), Data_Namespace::GPU_LEVEL, and TableDescriptor::tableId.
Referenced by cleanup().
|
staticprivate |
Definition at line 509 of file AlterColumnRecovery.cpp.
References CHECK, getRecoveryPrefix(), Catalog_Namespace::SysCatalog::instance(), and run_benchmark_import::result.
Referenced by resolveIncompleteAlterColumnCommandsForAllCatalogs().
AlterTableAlterColumnCommandRecoveryMgr::RecoveryInfo AlterTableAlterColumnCommandRecoveryMgr::deserializeRecoveryInformation | ( | const std::string & | filename | ) |
Definition at line 204 of file AlterColumnRecovery.cpp.
References AlterTableAlterColumnCommandRecoveryMgr::RecoveryInfo::added_columns, AlterTableAlterColumnCommandRecoveryMgr::RecoveryInfo::altered_columns, CHECK, fromPairedCds(), json_utils::get_value_from_object(), AlterTableAlterColumnCommandRecoveryMgr::RecoveryInfo::is_vacuumed, json_utils::read_from_file(), AlterTableAlterColumnCommandRecoveryMgr::RecoveryInfo::renamed_columns, AlterTableAlterColumnCommandRecoveryMgr::RecoveryInfo::src_dst_cds, AlterTableAlterColumnCommandRecoveryMgr::RecoveryInfo::table_epoch, and AlterTableAlterColumnCommandRecoveryMgr::RecoveryInfo::updated_dict_cds.
Referenced by readSerializedRecoveryInformation(), and recoverAlterTableAlterColumnFromFile().
|
staticprivate |
Definition at line 184 of file AlterColumnRecovery.cpp.
Referenced by deserializeRecoveryInformation().
AlterTableAlterColumnCommandRecoveryMgr::RecoveryParamFilepathInfo AlterTableAlterColumnCommandRecoveryMgr::getRecoveryFilepathInfo | ( | const int32_t | table_id = -1 | ) |
Definition at line 248 of file AlterColumnRecovery.cpp.
References AlterTableAlterColumnCommandRecoveryMgr::RecoveryParamFilepathInfo::base_path, catalog_, AlterTableAlterColumnCommandRecoveryMgr::RecoveryParamFilepathInfo::db_name, Catalog_Namespace::DBMetadata::dbName, Catalog_Namespace::Catalog::getCatalogBasePath(), Catalog_Namespace::Catalog::getCurrentDB(), Catalog_Namespace::Catalog::getTableName(), and AlterTableAlterColumnCommandRecoveryMgr::RecoveryParamFilepathInfo::table_name.
Referenced by AlterTableAlterColumnCommand::cleanupRecoveryInfo(), getRecoveryFiles(), and AlterTableAlterColumnCommand::populateAndWriteRecoveryInfo().
|
private |
Definition at line 370 of file AlterColumnRecovery.cpp.
References catalog_, getRecoveryFilepathInfo(), logger::INFO, LOG, Catalog_Namespace::Catalog::name(), recoveryFilepath(), and run_benchmark_import::result.
Referenced by resolveIncompleteAlterColumnCommands().
|
staticprivate |
Definition at line 228 of file AlterColumnRecovery.cpp.
References kRecoveryDirectoryName.
Referenced by createRecoveryManagersForCatalogs(), recoveryFilepath(), and writeSerializedRecoveryInformation().
|
private |
Definition at line 400 of file AlterColumnRecovery.cpp.
References catalog_, Catalog_Namespace::Catalog::getMetadataForColumn(), and run_benchmark_import::result.
Referenced by recoverAlterTableAlterColumnFromFile().
void AlterTableAlterColumnCommandRecoveryMgr::readSerializedRecoveryInformation | ( | RecoveryInfo & | param, |
const RecoveryParamFilepathInfo & | filepath_info | ||
) |
Definition at line 257 of file AlterColumnRecovery.cpp.
References deserializeRecoveryInformation(), nvtx_helpers::anonymous_namespace{nvtx_helpers.cpp}::filename(), and recoveryFilepath().
|
private |
Definition at line 418 of file AlterColumnRecovery.cpp.
References catalog_, CHECK, CHECK_EQ, CHECK_GT, cleanup(), Data_Namespace::CPU_LEVEL, Catalog_Namespace::DBMetadata::dbId, Data_Namespace::DataMgr::deleteChunksWithPrefix(), deserializeRecoveryInformation(), Catalog_Namespace::Catalog::getCurrentDB(), Catalog_Namespace::Catalog::getDatabaseId(), Catalog_Namespace::Catalog::getDataMgr(), getSrcDstCds(), Catalog_Namespace::Catalog::getTableEpochs(), Catalog_Namespace::Catalog::getTableName(), Data_Namespace::GPU_LEVEL, hash_value(), logger::INFO, CacheInvalidator< CACHE_HOLDING_TYPES >::invalidateCachesByTable(), AlterTableAlterColumnCommandRecoveryMgr::RecoveryInfo::is_vacuumed, LOG, rollback(), Catalog_Namespace::Catalog::setTableEpoch(), AlterTableAlterColumnCommandRecoveryMgr::RecoveryInfo::src_dst_cds, and AlterTableAlterColumnCommandRecoveryMgr::RecoveryInfo::table_epoch.
Referenced by resolveIncompleteAlterColumnCommands().
std::string AlterTableAlterColumnCommandRecoveryMgr::recoveryFilepath | ( | const RecoveryParamFilepathInfo & | filepath_info | ) |
Definition at line 233 of file AlterColumnRecovery.cpp.
References AlterTableAlterColumnCommandRecoveryMgr::RecoveryParamFilepathInfo::base_path, AlterTableAlterColumnCommandRecoveryMgr::RecoveryParamFilepathInfo::db_name, getRecoveryPrefix(), and AlterTableAlterColumnCommandRecoveryMgr::RecoveryParamFilepathInfo::table_name.
Referenced by AlterTableAlterColumnCommand::cleanupRecoveryInfo(), getRecoveryFiles(), AlterTableAlterColumnCommand::populateAndWriteRecoveryInfo(), readSerializedRecoveryInformation(), and writeSerializedRecoveryInformation().
|
private |
Definition at line 494 of file AlterColumnRecovery.cpp.
References catalog_, getRecoveryFiles(), logger::INFO, LOG, Catalog_Namespace::Catalog::name(), and recoverAlterTableAlterColumnFromFile().
|
static |
Definition at line 542 of file AlterColumnRecovery.cpp.
References createRecoveryManagersForCatalogs().
Referenced by startHeavyDBServer().
void AlterTableAlterColumnCommandRecoveryMgr::rollback | ( | const TableDescriptor * | td, |
const RecoveryInfo & | param | ||
) |
Definition at line 31 of file AlterColumnRecovery.cpp.
References AlterTableAlterColumnCommandRecoveryMgr::RecoveryInfo::added_columns, Catalog_Namespace::Catalog::alterColumnTypeTransactional(), AlterTableAlterColumnCommandRecoveryMgr::RecoveryInfo::altered_columns, catalog_, Data_Namespace::CPU_LEVEL, Catalog_Namespace::DBMetadata::dbId, Catalog_Namespace::Catalog::delDictionaryTransactional(), Data_Namespace::DataMgr::deleteChunksWithPrefix(), Catalog_Namespace::Catalog::dropColumnTransactional(), Catalog_Namespace::Catalog::getAllColumnMetadataForTable(), Catalog_Namespace::Catalog::getAllDictionariesWithColumnInName(), Catalog_Namespace::Catalog::getCurrentDB(), Catalog_Namespace::Catalog::getDatabaseId(), Catalog_Namespace::Catalog::getDataMgr(), Data_Namespace::GPU_LEVEL, Catalog_Namespace::Catalog::renameColumn(), AlterTableAlterColumnCommandRecoveryMgr::RecoveryInfo::renamed_columns, TableDescriptor::tableId, and AlterTableAlterColumnCommandRecoveryMgr::RecoveryInfo::updated_dict_cds.
Referenced by AlterTableAlterColumnCommand::alterColumnTypes(), and recoverAlterTableAlterColumnFromFile().
std::string AlterTableAlterColumnCommandRecoveryMgr::serializeRecoveryInformation | ( | const RecoveryInfo & | param | ) |
Definition at line 271 of file AlterColumnRecovery.cpp.
References json_utils::add_value_to_object(), AlterTableAlterColumnCommandRecoveryMgr::RecoveryInfo::added_columns, AlterTableAlterColumnCommandRecoveryMgr::RecoveryInfo::altered_columns, AlterTableAlterColumnCommandRecoveryMgr::RecoveryInfo::is_vacuumed, AlterTableAlterColumnCommandRecoveryMgr::RecoveryInfo::renamed_columns, AlterTableAlterColumnCommandRecoveryMgr::RecoveryInfo::src_dst_cds, AlterTableAlterColumnCommandRecoveryMgr::RecoveryInfo::table_epoch, toPairedCds(), AlterTableAlterColumnCommandRecoveryMgr::RecoveryInfo::updated_dict_cds, and json_utils::write_to_string().
Referenced by writeSerializedRecoveryInformation().
|
private |
Definition at line 194 of file AlterColumnRecovery.cpp.
Referenced by serializeRecoveryInformation().
void AlterTableAlterColumnCommandRecoveryMgr::writeSerializedRecoveryInformation | ( | const RecoveryInfo & | param, |
const RecoveryParamFilepathInfo & | filepath_info | ||
) |
Definition at line 292 of file AlterColumnRecovery.cpp.
References AlterTableAlterColumnCommandRecoveryMgr::RecoveryParamFilepathInfo::base_path, nvtx_helpers::anonymous_namespace{nvtx_helpers.cpp}::filename(), getRecoveryPrefix(), recoveryFilepath(), and serializeRecoveryInformation().
Referenced by AlterTableAlterColumnCommand::populateAndWriteRecoveryInfo().
|
private |
Definition at line 112 of file AlterColumnRecovery.h.
Referenced by checkpoint(), cleanup(), cleanupClearChunk(), cleanupClearRemainingChunks(), cleanupDeleteDictionaries(), cleanupDropSourceGeoColumns(), getRecoveryFilepathInfo(), getRecoveryFiles(), getSrcDstCds(), recoverAlterTableAlterColumnFromFile(), resolveIncompleteAlterColumnCommands(), and rollback().
|
inlinestatic |
Definition at line 76 of file AlterColumnRecovery.h.
Referenced by getRecoveryPrefix().