From 030953c19ee7766ce97516a5bc73b577f93e43ee Mon Sep 17 00:00:00 2001 From: David Teutli Date: Fri, 13 Mar 2026 13:46:46 -0500 Subject: [PATCH 1/4] fix: take into account all existing files in the given path --- cmd/topicctl/subcmd/rebalance.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cmd/topicctl/subcmd/rebalance.go b/cmd/topicctl/subcmd/rebalance.go index c704d57..3d3d4af 100644 --- a/cmd/topicctl/subcmd/rebalance.go +++ b/cmd/topicctl/subcmd/rebalance.go @@ -161,13 +161,9 @@ func rebalanceRun(cmd *cobra.Command, args []string) error { existingConfigFiles := make(map[string]struct{}) if rebalanceConfig.bootstrapMissingConfigs { // make set of existing files - err := processTopicFiles(topicFiles, func(topicConfig config.TopicConfig, topicFile string) error { + for _, topicFile := range topicFiles { _, topicFilename := filepath.Split(topicFile) existingConfigFiles[topicFilename] = struct{}{} - return nil - }) - if err != nil { - return err } // bootstrap missing config files From 6ac8c97dc0f6944bc774c254e8e82f426890786a Mon Sep 17 00:00:00 2001 From: David Teutli Date: Fri, 13 Mar 2026 14:52:09 -0500 Subject: [PATCH 2/4] fix: reverse logic of existingConfigFiles to bootstrappedFiles --- cmd/topicctl/subcmd/rebalance.go | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/cmd/topicctl/subcmd/rebalance.go b/cmd/topicctl/subcmd/rebalance.go index 3d3d4af..36240ff 100644 --- a/cmd/topicctl/subcmd/rebalance.go +++ b/cmd/topicctl/subcmd/rebalance.go @@ -158,9 +158,10 @@ func rebalanceRun(cmd *cobra.Command, args []string) error { return err } - existingConfigFiles := make(map[string]struct{}) + bootstrappedFiles := make(map[string]struct{}) if rebalanceConfig.bootstrapMissingConfigs { - // make set of existing files + // make set of existing files before bootstrapping + existingConfigFiles := make(map[string]struct{}) for _, topicFile := range topicFiles { _, topicFilename := filepath.Split(topicFile) existingConfigFiles[topicFilename] = struct{}{} @@ -184,6 +185,14 @@ func rebalanceRun(cmd *cobra.Command, args []string) error { if err != nil { return err } + + // make list of bootstrappedFiles + for _, topicFile := range topicFiles { + _, topicFilename := filepath.Split(topicFile) + if _, found := existingConfigFiles[topicFilename]; !found { + bootstrappedFiles[topicFilename] = struct{}{} + } + } } // iterate through each topic config and initiate rebalance @@ -260,16 +269,10 @@ func rebalanceRun(cmd *cobra.Command, args []string) error { } // clean up any bootstrapped topic configs - if rebalanceConfig.bootstrapMissingConfigs { - for _, topicFile := range topicFiles { - _, topicFilename := filepath.Split(topicFile) - if _, found := existingConfigFiles[topicFilename]; found { - continue - } - err := os.Remove(topicFile) - if err != nil { - log.Errorf("error deleting temporary file %s: %v", topicFile, err) - } + for topicFile := range bootstrappedFiles { + err := os.Remove(topicFile) + if err != nil { + log.Errorf("error deleting temporary file %s: %v", topicFile, err) } } From 0717aa14ef4d1bf03774a9550ec2b6e314e04e3e Mon Sep 17 00:00:00 2001 From: David Teutli Date: Mon, 16 Mar 2026 12:38:32 -0500 Subject: [PATCH 3/4] fix: store full file path --- cmd/topicctl/subcmd/rebalance.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/topicctl/subcmd/rebalance.go b/cmd/topicctl/subcmd/rebalance.go index 36240ff..296c03a 100644 --- a/cmd/topicctl/subcmd/rebalance.go +++ b/cmd/topicctl/subcmd/rebalance.go @@ -190,7 +190,7 @@ func rebalanceRun(cmd *cobra.Command, args []string) error { for _, topicFile := range topicFiles { _, topicFilename := filepath.Split(topicFile) if _, found := existingConfigFiles[topicFilename]; !found { - bootstrappedFiles[topicFilename] = struct{}{} + bootstrappedFiles[topicFile] = struct{}{} } } } From 6fbb514dc0dc80faab59aab7515efce04c0bcc9b Mon Sep 17 00:00:00 2001 From: David Teutli Date: Tue, 17 Mar 2026 08:57:03 -0500 Subject: [PATCH 4/4] fix: bump version for release --- pkg/version/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/version/version.go b/pkg/version/version.go index 1cc493c..69eb7fd 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -1,4 +1,4 @@ package version // Version is the current topicctl version. -const Version = "2.0.1" +const Version = "2.0.2"