@ -39,7 +39,9 @@ import org.apache.kafka.streams.processor.internals.StateDirectory;
@@ -39,7 +39,9 @@ import org.apache.kafka.streams.processor.internals.StateDirectory;
import org.apache.kafka.streams.processor.internals.StreamThread ;
import org.apache.kafka.streams.processor.internals.StreamsMetadataState ;
import org.apache.kafka.streams.processor.internals.metrics.StreamsMetricsImpl ;
import org.apache.kafka.streams.processor.internals.testutil.LogCaptureAppender ;
import org.apache.kafka.streams.state.KeyValueStore ;
import org.apache.kafka.streams.state.RocksDBConfigSetter ;
import org.apache.kafka.streams.state.StoreBuilder ;
import org.apache.kafka.streams.state.Stores ;
import org.apache.kafka.streams.state.internals.metrics.RocksDBMetricsRecordingTrigger ;
@ -79,6 +81,8 @@ import static org.easymock.EasyMock.anyInt;
@@ -79,6 +81,8 @@ import static org.easymock.EasyMock.anyInt;
import static org.easymock.EasyMock.anyLong ;
import static org.easymock.EasyMock.anyObject ;
import static org.easymock.EasyMock.anyString ;
import static org.hamcrest.CoreMatchers.hasItem ;
import static org.hamcrest.MatcherAssert.assertThat ;
import static org.junit.Assert.assertEquals ;
import static org.junit.Assert.assertFalse ;
import static org.junit.Assert.assertNull ;
@ -91,6 +95,7 @@ public class KafkaStreamsTest {
@@ -91,6 +95,7 @@ public class KafkaStreamsTest {
private static final int NUM_THREADS = 2 ;
private final static String APPLICATION_ID = "appId" ;
private final static String CLIENT_ID = "test-client" ;
@Rule
public TestName testName = new TestName ( ) ;
@ -143,7 +148,7 @@ public class KafkaStreamsTest {
@@ -143,7 +148,7 @@ public class KafkaStreamsTest {
props = new Properties ( ) ;
props . put ( StreamsConfig . APPLICATION_ID_CONFIG , APPLICATION_ID ) ;
props . put ( StreamsConfig . CLIENT_ID_CONFIG , "clientId" ) ;
props . put ( StreamsConfig . CLIENT_ID_CONFIG , CLIENT_ID ) ;
props . put ( StreamsConfig . BOOTSTRAP_SERVERS_CONFIG , "localhost:2018" ) ;
props . put ( StreamsConfig . METRIC_REPORTER_CLASSES_CONFIG , MockMetricsReporter . class . getName ( ) ) ;
props . put ( StreamsConfig . STATE_DIR_CONFIG , TestUtils . tempDirectory ( ) . getPath ( ) ) ;
@ -745,6 +750,29 @@ public class KafkaStreamsTest {
@@ -745,6 +750,29 @@ public class KafkaStreamsTest {
PowerMock . verify ( Executors . class , rocksDBMetricsRecordingTriggerThread ) ;
}
public static class TestRocksDbConfigSetter implements RocksDBConfigSetter {
@Override
public void setConfig ( final String storeName ,
final org . rocksdb . Options options ,
final Map < String , Object > configs ) {
}
}
@Test
public void shouldWarnAboutRocksDBConfigSetterIsNotGuaranteedToBeBackwardsCompatible ( ) {
props . setProperty ( StreamsConfig . ROCKSDB_CONFIG_SETTER_CLASS_CONFIG , TestRocksDbConfigSetter . class . getName ( ) ) ;
final LogCaptureAppender appender = LogCaptureAppender . createAndRegister ( ) ;
new KafkaStreams ( new StreamsBuilder ( ) . build ( ) , props , supplier , time ) ;
LogCaptureAppender . unregister ( appender ) ;
assertThat ( appender . getMessages ( ) , hasItem ( "stream-client [" + CLIENT_ID + "] "
+ "RocksDB's version will be bumped to version 6+ via KAFKA-8897 in a future release. "
+ "If you use `org.rocksdb.CompactionOptionsFIFO#setTtl(long)` or `#ttl()` you will need to rewrite "
+ "your code after KAFKA-8897 is resolved and set TTL via `org.rocksdb.Options` "
+ "(or `org.rocksdb.ColumnFamilyOptions`)." ) ) ;
}
@Test
public void shouldCleanupOldStateDirs ( ) throws Exception {
PowerMock . mockStatic ( Executors . class ) ;