Open garyparrot opened 1 year ago
ByteUtils.toBytes(ClusterInfo) 似乎沒有序列化到 Broker 的設定
ByteUtils.toBytes(ClusterInfo)
@Test void testSerialization() { try (var service = Service.builder() .numberOfBrokers(3) .brokerConfigs(Map.of(BrokerConfigs.LOG_RETENTION_BYTES_CONFIG, "5566")) .build()) { try (var admin = Admin.of(service.bootstrapServers())) { var clusterInfo = admin.topicNames(false) .thenCompose(admin::clusterInfo) .toCompletableFuture() .join(); byte[] serialized = ByteUtils.toBytes(clusterInfo); ClusterInfo deserialized = ByteUtils.readClusterInfo(serialized); Assertions.assertEquals(3, clusterInfo.brokers().size()); Assertions.assertEquals("5566", clusterInfo.brokers().get(0).config().value(BrokerConfigs.LOG_RETENTION_BYTES_CONFIG).orElseThrow()); Assertions.assertEquals("5566", clusterInfo.brokers().get(1).config().value(BrokerConfigs.LOG_RETENTION_BYTES_CONFIG).orElseThrow()); Assertions.assertEquals("5566", clusterInfo.brokers().get(2).config().value(BrokerConfigs.LOG_RETENTION_BYTES_CONFIG).orElseThrow()); // test failed Assertions.assertEquals(3, deserialized.brokers().size()); Assertions.assertEquals("5566", deserialized.brokers().get(0).config().value(BrokerConfigs.LOG_RETENTION_BYTES_CONFIG).orElseThrow()); Assertions.assertEquals("5566", deserialized.brokers().get(1).config().value(BrokerConfigs.LOG_RETENTION_BYTES_CONFIG).orElseThrow()); Assertions.assertEquals("5566", deserialized.brokers().get(2).config().value(BrokerConfigs.LOG_RETENTION_BYTES_CONFIG).orElseThrow()); } } }
@garyparrot 你要自己處理嗎?
ProtocolBuffer 的部分我不太熟悉要上手可能需要一些時間,然後我還有其他的項目可以處理,可能看有沒有人能幫忙,如果沒有的話時機到了我會再處理。
@Haser0305 @chaohengstudent 你們可否協助處理一下?
好的,沒問題
ByteUtils.toBytes(ClusterInfo)
似乎沒有序列化到 Broker 的設定