in entity-store/src/main/java/jetbrains/exodus/entitystore/PersistentEntityStoreImpl.java [351:464]
private void applyRefactorings(final boolean fromScratch) {
environment.suspendGC();
try {
final PersistentEntityStoreRefactorings refactorings = new PersistentEntityStoreRefactorings(this);
if (config.getRefactoringDeleteRedundantBlobs()) {
refactorings.refactorDeleteRedundantBlobs();
}
if (config.getRefactoringClearBrokenBlobs()) {
executeInTransaction(txn -> clearBrokenBlobs((PersistentStoreTransaction) txn));
}
if (config.getRefactoringClearNotRegisteredBlobs()) {
executeInTransaction(txn -> clearNotRegisteredBlobs((PersistentStoreTransaction) txn));
}
if (!useVersion1Format() &&
(fromScratch ||
Settings.get(internalSettings, "refactorBlobsForVersion2Format() applied") == null)) {
if (!fromScratch) {
refactorings.refactorBlobsToVersion2Format(internalSettings);
}
Settings.set(internalSettings, "refactorBlobsForVersion2Format() applied", "y");
}
if (!useVersion1Format() && (fromScratch ||
Settings.get(internalSettings, "refactorEntitiesTablesToBitmap() applied") == null)) {
if (!fromScratch) {
refactorings.refactorEntitiesTablesToBitmap(internalSettings);
}
Settings.set(internalSettings, "refactorEntitiesTablesToBitmap() applied", "y");
}
if (!useVersion1Format() && useIntForLocalId() && (fromScratch ||
Settings.get(internalSettings, "refactorAllPropsIndexToBitmap() applied") == null)) {
if (!fromScratch) {
refactorings.refactorAllPropsIndexToBitmap();
}
Settings.set(internalSettings, "refactorAllPropsIndexToBitmap() applied", "y");
}
if (!useVersion1Format() && useIntForLocalId() && (fromScratch ||
Settings.get(internalSettings, "refactorAllLinksIndexToBitmap() applied") == null)) {
if (!fromScratch) {
refactorings.refactorAllLinksIndexToBitmap();
}
Settings.set(internalSettings, "refactorAllLinksIndexToBitmap() applied", "y");
}
if (!useVersion1Format() && useIntForLocalId() && (fromScratch ||
Settings.get(internalSettings, "refactorAllBlobsIndexToBitmap() applied") == null)) {
if (!fromScratch) {
refactorings.refactorAllBlobsIndexToBitmap();
}
Settings.set(internalSettings, "refactorAllBlobsIndexToBitmap() applied", "y");
}
if (!fromScratch && !useVersion1Format()) {
refactorings.refactorDeduplicateInPlaceBlobsPeriodically(internalSettings);
}
if (fromScratch || Settings.get(internalSettings, "Null-indices refactored") == null || config.getRefactoringNullIndices()) {
if (!fromScratch) {
Settings.delete(internalSettings, "Null-indices present"); // don't waste space
Settings.delete(internalSettings, "Null-indices present 2"); // don't waste space
Settings.delete(internalSettings, "Null-indices present 3"); // don't waste space
refactorings.refactorCreateNullPropertyIndices();
}
Settings.set(internalSettings, "Null-indices refactored", "yes");
}
if (fromScratch || Settings.get(internalSettings, "Blobs' null-indices present") == null || config.getRefactoringBlobNullIndices()) {
if (!fromScratch) {
refactorings.refactorCreateNullBlobIndices();
}
Settings.set(internalSettings, "Blobs' null-indices present", "yes");
}
if (fromScratch || Settings.get(internalSettings, "refactorDropEmptyPrimaryLinkTables() applied") == null) {
if (!fromScratch) {
refactorings.refactorDropEmptyPrimaryLinkTables();
}
Settings.set(internalSettings, "refactorDropEmptyPrimaryLinkTables() applied", "y");
}
if (fromScratch || Settings.get(internalSettings, "refactorMakeLinkTablesConsistent() applied") == null || config.getRefactoringHeavyLinks()) {
if (!fromScratch) {
refactorings.refactorAddMissedLinks();
refactorings.refactorMakeLinkTablesConsistent(internalSettings);
}
Settings.set(internalSettings, "refactorMakeLinkTablesConsistent() applied", "y");
}
if (config.getRefactorMissedLinks()) {
refactorings.refactorAddMissedLinks();
}
if (fromScratch || Settings.get(internalSettings, "refactorMakePropTablesConsistent() applied") == null || config.getRefactoringHeavyProps()) {
if (!fromScratch) {
refactorings.refactorMakePropTablesConsistent();
}
Settings.set(internalSettings, "refactorMakePropTablesConsistent() applied", "y");
}
if (fromScratch || Settings.get(internalSettings, "refactorFixNegativeFloatAndDoubleProps() applied") == null) {
if (!fromScratch) {
refactorings.refactorFixNegativeFloatAndDoubleProps(internalSettings);
}
Settings.set(internalSettings, "refactorFixNegativeFloatAndDoubleProps() applied", "y");
}
if (fromScratch || Settings.get(internalSettings, "Link null-indices present") == null) {
if (!fromScratch) {
refactorings.refactorCreateNullLinkIndices();
}
Settings.set(internalSettings, "Link null-indices present", "y");
}
if (blobVault instanceof DiskBasedBlobVault) {
if (fromScratch || Settings.get(internalSettings, "refactorBlobFileLengths() applied") == null) {
if (!fromScratch) {
Settings.delete(internalSettings, "Blob file lengths cached"); // don't waste space
refactorings.refactorBlobFileLengths();
}
Settings.set(internalSettings, "refactorBlobFileLengths() applied", "y");
}
}
} finally {
environment.resumeGC();
}
}