use of org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory in project neo4j by neo4j.
the class IdGeneratorRebuildFailureEmulationTest method initialize.
@Before
public void initialize() {
fs = new FileSystem();
GraphDatabaseService graphdb = new Database(storeDir);
createInitialData(graphdb);
graphdb.shutdown();
Map<String, String> params = new HashMap<>();
params.put(GraphDatabaseSettings.rebuild_idgenerators_fast.name(), Settings.FALSE);
Config config = Config.embeddedDefaults(params);
factory = new StoreFactory(storeDir, config, new DefaultIdGeneratorFactory(fs), pageCacheRule.getPageCache(fs), fs, NullLogProvider.getInstance());
}
use of org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory in project neo4j by neo4j.
the class TestArrayStore method before.
@Before
public void before() throws Exception {
File dir = testDirectory.graphDbDir();
FileSystemAbstraction fs = fileSystemRule.get();
DefaultIdGeneratorFactory idGeneratorFactory = new DefaultIdGeneratorFactory(fs);
PageCache pageCache = pageCacheRule.getPageCache(fs);
StoreFactory factory = new StoreFactory(dir, Config.empty(), idGeneratorFactory, pageCache, fs, NullLogProvider.getInstance());
neoStores = factory.openAllNeoStores(true);
arrayStore = neoStores.getPropertyStore().getArrayStore();
}
use of org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory in project neo4j by neo4j.
the class ConsistencyCheckService method runFullConsistencyCheck.
public Result runFullConsistencyCheck(final File storeDir, Config config, ProgressMonitorFactory progressFactory, final LogProvider logProvider, final FileSystemAbstraction fileSystem, final PageCache pageCache, final boolean verbose, File reportDir, CheckConsistencyConfig checkConsistencyConfig) throws ConsistencyCheckIncompleteException {
Log log = logProvider.getLog(getClass());
config = config.with(stringMap(GraphDatabaseSettings.read_only.name(), TRUE, GraphDatabaseSettings.label_index.name(), LabelIndex.AUTO.name()));
StoreFactory factory = new StoreFactory(storeDir, config, new DefaultIdGeneratorFactory(fileSystem), pageCache, fileSystem, logProvider);
ConsistencySummaryStatistics summary;
final File reportFile = chooseReportPath(reportDir);
Log reportLog = new ConsistencyReportLog(Suppliers.lazySingleton(() -> {
try {
return new PrintWriter(createOrOpenAsOuputStream(fileSystem, reportFile, true));
} catch (IOException e) {
throw new RuntimeException(e);
}
}));
// Bootstrap kernel extensions
LifeSupport life = new LifeSupport();
try (NeoStores neoStores = factory.openAllNeoStores()) {
IndexStoreView indexStoreView = new NeoStoreIndexStoreView(LockService.NO_LOCK_SERVICE, neoStores);
Dependencies dependencies = new Dependencies();
dependencies.satisfyDependencies(config, fileSystem, new SimpleLogService(logProvider, logProvider), indexStoreView, pageCache);
KernelContext kernelContext = new SimpleKernelContext(storeDir, UNKNOWN, dependencies);
KernelExtensions extensions = life.add(new KernelExtensions(kernelContext, (Iterable) load(KernelExtensionFactory.class), dependencies, ignore()));
life.start();
LabelScanStore labelScanStore = life.add(extensions.resolveDependency(LabelScanStoreProvider.class, new NamedLabelScanStoreSelectionStrategy(config)).getLabelScanStore());
SchemaIndexProvider indexes = life.add(extensions.resolveDependency(SchemaIndexProvider.class, HighestSelectionStrategy.getInstance()));
int numberOfThreads = defaultConsistencyCheckThreadsNumber();
Statistics statistics;
StoreAccess storeAccess;
AccessStatistics stats = new AccessStatistics();
if (verbose) {
statistics = new VerboseStatistics(stats, new DefaultCounts(numberOfThreads), log);
storeAccess = new AccessStatsKeepingStoreAccess(neoStores, stats);
} else {
statistics = Statistics.NONE;
storeAccess = new StoreAccess(neoStores);
}
storeAccess.initialize();
DirectStoreAccess stores = new DirectStoreAccess(storeAccess, labelScanStore, indexes);
FullCheck check = new FullCheck(progressFactory, statistics, numberOfThreads, checkConsistencyConfig);
summary = check.execute(stores, new DuplicatingLog(log, reportLog));
} finally {
life.shutdown();
}
if (!summary.isConsistent()) {
log.warn("See '%s' for a detailed consistency report.", reportFile.getPath());
return Result.failure(reportFile);
}
return Result.success(reportFile);
}
use of org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory in project neo4j by neo4j.
the class DumpStoreChain method dump.
void dump(File storeDir) throws IOException {
try (DefaultFileSystemAbstraction fs = new DefaultFileSystemAbstraction();
PageCache pageCache = createPageCache(fs)) {
DefaultIdGeneratorFactory idGeneratorFactory = new DefaultIdGeneratorFactory(fs);
Config config = Config.defaults();
StoreFactory storeFactory = new StoreFactory(storeDir, config, idGeneratorFactory, pageCache, fs, logProvider());
try (NeoStores neoStores = storeFactory.openNeoStores(getStoreTypes())) {
RecordStore<RECORD> store = store(neoStores);
RECORD record = store.newRecord();
for (long next = first; next != -1; ) {
store.getRecord(next, record, RecordLoad.FORCE);
System.out.println(record);
next = next(record);
}
}
}
}
use of org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory in project neo4j by neo4j.
the class CoreBootstrapper method deriveIdAllocationState.
private IdAllocationState deriveIdAllocationState(File dbDir) throws IOException {
DefaultIdGeneratorFactory factory = new DefaultIdGeneratorFactory(fs);
long[] highIds = new long[] { getHighId(dbDir, factory, NODE, NODE_STORE_NAME), getHighId(dbDir, factory, RELATIONSHIP, RELATIONSHIP_STORE_NAME), getHighId(dbDir, factory, PROPERTY, PROPERTY_STORE_NAME), getHighId(dbDir, factory, STRING_BLOCK, PROPERTY_STRINGS_STORE_NAME), getHighId(dbDir, factory, ARRAY_BLOCK, PROPERTY_ARRAYS_STORE_NAME), getHighId(dbDir, factory, PROPERTY_KEY_TOKEN, PROPERTY_KEY_TOKEN_STORE_NAME), getHighId(dbDir, factory, PROPERTY_KEY_TOKEN_NAME, PROPERTY_KEY_TOKEN_NAMES_STORE_NAME), getHighId(dbDir, factory, RELATIONSHIP_TYPE_TOKEN, RELATIONSHIP_TYPE_TOKEN_STORE_NAME), getHighId(dbDir, factory, RELATIONSHIP_TYPE_TOKEN_NAME, RELATIONSHIP_TYPE_TOKEN_NAMES_STORE_NAME), getHighId(dbDir, factory, LABEL_TOKEN, LABEL_TOKEN_STORE_NAME), getHighId(dbDir, factory, LABEL_TOKEN_NAME, LABEL_TOKEN_NAMES_STORE_NAME), getHighId(dbDir, factory, NEOSTORE_BLOCK, ""), getHighId(dbDir, factory, SCHEMA, SCHEMA_STORE_NAME), getHighId(dbDir, factory, NODE_LABELS, NODE_LABELS_STORE_NAME), getHighId(dbDir, factory, RELATIONSHIP_GROUP, RELATIONSHIP_GROUP_STORE_NAME) };
return new IdAllocationState(highIds, FIRST_INDEX);
}
Aggregations