src/backend/benchmark/logger/logger_workload.cpp
/**
 * @brief recover the database and check the tuples
 */
@brief recover the database and check the tuples
@brief recover the database and check the tuples
void DoRecovery(std::string file_name) {
	auto file_path = GetFilePath(state.log_file_dir, file_name);
	std::ifstream log_file(file_path);
	log_file.close();
	ycsb::CreateYCSBDatabase();
	Timer<std::milli> timer;
	timer.Start();
  auto& log_manager = logging::LogManager::GetInstance();
  log_manager.ResetFrontendLogger();
	log_manager.SetLogFileName(file_path);
	std::thread thread(&logging::LogManager::StartStandbyMode, &log_manager);
	log_manager.WaitForModeTransition(LOGGING_STATUS_TYPE_STANDBY, true);
	log_manager.StartRecoveryMode();
	log_manager.WaitForModeTransition(LOGGING_STATUS_TYPE_LOGGING, true);
	if (log_manager.EndLogging()) {
		thread.join();
	} else {
		LOG_ERROR("Failed to terminate logging thread");
	}
  timer.Stop();
  if (state.experiment_type == EXPERIMENT_TYPE_RECOVERY) {
    WriteOutput(timer.GetDuration());
  }
}
void DoRecovery ( std :: string file_name ) { auto file_path = GetFilePath ( state . log_file_dir , file_name ) ; std :: ifstream log_file ( file_path ) ; log_file . close ( ) ; ycsb :: CreateYCSBDatabase ( ) ; Timer < std :: milli > timer ; timer . Start ( ) ; auto & log_manager = logging :: LogManager :: GetInstance ( ) ; log_manager . ResetFrontendLogger ( ) ; log_manager . SetLogFileName ( file_path ) ; std :: thread thread ( & logging :: LogManager :: StartStandbyMode , & log_manager ) ; log_manager . WaitForModeTransition ( LOGGING_STATUS_TYPE_STANDBY , true ) ; log_manager . StartRecoveryMode ( ) ; log_manager . WaitForModeTransition ( LOGGING_STATUS_TYPE_LOGGING , true ) ; if ( log_manager . EndLogging ( ) ) { thread . join ( ) ; } else { LOG_ERROR ( " " ) ; } timer . Stop ( ) ; if ( state . experiment_type == EXPERIMENT_TYPE_RECOVERY ) { WriteOutput ( timer . GetDuration ( ) ) ; } }
@brief recover the database and check the tuples
@brief recover the database and check the tuples
// Reset the log file if exists //===--------------------------------------------------------------------===// // RECOVERY //===--------------------------------------------------------------------===// // reset frontend logger to reopen log file // set log file and logging type // start off the frontend logger of appropriate type in STANDBY mode // wait for the frontend logger to enter STANDBY mode // STANDBY -> RECOVERY mode // Wait for the frontend logger to enter LOGGING mode after recovery // Recovery time (in ms)