|
@@ -2964,6 +2964,10 @@ ErrorCodeEnum CUpgradeTaskFSM::RollBackToHistoryVersion(CVersion historyVersion)
|
|
|
return Error_Unexpect;
|
|
|
}else{
|
|
|
fflush(fp);
|
|
|
+ int CommitRet = _commit(_fileno(fp));
|
|
|
+ if (CommitRet != 0) {
|
|
|
+ LogWarn(Severity_Middle, Error_Exception, ERR_TASK_ROLL_BACK_ACTIVE_FAIL, CSimpleStringA::Format("RRollBackToHistoryVersion fail, commit write active.txt fail, err=%d", (int)GetLastError()).GetData());
|
|
|
+ }
|
|
|
fclose(fp);
|
|
|
if (ExistsFileA(strBackupActiveFile.GetData())) {
|
|
|
RemoveFileA(strBackupActiveFile.GetData());
|
|
@@ -2981,7 +2985,7 @@ ErrorCodeEnum CUpgradeTaskFSM::RollBackToHistoryVersion(CVersion historyVersion)
|
|
|
if(re!=1){
|
|
|
LogWarn(Severity_Middle, Error_Exception, ERR_TASK_ROLL_BACK_ACTIVE_FAIL, CSimpleStringA::Format("RRollBackToHistoryVersion fail, Read active.txt fail,err=%d", (int)GetLastError()).GetData());
|
|
|
}else{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("read active.txt, version[%s]", cVer);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG,LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("read rewritten file active.txt, version[%s]", cVer);
|
|
|
}
|
|
|
fclose(fp);
|
|
|
|
|
@@ -3015,6 +3019,10 @@ ErrorCodeEnum CUpgradeTaskFSM::RollBackToHistoryVersion(CVersion historyVersion)
|
|
|
return Error_Unexpect;
|
|
|
}else{
|
|
|
fflush(fp);
|
|
|
+ int CommitRet = fsync(fileno(fp));
|
|
|
+ if (CommitRet != 0) {
|
|
|
+ LogWarn(Severity_Middle, Error_Exception, ERR_TASK_ROLL_BACK_ACTIVE_FAIL, CSimpleStringA::Format("RRollBackToHistoryVersion fail, commit write active.txt fail, err=%d", errno).GetData());
|
|
|
+ }
|
|
|
fclose(fp);
|
|
|
if (ExistsFileA(strBackupActiveFile.GetData())) {
|
|
|
RemoveFileA(strBackupActiveFile.GetData());
|
|
@@ -3032,7 +3040,7 @@ ErrorCodeEnum CUpgradeTaskFSM::RollBackToHistoryVersion(CVersion historyVersion)
|
|
|
if(re!=1){
|
|
|
LogWarn(Severity_Middle, Error_Exception, ERR_TASK_ROLL_BACK_ACTIVE_FAIL, CSimpleStringA::Format("RRollBackToHistoryVersion fail, Read active.txt fail,err=%d", errno).GetData());
|
|
|
}else{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("read active.txt, version[%s]", cVer);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG,LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("read rewritten file active.txt, version[%s]", cVer);
|
|
|
}
|
|
|
fclose(fp);
|
|
|
|
|
@@ -4630,7 +4638,7 @@ bool CUpgradeTaskFSM::DirIsExist(const char* scanPath, const char* dirName)
|
|
|
for (int i = 0; i < subdirs->nelts; ++i)
|
|
|
{
|
|
|
const char* dir = ARRAY_IDX(subdirs, i, char*);
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("dir=%s,dirName=%s", dir, dirName);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("dir=%s,dirName=%s", dir, dirName);
|
|
|
CSimpleStringA dirNameStr = dirName;
|
|
|
if (dirNameStr.Compare(_GetFileName(dir))==0) {
|
|
|
isMatch = true;
|
|
@@ -5095,6 +5103,9 @@ ErrorCodeEnum CUpgradeTaskFSM::RollBackToHistoryDepVersion(CSimpleStringA histor
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("RollBackToHistoryDepVersion fail, RewriteDepVersion version %s return %s", strHisVerPath.GetData(), SpStrError(ec));
|
|
|
LogWarn(Severity_Middle, Error_Exception, ERR_TASK_ROLL_BACK_ACTIVE_FAIL, CSimpleStringA::Format("RollBackToHistoryDepVersion fail, RewriteDepVersion version %s return %s", strHisVerPath.GetData(), SpStrError(ec)));
|
|
|
}
|
|
|
+ else {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("set rollback to history dep version [%s] succeed", historyDepVersion.GetData());
|
|
|
+ }
|
|
|
return ec;
|
|
|
|
|
|
}
|