/** * 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(); }
/** * 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 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; }
@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; }
@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[] 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()); }
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);
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);
@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()); }
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());
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());