in entity-store/src/main/java/jetbrains/exodus/entitystore/PersistentEntityStoreImpl.java [206:270]
private void init() {
final boolean fromScratch = computeInTransaction(tx -> {
final PersistentStoreTransaction txn = (PersistentStoreTransaction) tx;
final Transaction envTxn = txn.getEnvironmentTransaction();
initBasicStores(envTxn);
if (blobVault == null) {
blobVault = initBlobVault();
}
final TwoColumnTable entityTypesTable = new TwoColumnTable(txn,
namingRulez.getEntityTypesTableName(), StoreConfig.WITHOUT_DUPLICATES);
final PersistentSequence entityTypesSequence = getSequence(txn, namingRulez.getEntityTypesSequenceName());
entityTypes = new PersistentSequentialDictionary(entityTypesSequence, entityTypesTable) {
@Override
protected void created(final PersistentStoreTransaction txn, final int id) {
preloadTables(txn, id);
}
};
propertyIds = new PersistentSequentialDictionary(getSequence(txn, namingRulez.getPropertyIdsSequenceName()),
new TwoColumnTable(txn, namingRulez.getPropertyIdsTableName(), StoreConfig.WITHOUT_DUPLICATES));
linkIds = new PersistentSequentialDictionary(getSequence(txn, namingRulez.getLinkIdsSequenceName()),
new TwoColumnTable(txn, namingRulez.getLinkIdsTableName(), StoreConfig.WITHOUT_DUPLICATES));
propertyCustomTypeIds = new PersistentSequentialDictionary(getSequence(txn, namingRulez.getPropertyCustomTypesSequence()),
new TwoColumnTable(txn, namingRulez.getPropertyCustomTypesTable(), StoreConfig.WITHOUT_DUPLICATES_WITH_PREFIXING));
entitiesTables = new OpenTablesCache((t, entityTypeId) ->
{
final String entitiesTableName = namingRulez.getEntitiesTableName(entityTypeId);
return useVersion1Format() ?
new SingleColumnTable(t, entitiesTableName, StoreConfig.WITHOUT_DUPLICATES_WITH_PREFIXING) :
new BitmapTable(t, entitiesTableName, StoreConfig.WITHOUT_DUPLICATES_WITH_PREFIXING);
});
propertiesTables = new OpenTablesCache((t, entityTypeId) -> new PropertiesTable(t,
namingRulez.getPropertiesTableName(entityTypeId), StoreConfig.WITHOUT_DUPLICATES));
linksTables = new OpenTablesCache((t, entityTypeId) -> new LinksTable(t,
namingRulez.getLinksTableName(entityTypeId), StoreConfig.WITH_DUPLICATES_WITH_PREFIXING));
blobsTables = new OpenTablesCache((t, entityTypeId) -> new BlobsTable(PersistentEntityStoreImpl.this, t,
useVersion1Format() ?
namingRulez.getBlobsObsoleteTableName(entityTypeId) : namingRulez.getBlobsTableName(entityTypeId),
useVersion1Format() ? StoreConfig.WITHOUT_DUPLICATES : StoreConfig.WITHOUT_DUPLICATES_WITH_PREFIXING));
blobHashesTables = new OpenTablesCache((t, entityTypeId) -> new SingleColumnTable(t,
namingRulez.getBlobHashesTableName(entityTypeId), StoreConfig.WITHOUT_DUPLICATES_WITH_PREFIXING));
final String internalSettingsName = namingRulez.getInternalSettingsName();
final Store settings = environment.openStore(internalSettingsName,
StoreConfig.WITHOUT_DUPLICATES, envTxn, false);
final boolean result = settings == null;
if (result) {
internalSettings = environment.openStore(
internalSettingsName, StoreConfig.WITHOUT_DUPLICATES, envTxn, true);
} else {
internalSettings = settings;
}
if (environment.isClearBrokenBlobs()) {
clearBrokenBlobs(txn);
}
return result;
});
if (!config.getRefactoringSkipAll() && !environment.isReadOnly()) {
applyRefactorings(fromScratch); // this method includes refactorings that could be clustered into separate txns
}
}