@@ -441,7 +441,36 @@ class RemoteTopicCrudTest extends IntegrationTestHarness {
441
441
AlterConfigOp .OpType .SET ),
442
442
))
443
443
assertThrowsException(classOf [InvalidConfigurationException ],
444
- () => admin.incrementalAlterConfigs(configs).all().get(), " Disabling remote storage feature on the topic level is not supported." )
444
+ () => admin.incrementalAlterConfigs(configs).all().get(), " It is invalid to disable remote storage without deleting remote data. " +
445
+ " If you want to keep the remote data and turn to read only, please set `remote.storage.enable=true,remote.log.copy.disable=true`. " +
446
+ " If you want to disable remote storage and delete all remote data, please set `remote.storage.enable=false,remote.log.delete.on.disable=true`." )
447
+ }
448
+
449
+ @ ParameterizedTest
450
+ @ ValueSource (strings = Array (" kraft" ))
451
+ def testUpdateTopicConfigWithDisablingRemoteStorageWithDeleteOnDisable (quorum : String ): Unit = {
452
+ val admin = createAdminClient()
453
+ val topicConfig = new Properties
454
+ topicConfig.setProperty(TopicConfig .REMOTE_LOG_STORAGE_ENABLE_CONFIG , " true" )
455
+ TestUtils .createTopicWithAdmin(admin, testTopicName, brokers, controllerServers, numPartitions, numReplicationFactor,
456
+ topicConfig = topicConfig)
457
+
458
+ val configs = new util.HashMap [ConfigResource , util.Collection [AlterConfigOp ]]()
459
+ configs.put(new ConfigResource (ConfigResource .Type .TOPIC , testTopicName),
460
+ util.Arrays .asList(
461
+ new AlterConfigOp (new ConfigEntry (TopicConfig .REMOTE_LOG_STORAGE_ENABLE_CONFIG , " false" ),
462
+ AlterConfigOp .OpType .SET ),
463
+ new AlterConfigOp (new ConfigEntry (TopicConfig .REMOTE_LOG_DELETE_ON_DISABLE_CONFIG , " true" ),
464
+ AlterConfigOp .OpType .SET )
465
+ ))
466
+ admin.incrementalAlterConfigs(configs).all().get()
467
+
468
+ val newProps = new Properties ()
469
+ configs.get(new ConfigResource (ConfigResource .Type .TOPIC , testTopicName)).forEach { op =>
470
+ newProps.setProperty(op.configEntry().name(), op.configEntry().value())
471
+ }
472
+
473
+ verifyRemoteLogTopicConfigs(newProps)
445
474
}
446
475
447
476
@ ParameterizedTest
0 commit comments