From d32c54e67cd9ced6041dd17796932a9f34d56583 Mon Sep 17 00:00:00 2001 From: sundapeng Date: Fri, 8 Dec 2023 02:33:33 +0000 Subject: [PATCH] Fix the formatting of example RocksDBConfigSetter --- 0009-format-RocksDBConfigSetter.patch | 67 +++++++++++++++++++++++++++ kafka.spec | 5 +- 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 0009-format-RocksDBConfigSetter.patch diff --git a/0009-format-RocksDBConfigSetter.patch b/0009-format-RocksDBConfigSetter.patch new file mode 100644 index 0000000..1ea90dd --- /dev/null +++ b/0009-format-RocksDBConfigSetter.patch @@ -0,0 +1,67 @@ +diff --git a/docs/streams/developer-guide/config-streams.html b/docs/streams/developer-guide/config-streams.html +index aa817ed47e..738d3f72ec 100644 +--- a/docs/streams/developer-guide/config-streams.html ++++ b/docs/streams/developer-guide/config-streams.html +@@ -698,34 +698,35 @@ +

The RocksDB configuration. Kafka Streams uses RocksDB as the default storage engine for persistent stores. To change the default + configuration for RocksDB, you can implement RocksDBConfigSetter and provide your custom class via rocksdb.config.setter.

+

Here is an example that adjusts the memory size consumed by RocksDB.

+-
    public static class CustomRocksDBConfig implements RocksDBConfigSetter {
+-                    // This object should be a member variable so it can be closed in RocksDBConfigSetter#close.
+-                    private org.rocksdb.Cache cache = new org.rocksdb.LRUCache(16 * 1024L * 1024L);
++              
++
++public static class CustomRocksDBConfig implements RocksDBConfigSetter {
++    // This object should be a member variable so it can be closed in RocksDBConfigSetter#close.
++    private org.rocksdb.Cache cache = new org.rocksdb.LRUCache(16 * 1024L * 1024L);
+ 
+-                    @Override
+-                    public void setConfig(final String storeName, final Options options, final Map<String, Object> configs) {
+-                      // See #1 below.
+-                      BlockBasedTableConfig tableConfig = (BlockBasedTableConfig) options.tableFormatConfig();
+-                      tableConfig.setBlockCache(cache);
+-                      // See #2 below.
+-                      tableConfig.setBlockSize(16 * 1024L);
+-                      // See #3 below.
+-                      tableConfig.setCacheIndexAndFilterBlocks(true);
+-                      options.setTableFormatConfig(tableConfig);
+-                      // See #4 below.
+-                      options.setMaxWriteBufferNumber(2);
+-                    }
+-
+-                    @Override
+-                    public void close(final String storeName, final Options options) {
+-                      // See #5 below.
+-                      cache.close();
+-                    }
+-                    }
+-
+-                    Properties streamsSettings = new Properties();
+-                    streamsConfig.put(StreamsConfig.ROCKSDB_CONFIG_SETTER_CLASS_CONFIG, CustomRocksDBConfig.class);
+-                    
++ @Override ++ public void setConfig(final String storeName, final Options options, final Map<String, Object> configs) { ++ // See #1 below. ++ BlockBasedTableConfig tableConfig = (BlockBasedTableConfig) options.tableFormatConfig(); ++ tableConfig.setBlockCache(cache); ++ // See #2 below. ++ tableConfig.setBlockSize(16 * 1024L); ++ // See #3 below. ++ tableConfig.setCacheIndexAndFilterBlocks(true); ++ options.setTableFormatConfig(tableConfig); ++ // See #4 below. ++ options.setMaxWriteBufferNumber(2); ++ } ++ @Override ++ public void close(final String storeName, final Options options) { ++ // See #5 below. ++ cache.close(); ++ } ++} ++Properties streamsSettings = new Properties(); ++streamsConfig.put(StreamsConfig.ROCKSDB_CONFIG_SETTER_CLASS_CONFIG, CustomRocksDBConfig.class); ++
++
+
+
+
Notes for example:
diff --git a/kafka.spec b/kafka.spec index a9a0bcd..2c039e8 100644 --- a/kafka.spec +++ b/kafka.spec @@ -4,7 +4,7 @@ Name: kafka Version: 2.8.2 -Release: 8 +Release: 9 Summary: A Distributed Streaming Platform. License: Apache-2.0 @@ -20,6 +20,7 @@ Patch4: 0005-CVE-2016-3189.patch Patch5: 0006-NPE-subscriptionState.patch Patch6: 0007-fix-payload-incorrectly.patch Patch7: 0008-Cast-SMT-allow-null.patch +Patch8: 0009-format-RocksDBConfigSetter.patch BuildRequires: systemd java-1.8.0-openjdk-devel Provides: kafka = %{version} @@ -71,6 +72,8 @@ cp -pr licenses/* $RPM_BUILD_ROOT%{kafka_home}/licenses rm -rf %{buildroot} %changelog +* Fri Dec 08 2023 sundapeng - 2.8.2-9 +- Fix the formatting of example RocksDBConfigSetter * Fri Dec 08 2023 sundapeng - 2.8.2-8 - Cast SMT should allow null value records to pass through * Fri Dec 08 2023 sundapeng - 2.8.2-7 -- Gitee