Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SERIALIZATION] Unable to retrieve broker configs from deserialized ClusterInfo #1704

Open
garyparrot opened this issue May 7, 2023 · 4 comments

Comments

@garyparrot
Copy link
Collaborator

ByteUtils.toBytes(ClusterInfo) 似乎沒有序列化到 Broker 的設定

  @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());
      }
    }
  }
@chia7712
Copy link
Contributor

chia7712 commented May 7, 2023

@garyparrot 你要自己處理嗎?

@garyparrot
Copy link
Collaborator Author

ProtocolBuffer 的部分我不太熟悉要上手可能需要一些時間,然後我還有其他的項目可以處理,可能看有沒有人能幫忙,如果沒有的話時機到了我會再處理。

@chia7712
Copy link
Contributor

chia7712 commented May 7, 2023

@Haser0305 @chaohengstudent 你們可否協助處理一下?

@Haser0305
Copy link
Collaborator

@Haser0305 @chaohengstudent 你們可否協助處理一下?

好的,沒問題

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants