You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2021/08/08 16:00:23 UTC

[GitHub] [flink] yanchenyun commented on a change in pull request #16371: [FLINK-23198][Documentation] Fix the demo of ConfigurableRocksDBOptionsFactory in Documentation.

yanchenyun commented on a change in pull request #16371:
URL: https://github.com/apache/flink/pull/16371#discussion_r684795204



##########
File path: docs/content/docs/ops/state/state_backends.md
##########
@@ -293,29 +293,38 @@ Below is an example how to define a custom ConfigurableOptionsFactory (set class
 ```java
 
 public class MyOptionsFactory implements ConfigurableRocksDBOptionsFactory {
-
     private static final long DEFAULT_SIZE = 256 * 1024 * 1024;  // 256 MB
-    private long blockCacheSize = DEFAULT_SIZE;
 
+    public static final ConfigOption<MemorySize> BLOCK_CACHE_SIZE = ConfigOptions
+            .key("my.custom.rocksdb.block.cache.size")

Review comment:
       I agree with your suggestion. How about modifying it like this:
   ```java
   public class MyOptionsFactory implements ConfigurableRocksDBOptionsFactory {
       public static final ConfigOption<Integer> BLOCK_RESTART_INTERVAL = ConfigOptions
               .key("my.custom.rocksdb.block.restart-interval")
               .intType()
               .defaultValue(16)
               .withDescription(
                       " Block restart interval. RocksDB has default block restart interval as 16. ");
   
       private int blockRestartInterval = BLOCK_RESTART_INTERVAL.defaultValue();
   
       @Override
       public DBOptions createDBOptions(DBOptions currentOptions,
                                        Collection<AutoCloseable> handlesToClose) {
           return currentOptions
                   .setIncreaseParallelism(4)
                   .setUseFsync(false);
       }
   
       @Override
       public ColumnFamilyOptions createColumnOptions(ColumnFamilyOptions currentOptions,
                                                      Collection<AutoCloseable> handlesToClose) {
           return currentOptions.setTableFormatConfig(
                   new BlockBasedTableConfig()
                           .setBlockRestartInterval(blockRestartInterval));
       }
   
       @Override
       public RocksDBOptionsFactory configure(ReadableConfig configuration) {
           this.blockRestartInterval = configuration.get(BLOCK_RESTART_INTERVAL);
           return this;
       }
   }
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org