Commit 1940b949 authored by Marc Brendecke's avatar Marc Brendecke Committed by Jonathan Haas

Bessere Überprüfung eingebaut ob eine Datei gelöscht werden konnte.

parent b410ad9a
......@@ -46,7 +46,6 @@ import de.bsvrz.ars.ars.persistence.index.backend.management.LongRange;
import de.bsvrz.ars.ars.persistence.index.result.IndexResult;
import de.bsvrz.ars.ars.persistence.iter.DataIterator;
import de.bsvrz.ars.ars.persistence.iter.DeletedTreatment;
import de.bsvrz.ars.ars.persistence.walk.ContainerAction;
import de.bsvrz.ars.ars.persistence.walk.internal.StatusPrinter;
import de.bsvrz.dav.daf.main.DataDescription;
import de.bsvrz.dav.daf.main.archive.ArchiveDataKind;
......@@ -1155,17 +1154,17 @@ public final class PersistenceManager {
return result;
}
private void deleteIndexFiles(final String didPath) throws PersistenceException {
File monoIdxIdxFile = new File(didPath, ATimeMonotoneIndex.IDX_FILENAME);
File dataTimeIdxFile = new File(didPath, DataTimeIndex.IDX_FILENAME);
File managementIdxFile = new File(didPath, ContainerManagementIndex.IDX_FILENAME);
private static void deleteIndexFiles(final String didPath) throws PersistenceException {
Path monoIdxIdxFile = Paths.get(didPath, ATimeMonotoneIndex.IDX_FILENAME);
Path dataTimeIdxFile = Paths.get(didPath, DataTimeIndex.IDX_FILENAME);
Path managementIdxFile = Paths.get(didPath, ContainerManagementIndex.IDX_FILENAME);
final boolean dataTimeIndexFileDeleted = Util.deleteIfExists(dataTimeIdxFile);
final boolean monoIdxIdxFileDeleted = Util.deleteIfExists(monoIdxIdxFile);
final boolean managementIdxFileDeleted = Util.deleteIfExists(managementIdxFile);
if(!monoIdxIdxFileDeleted || !dataTimeIndexFileDeleted || !managementIdxFileDeleted) {
throw new PersistenceException("Loeschen der alten Indexdateien fehlgeschlagen: " + didPath);
try {
Files.deleteIfExists(dataTimeIdxFile);
Files.deleteIfExists(monoIdxIdxFile);
Files.deleteIfExists(managementIdxFile);
} catch(IOException e) {
throw new PersistenceException("Loeschen der alten Indexdateien fehlgeschlagen: " + didPath, e);
}
}
......@@ -1767,14 +1766,15 @@ public final class PersistenceManager {
for(int i = 0; i < headers.size(); i++) {
if(headers.getBoolean(i, ContainerManagementInformation.CHP_DELETED)) {
long containerId = headers.get(i, ContainerManagementInformation.CHP_CONT_ID);
ContainerFileHandle handle = accessContainer(node, archiveDataKind, containerId);
if(!handle.existsContainer()) continue;
executeOnContainer(handle.getFile().toPath(), () -> {
handle.readContainerHeader();
// Datei öffnen und Datenindexbereiche in neue Datei übernehmen
deletedContainerFile.addDeletedContainer(handle);
contsToDelete.add(containerId);
});
try (ContainerFileHandle handle = accessContainer(node, archiveDataKind, containerId)) {
if(!handle.existsContainer()) continue;
executeOnContainer(handle.getFile().toPath(), () -> {
handle.readContainerHeader();
// Datei öffnen und Datenindexbereiche in neue Datei übernehmen
deletedContainerFile.addDeletedContainer(handle);
contsToDelete.add(containerId);
});
}
}
}
deletedContainerFile.write();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment