use of org.neo4j.logging.LogProvider in project neo4j by neo4j.
the class NeoStoreOpenFailureTest method mustCloseAllStoresIfNeoStoresFailToOpen.
@Test
@DisabledForRoot
void mustCloseAllStoresIfNeoStoresFailToOpen() {
Config config = Config.defaults();
IdGeneratorFactory idGenFactory = new DefaultIdGeneratorFactory(fileSystem, immediate(), databaseLayout.getDatabaseName());
LogProvider logProvider = NullLogProvider.getInstance();
RecordFormats formats = Standard.LATEST_RECORD_FORMATS;
RecordFormatPropertyConfigurator.configureRecordFormat(formats, config);
boolean create = true;
StoreType[] storeTypes = StoreType.values();
ImmutableSet<OpenOption> openOptions = immutable.empty();
NeoStores neoStores = new NeoStores(fileSystem, databaseLayout, config, idGenFactory, pageCache, logProvider, formats, create, NULL, writable(), storeTypes, openOptions);
Path schemaStore = neoStores.getSchemaStore().getStorageFile();
neoStores.close();
// Make the schema store inaccessible, to sabotage the next initialisation we'll do.
assumeTrue(schemaStore.toFile().setReadable(false));
assumeTrue(schemaStore.toFile().setWritable(false));
assertThrows(RuntimeException.class, () -> new NeoStores(fileSystem, databaseLayout, config, idGenFactory, pageCache, logProvider, formats, create, NULL, writable(), storeTypes, openOptions));
// We verify that the successfully opened stores were closed again by the failed NeoStores open,
// by closing the page cache, which will throw if not all files have been unmapped.
pageCache.close();
}
use of org.neo4j.logging.LogProvider in project neo4j by neo4j.
the class CommonAbstractStoreTest method newStore.
private TheStore newStore() {
LogProvider log = NullLogProvider.getInstance();
TheStore store = new TheStore(storeFile, idStoreFile, config, idType, idGeneratorFactory, mockedPageCache, log, recordFormat, immutable.empty());
store.initialise(false, NULL);
return store;
}
use of org.neo4j.logging.LogProvider in project neo4j by neo4j.
the class MetaDataStoreTest method newMetaDataStore.
private MetaDataStore newMetaDataStore(PageCacheTracer pageCacheTracer) {
LogProvider logProvider = NullLogProvider.getInstance();
StoreFactory storeFactory = new StoreFactory(databaseLayout, Config.defaults(), new DefaultIdGeneratorFactory(fs, immediate(), databaseLayout.getDatabaseName()), pageCacheWithFakeOverflow, fs, logProvider, pageCacheTracer, writable());
return storeFactory.openNeoStores(true, StoreType.META_DATA).getMetaDataStore();
}
use of org.neo4j.logging.LogProvider in project neo4j by neo4j.
the class LockWorkFailureDump method dumpState.
public Path dumpState(Locks lm, LockWorker... workers) throws IOException {
try (OutputStream out = Files.newOutputStream(file)) {
LogProvider logProvider = new Log4jLogProvider(out);
// * locks held by the lock manager
lm.accept(new DumpLocksVisitor(logProvider.getLog(LockWorkFailureDump.class)));
// * rag manager state;
// * workers state
Log log = logProvider.getLog(getClass());
for (LockWorker worker : workers) {
// - what each is doing and have up to now
log.info("Worker %s", worker);
}
return file;
}
}
use of org.neo4j.logging.LogProvider in project neo4j by neo4j.
the class RelationshipGroupGetterTest method openStore.
@BeforeEach
void openStore() {
LogProvider logProvider = NullLogProvider.getInstance();
StoreFactory storeFactory = new StoreFactory(databaseLayout, Config.defaults(), new DefaultIdGeneratorFactory(fs, immediate(), databaseLayout.getDatabaseName()), pageCache, fs, logProvider, PageCacheTracer.NULL, writable());
stores = storeFactory.openNeoStores(true, StoreType.RELATIONSHIP_GROUP, StoreType.NODE, StoreType.NODE_LABEL);
groupStore = spy(stores.getRelationshipGroupStore());
NodeStore nodeStore = stores.getNodeStore();
groupRecords = new DirectRecordAccess<>(groupStore, Loaders.relationshipGroupLoader(groupStore, NULL));
nodeRecords = new DirectRecordAccess<>(nodeStore, Loaders.nodeLoader(nodeStore, NULL));
groupGetter = new RelationshipGroupGetter(groupStore, NULL);
}
Aggregations