• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java BlockBasedTableConfig类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.rocksdb.BlockBasedTableConfig的典型用法代码示例。如果您正苦于以下问题:Java BlockBasedTableConfig类的具体用法?Java BlockBasedTableConfig怎么用?Java BlockBasedTableConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BlockBasedTableConfig类属于org.rocksdb包,在下文中一共展示了BlockBasedTableConfig类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: FeatureStoreRocksDb

import org.rocksdb.BlockBasedTableConfig; //导入依赖的package包/类
FeatureStoreRocksDb(MetricsContext metricsContext, File dbPath) {

    MetricRegistry metrics = metricsContext.metrics();
    String context = metricsContext.context();

    putTimer = metrics.timer(MetricRegistry.name(
        context + "." + METRICS_PATH, "putTimer"));
    putMeter = metrics.meter(MetricRegistry.name(
        context + "." + METRICS_PATH, "putMeter"));
    this.loadAllTimer = metrics.timer(MetricRegistry.name(
        context + "." + METRICS_PATH, "loadAllTimer"));
    this.loadAllMeter = metrics.meter(MetricRegistry.name(
        context + "." + METRICS_PATH, "loadAllMeter"));

    this.findAllTimer = metrics.timer(MetricRegistry.name(
        context + "." + METRICS_PATH, "findAllTimer"));
    this.findAllMeter = metrics.meter(MetricRegistry.name(
        context + "." + METRICS_PATH, "findAllMeter"));

    BlockBasedTableConfig tableConfig = new BlockBasedTableConfig();
    tableConfig.setBlockCacheSize(BLOCK_CACHE_SIZE);
    tableConfig.setBlockSize(BLOCK_SIZE);

    options = new Options();
    options.setTableFormatConfig(tableConfig);
    options.setWriteBufferSize(WRITE_BUFFER_SIZE);
    options.setCompressionType(COMPRESSION_TYPE);
    options.setCompactionStyle(COMPACTION_STYLE);
    options.setMaxWriteBufferNumber(MAX_WRITE_BUFFER_NUMBER);
    options.setCreateIfMissing(CREATE_IF_MISSING);
    options.setErrorIfExists(ERROR_IF_EXISTS);
    writeOptions = new WriteOptions();
    writeOptions.setDisableWAL(DISABLE_WAL);
    writeOptions.setSync(true);
    readOptions = new ReadOptions();
    readOptions.setVerifyChecksums(true);
    readOptions.setFillCache(true);
    flushOptions = new FlushOptions();
    flushOptions.setWaitForFlush(WAIT_FOR_FLUSH);

    final File parent = new File("/tmp", "outland");
    rocksDir = new File(dbPath, "feature-store");
    //noinspection ResultOfMethodCallIgnored
    rocksDir.getParentFile().mkdirs();
    rocks = initializeRocksDb(); // todo: move this out?
  }
 
开发者ID:dehora,项目名称:outland,代码行数:47,代码来源:FeatureStoreRocksDb.java


示例2: openDB

import org.rocksdb.BlockBasedTableConfig; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void openDB(ProcessorContext context) {
    // initialize the default rocksdb options
    final BlockBasedTableConfig tableConfig = new BlockBasedTableConfig();
    tableConfig.setBlockCacheSize(BLOCK_CACHE_SIZE);
    tableConfig.setBlockSize(BLOCK_SIZE);

    options = new Options();
    options.setTableFormatConfig(tableConfig);
    options.setWriteBufferSize(WRITE_BUFFER_SIZE);
    options.setCompressionType(COMPRESSION_TYPE);
    options.setCompactionStyle(COMPACTION_STYLE);
    options.setMaxWriteBufferNumber(MAX_WRITE_BUFFERS);
    options.setCreateIfMissing(true);
    options.setErrorIfExists(false);
    options.setInfoLogLevel(InfoLogLevel.ERROR_LEVEL);
    // this is the recommended way to increase parallelism in RocksDb
    // note that the current implementation of setIncreaseParallelism affects the number
    // of compaction threads but not flush threads (the latter remains one). Also
    // the parallelism value needs to be at least two because of the code in
    // https://github.com/facebook/rocksdb/blob/62ad0a9b19f0be4cefa70b6b32876e764b7f3c11/util/options.cc#L580
    // subtracts one from the value passed to determine the number of compaction threads
    // (this could be a bug in the RocksDB code and their devs have been contacted).
    options.setIncreaseParallelism(Math.max(Runtime.getRuntime().availableProcessors(), 2));

    wOptions = new WriteOptions();
    wOptions.setDisableWAL(true);

    fOptions = new FlushOptions();
    fOptions.setWaitForFlush(true);

    final Map<String, Object> configs = context.appConfigs();
    final Object configSetterValue = configs.get(StreamsConfig.ROCKSDB_CONFIG_SETTER_CLASS_CONFIG);
    final Class<RocksDBConfigSetter> configSetterClass = (Class<RocksDBConfigSetter>) ConfigDef.parseType(
            StreamsConfig.ROCKSDB_CONFIG_SETTER_CLASS_CONFIG,
            configSetterValue,
            ConfigDef.Type.CLASS);

    if (configSetterClass != null) {
        final RocksDBConfigSetter configSetter = Utils.newInstance(configSetterClass);
        configSetter.setConfig(name, options, configs);
    }
    // we need to construct the serde while opening DB since
    // it is also triggered by windowed DB segments without initialization
    this.serdes = new StateSerdes<>(
        ProcessorStateManager.storeChangelogTopic(context.applicationId(), name),
        keySerde == null ? (Serde<K>) context.keySerde() : keySerde,
        valueSerde == null ? (Serde<V>) context.valueSerde() : valueSerde);

    this.dbDir = new File(new File(context.stateDir(), parentDir), this.name);
    try {
        this.db = openDB(this.dbDir, this.options, TTL_SECONDS);
    } catch (IOException e) {
        throw new StreamsException(e);
    }
}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:57,代码来源:RocksDBStore.java



注:本文中的org.rocksdb.BlockBasedTableConfig类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Table类代码示例发布时间:2022-05-23
下一篇:
Java JAXBTypeAndAnnotation类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap