Merged PR 28628: Modified create archive routine to get the archive seq number after creation...

Modified create archive routine to get the archive seq number after creation based on the archive id. Increase retry count in delete function. Added retry in de-archive. Retries are needed to account for race conditions possibly with the indexer.
This commit is contained in:
Ouellette Jonathan (CSC FI SPS MESLEO)
2025-10-17 16:20:55 +00:00
parent 315abcde86
commit 1b94adb0d1

View File

@ -170,6 +170,9 @@ Service CreateArchiveRecord(ParentRecordId, ArchiveType, ReArchive, AddToQueue)
ErrorMsg = 'Unsupported Archive Type.'
End Case
If ErrorMsg EQ '' then
ArchiveType = Field(ArchiveId, '*', 1)
ParentRecordId = Field(ArchiveId, '*', 2)
ArchiveSeq = Field(ArchiveId, '*', 3)
ArchivePath = Environment_Services('GetTextDataBackupRootDir'):ArchiveType:'\':ParentRecordId:'\':ArchiveSeq:'\'
DirectoryCreated = RTI_OS_Directory( 'CREATE', ArchivePath)
If DirectoryCreated then
@ -1076,7 +1079,7 @@ Service DeleteRecord(TableName, RecordId)
If RowExists(TableName, RecordId) then
TableHandle = Database_Services('GetTableHandle', TableName)
If Error_Services('NoError') then
RetryCount = 3
RetryCount = 10
Done = False$
for i = 1 to RetryCount
Until Done
@ -1358,12 +1361,17 @@ Service DeArchiveDataFromTxt(ArchiveId)
ArchiveFilesPath = ArchiveRec<ARCHIVE_ARCHIVE_PATH$>
for i = DCount(ArchiveRec<ARCHIVE_CHILD_RECORD$>, @VM) to 1 step -1
until ErrorMsg NE ''
RetryLimit = 10
RetryCount = 1
RecordExists = False$
ErrorMsg = ''
Loop
Until RecordExists OR RetryCount EQ RetryLimit
RetryCount += 1
RecordId = ArchiveRec<ARCHIVE_CHILD_RECORD$, i>
TableName = ArchiveRec<ARCHIVE_CHILD_TABLE$, i>
RecordDeArchived = ArchiveRec<ARCHIVE_CHILD_RECORD_DE_ARCHIVED$, i>
If Not(RecordDeArchived) then
If Not(RowExists(RecordTable, TableName)) then
TxtFilePath = ArchiveFilesPath
TxtFileName = TableName : '-' : RecordId : '.txt'
swap '*' with '%2A' in TxtFileName
@ -1385,9 +1393,7 @@ Service DeArchiveDataFromTxt(ArchiveId)
GoSub ReAddMFS
end
end
end else
RecordExists = True$
end
If RecordExists then
ArchiveRec<ARCHIVE_CHILD_RECORD_DE_ARCHIVED$, i> = True$
ArchiveRec<ARCHIVE_CHILD_RECORD_ARCHIVED$, i> = False$
@ -1396,6 +1402,7 @@ Service DeArchiveDataFromTxt(ArchiveId)
ErrorMsg = 'An unspecified error occured saving the record.'
end
end
Repeat
Next i
Database_Services('WriteDataRow', 'ARCHIVE', ArchiveId, ArchiveRec, True$, 0, False$)
If Error_Services('HasError') then