@Override public NodeStore create(BlobStore blobStore, Closer closer) throws IOException { System.setProperty(DocumentNodeStore.SYS_PROP_DISABLE_JOURNAL, "true"); RDBDocumentNodeStoreBuilder builder = baseConfiguration(newRDBDocumentNodeStoreBuilder(), cacheSize); if (blobStore != null) { builder.setBlobStore(blobStore); } builder.setRDBConnection(getDataSource(closer)); if (readOnly) { builder.setReadOnlyMode(); } log.info("Initialized DocumentNodeStore on RDB with Cache size : {} MB, Fast migration : {}", cacheSize, builder.isDisableBranches()); DocumentNodeStore documentNodeStore = builder.build(); // TODO probably we should disable all observers, see OAK-5651 documentNodeStore.getBundlingConfigHandler().unregisterObserver(); closer.register(documentNodeStore::dispose); return documentNodeStore; }
/** * @return a new {@link RDBDocumentNodeStoreBuilder}. */ public static RDBDocumentNodeStoreBuilder newRDBDocumentNodeStoreBuilder() { return new RDBDocumentNodeStoreBuilder(); }
public MissingLastRevSeeker createMissingLastRevSeeker() { final DocumentStore store = getDocumentStore(); if (store instanceof RDBDocumentStore) { return new RDBMissingLastRevSeeker((RDBDocumentStore) store, getClock()); } else { return super.createMissingLastRevSeeker(); } } }
/** * Sets a {@link DataSource} to use for the RDB document and blob * stores. * * @return this */ public RDBDocumentNodeStoreBuilder setRDBConnection(DataSource ds) { setRDBConnection(ds, new RDBOptions()); return thisBuilder(); }
@Override public Oak[] setUpCluster(int n, StatisticsProvider statsProvider) throws Exception { Oak[] cluster = new Oak[n]; nodeStores = new DocumentNodeStore[cluster.length]; for (int i = 0; i < cluster.length; i++) { BlobStore blobStore = getBlobStore(statsProvider); DataSource ds = RDBDataSourceFactory.forJdbcUrl(jdbcuri, jdbcuser, jdbcpasswd); DocumentNodeStoreBuilder<?> builder = newRDBDocumentNodeStoreBuilder() .setRDBConnection(ds, getOptions(dropDBAfterTest, tablePrefix)).memoryCacheSize(cacheSize) .setStatisticsProvider(statsProvider) // FIXME: OAK-3389 .setLeaseCheckMode(LeaseCheckMode.DISABLED) .setClusterId(i + 1).setLogging(false); if (blobStore != null) { builder.setBlobStore(blobStore); } nodeStores[i] = builder.build(); cluster[i] = newOak(nodeStores[i]); } if (vgcMaxAge > 0 && nodeStores.length >= 1) { versionGarbageCollectionJob = new VersionGarbageCollectionJob(nodeStores[0], vgcMaxAge); Thread t = new Thread(versionGarbageCollectionJob); t.setDaemon(true); t.start(); } return cluster; }
@Override public Oak getOak(int clusterId) throws Exception { DataSource ds = RDBDataSourceFactory.forJdbcUrl(jdbcuri, jdbcuser, jdbcpasswd); DocumentNodeStoreBuilder<?> builder = newRDBDocumentNodeStoreBuilder() .setRDBConnection(ds, getOptions(dropDBAfterTest, tablePrefix)).memoryCacheSize(cacheSize) .setClusterId(clusterId).setLogging(false); BlobStore blobStore = getBlobStore(StatisticsProvider.NOOP); if (blobStore != null) { builder.setBlobStore(blobStore); } return newOak(builder.build()); }
private void registerNodeStore() throws IOException { DocumentNodeStoreBuilder<?> mkBuilder; if (documentStoreType == DocumentStoreType.RDB) { RDBDocumentNodeStoreBuilder builder = newRDBDocumentNodeStoreBuilder(); configureBuilder(builder); checkNotNull(dataSource, "DataStore type set [%s] but DataSource reference not initialized", PROP_DS_TYPE); if (!customBlobStore) { checkNotNull(blobDataSource, "DataStore type set [%s] but BlobDataSource reference not initialized", PROP_DS_TYPE); builder.setRDBConnection(dataSource, blobDataSource); log.info("Connected to datasources {} {}", dataSource, blobDataSource); } else { log.info("Ignoring blobDataSource {} as custom blob store takes precedence.", blobDataSource); builder.setRDBConnection(dataSource); log.info("Connected to datasource {}", dataSource);
public Iterable<ReferencedBlob> createReferencedBlobs(DocumentNodeStore ns) { final DocumentStore store = getDocumentStore(); if (store instanceof RDBDocumentStore) { return () -> new RDBBlobReferenceIterator(ns, (RDBDocumentStore) store); } else { return super.createReferencedBlobs(ns); } }
@Override public Oak[] setUpCluster(int n, StatisticsProvider statsProvider) throws Exception { Oak[] cluster = new Oak[n]; nodeStores = new DocumentNodeStore[cluster.length]; for (int i = 0; i < cluster.length; i++) { BlobStore blobStore = getBlobStore(statsProvider); DataSource ds = RDBDataSourceFactory.forJdbcUrl(jdbcuri, jdbcuser, jdbcpasswd); DocumentNodeStoreBuilder<?> builder = newRDBDocumentNodeStoreBuilder() .setRDBConnection(ds, getOptions(dropDBAfterTest, tablePrefix)).memoryCacheSize(cacheSize) .setStatisticsProvider(statsProvider) // FIXME: OAK-3389 .setLeaseCheckMode(LeaseCheckMode.DISABLED) .setClusterId(i + 1).setLogging(false); if (blobStore != null) { builder.setBlobStore(blobStore); } nodeStores[i] = builder.build(); cluster[i] = newOak(nodeStores[i]); } if (vgcMaxAge > 0 && nodeStores.length >= 1) { versionGarbageCollectionJob = new VersionGarbageCollectionJob(nodeStores[0], vgcMaxAge); Thread t = new Thread(versionGarbageCollectionJob); t.setDaemon(true); t.start(); } return cluster; }
@Override public Oak getOak(int clusterId) throws Exception { DataSource ds = RDBDataSourceFactory.forJdbcUrl(jdbcuri, jdbcuser, jdbcpasswd); DocumentNodeStoreBuilder<?> builder = newRDBDocumentNodeStoreBuilder() .setRDBConnection(ds, getOptions(dropDBAfterTest, tablePrefix)).memoryCacheSize(cacheSize) .setClusterId(clusterId).setLogging(false); BlobStore blobStore = getBlobStore(StatisticsProvider.NOOP); if (blobStore != null) { builder.setBlobStore(blobStore); } return newOak(builder.build()); }
private void registerNodeStore() throws IOException { DocumentNodeStoreBuilder<?> mkBuilder; if (documentStoreType == DocumentStoreType.RDB) { RDBDocumentNodeStoreBuilder builder = newRDBDocumentNodeStoreBuilder(); configureBuilder(builder); checkNotNull(dataSource, "DataStore type set [%s] but DataSource reference not initialized", PROP_DS_TYPE); if (!customBlobStore) { checkNotNull(blobDataSource, "DataStore type set [%s] but BlobDataSource reference not initialized", PROP_DS_TYPE); builder.setRDBConnection(dataSource, blobDataSource); log.info("Connected to datasources {} {}", dataSource, blobDataSource); } else { log.info("Ignoring blobDataSource {} as custom blob store takes precedence.", blobDataSource); builder.setRDBConnection(dataSource); log.info("Connected to datasource {}", dataSource);
/** * Sets a {@link DataSource} to use for the RDB document and blob * stores. * * @return this */ public RDBDocumentNodeStoreBuilder setRDBConnection(DataSource ds) { setRDBConnection(ds, new RDBOptions()); return thisBuilder(); }
public VersionGCSupport createVersionGCSupport() { DocumentStore store = getDocumentStore(); if (store instanceof RDBDocumentStore) { return new RDBVersionGCSupport((RDBDocumentStore) store); } else { return super.createVersionGCSupport(); } }
@Override public NodeStore create(BlobStore blobStore, Closer closer) throws IOException { System.setProperty(DocumentNodeStore.SYS_PROP_DISABLE_JOURNAL, "true"); RDBDocumentNodeStoreBuilder builder = baseConfiguration(newRDBDocumentNodeStoreBuilder(), cacheSize); if (blobStore != null) { builder.setBlobStore(blobStore); } builder.setRDBConnection(getDataSource(closer)); if (readOnly) { builder.setReadOnlyMode(); } log.info("Initialized DocumentNodeStore on RDB with Cache size : {} MB, Fast migration : {}", cacheSize, builder.isDisableBranches()); DocumentNodeStore documentNodeStore = builder.build(); // TODO probably we should disable all observers, see OAK-5651 documentNodeStore.getBundlingConfigHandler().unregisterObserver(); closer.register(documentNodeStore::dispose); return documentNodeStore; }
builder = newMongoDocumentNodeStoreBuilder(); } else if (commonOpts.isRDB()) { builder = newRDBDocumentNodeStoreBuilder(); } else { throw new IllegalStateException("Unknown DocumentStore"); rdbOpts.getUser(), rdbOpts.getPassword()); wb.register(DataSource.class, ds, emptyMap()); ((RDBDocumentNodeStoreBuilder) builder).setRDBConnection(ds); dns = builder.build(); wb.register(RDBDocumentStore.class, (RDBDocumentStore) builder.getDocumentStore(), emptyMap());
public Iterable<ReferencedBlob> createReferencedBlobs(DocumentNodeStore ns) { final DocumentStore store = getDocumentStore(); if (store instanceof RDBDocumentStore) { return () -> new RDBBlobReferenceIterator(ns, (RDBDocumentStore) store); } else { return super.createReferencedBlobs(ns); } } }
/** * @return a new {@link RDBDocumentNodeStoreBuilder}. */ public static RDBDocumentNodeStoreBuilder newRDBDocumentNodeStoreBuilder() { return new RDBDocumentNodeStoreBuilder(); }
builder = newMongoDocumentNodeStoreBuilder(); } else if (commonOpts.isRDB()) { builder = newRDBDocumentNodeStoreBuilder(); } else { throw new IllegalStateException("Unknown DocumentStore"); rdbOpts.getUser(), rdbOpts.getPassword()); wb.register(DataSource.class, ds, emptyMap()); ((RDBDocumentNodeStoreBuilder) builder).setRDBConnection(ds); dns = builder.build(); wb.register(RDBDocumentStore.class, (RDBDocumentStore) builder.getDocumentStore(), emptyMap());
public VersionGCSupport createVersionGCSupport() { DocumentStore store = getDocumentStore(); if (store instanceof RDBDocumentStore) { return new RDBVersionGCSupport((RDBDocumentStore) store); } else { return super.createVersionGCSupport(); } }