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