//------------------------------------------------------------------------------ // Reinitialize a column segment extent (in the db file) to empty values, // following the HWM. Remaining extents in the file are truncated. // Also updates the header(s) as well. // // columnOID - OID of segment file to be reinitialized // dbRoot - DBRoot of segment file to be reinitialized // partNum - Partition number of segment file to be reinitialized // segNum - Segment number of segment file to be reinitialized // startOffsetBlk - File offset (after the HWM block), at which the file is // to be reinitialized. Value is in raw data blocks. // nBlocks - Number of blocks to be reinitialized // colType - Data type of the applicable column // colWidth - Width in bytes, of the applicable column // restoreHwmChk - Specifies whether HWM chunk is to be restored. //------------------------------------------------------------------------------ void BulkRollbackFileCompressedHdfs::reInitTruncColumnExtent( OID columnOID, u_int32_t dbRoot, u_int32_t partNum, u_int32_t segNum, long long startOffsetBlk, int nBlocks, CalpontSystemCatalog::ColDataType colType, u_int32_t colWidth, bool restoreHwmChk ) { long long startOffset = startOffsetBlk * BYTE_PER_BLOCK; std::ostringstream msgText; msgText << "Reinit HWM compressed column extent in HDFS db file" << ": dbRoot-" << dbRoot << "; part#-" << partNum << "; seg#-" << segNum << "; rawOffset(bytes)-"<< startOffset << "; rawFreeBlks-" << nBlocks; fMgr->logAMessage( logging::LOG_TYPE_INFO, logging::M0075, columnOID, msgText.str() ); restoreFromBackup( "column", columnOID, dbRoot, partNum, segNum ); }
void BackupDialog::restoreBackupPressed() { if (loadingState) return; QModelIndex index = ui->listView->currentIndex(); emit restoreFromBackup(index.data().toString()); }
/*! * \brief Database::Database * \param databaseDir directory to load/store the database * \param schemaDirectory directory of the SQL schema for the database * \param parent */ Database::Database(const QString &databaseDir, const QString &schemaDirectory, QObject* parent) : QObject(parent), m_databaseDirectory(databaseDir), m_sqlSchemaDirectory(schemaDirectory), m_db(new QSqlDatabase()) { if (!QFile::exists(m_databaseDirectory)) { QDir dir; bool createOk = dir.mkpath(m_databaseDirectory); if (!createOk) qWarning() << "Unable to create DB directory" << m_databaseDirectory; } m_albumTable = new AlbumTable(this, this); m_mediaTable = new MediaTable(this, this); // Open the database. if (!openDB()) restoreFromBackup(); // Attempt a query to make sure the DB is valid. QSqlQuery test_query(*m_db); if (!test_query.exec("SELECT * FROM SQLITE_MASTER LIMIT 1")) { logSqlError(test_query); restoreFromBackup(); } QSqlQuery query(*m_db); // Turn synchronous off. if (!query.exec("PRAGMA synchronous = OFF")) { logSqlError(query); return; } // Enable foreign keys. if (!query.exec("PRAGMA foreign_keys = ON")) { logSqlError(query); return; } // Update if needed. upgradeSchema(schemaVersion()); }
//------------------------------------------------------------------------------ // Truncate the specified database segment file to the extent specified by // the given file offset. Also updates the header(s) as well. // // columnOID - OID of segment file to be truncated // dbRoot - DBRoot of segment file to be truncated // partNum - Partition number of segment file to be truncated // segNum - Segment number of segment file to be truncated // fileSizeBlocks - Number of raw data blocks to be left in the file. // Remainder of file is to be truncated. //------------------------------------------------------------------------------ void BulkRollbackFileCompressedHdfs::truncateSegmentFile( OID columnOID, u_int32_t dbRoot, u_int32_t partNum, u_int32_t segNum, long long fileSizeBlocks ) { std::ostringstream msgText; msgText << "Truncating compressed HDFS column file" ": dbRoot-" << dbRoot << "; part#-" << partNum << "; seg#-" << segNum << "; rawTotBlks-" << fileSizeBlocks; fMgr->logAMessage( logging::LOG_TYPE_INFO, logging::M0075, columnOID, msgText.str() ); restoreFromBackup( "column", columnOID, dbRoot, partNum, segNum ); }
//------------------------------------------------------------------------------ // Reinitialize a dictionary segment extent (in the db file) to empty blocks, // following the HWM. Remaining extents in the file are truncated. // Also updates the header(s) as well. // // dStoreOID - OID of segment store file to be reinitialized // dbRoot - DBRoot of segment file to be reinitialized // partNum - Partition number of segment file to be reinitialized // segNum - Segment number of segment file to be reinitialized // startOffsetBlk - Starting block (after the HWM block), at which the file is // to be reinitialized. Value is in raw data blocks. // nBlocks - Number of blocks to be reinitialized //------------------------------------------------------------------------------ void BulkRollbackFileCompressedHdfs::reInitTruncDctnryExtent( OID dStoreOID, u_int32_t dbRoot, u_int32_t partNum, u_int32_t segNum, long long startOffsetBlk, int nBlocks ) { long long startOffset = startOffsetBlk * BYTE_PER_BLOCK; std::ostringstream msgText; msgText << "Reinit HWM compressed dictionary store extent in HDFS db file" ": dbRoot-" << dbRoot << "; part#-" << partNum << "; seg#-" << segNum << "; rawOffset(bytes)-" << startOffset << "; rawFreeBlks-" << nBlocks; fMgr->logAMessage( logging::LOG_TYPE_INFO, logging::M0075, dStoreOID, msgText.str() ); restoreFromBackup( "dictionary store", dStoreOID, dbRoot, partNum, segNum ); }