func generatePlan(extentMap map[string]*extentInfo, consumergroupUUID string) []string {
	var output []string
	for extentUUID, extentInfo := range extentMap {
		if extentInfo.extStatus == extMissing {
			output = append(output, fmt.Sprintf("DELETE FROM consumer_group_extents WHERE consumer_group_uuid=%s AND extent_uuid=%s;", consumergroupUUID, extentUUID))
		}
	}
	return output
}
generatePlan creates the cql commands for deletion.
package main
import (
	"bufio"
	"context"
	"fmt"
	"github.com/gocql/gocql"
	"github.com/urfave/cli"
	"os"
	"strings"
	"time"
)
func repair(c *cli.Context) error {
	if c.NArg() < 2 {
		fmt.Printf("dest-uuid and cg-uuid not specified\n")
		return nil
	}
	mc, err := newMetadataClient()
	if err != nil {
		fmt.Errorf("newMetadataClient error: %v", err)
		return nil
	}
	consistency := gocql.All
	if consistencyStr := cliContext.String("consistency"); consistencyStr != "" {
		consistency = gocql.ParseConsistency(consistencyStr)
	}
	mc.consistency = consistency
	defer mc.Close()
	destUUID := c.Args()[0]
	cgUUID := c.Args()[1]
	cgMon := newCGWatch(mc, destUUID, cgUUID)
	cgMon.refreshMetadata()
	plan := generatePlan(cgMon.extentMap, cgUUID)
	for _, p := range plan {
		fmt.Println(p)
	}
	fmt.Printf("Please confirm the deletion plan above.\n" +
		"You should confirm that the consumer_group_uuid match ONLY the consumer_group_uuid provided")
	if askForConfirmation("Delete now") == false {
		return nil
	}
	run := c.Bool("run")
	timeout := c.Duration("timeout")
	deleteMISSING(mc, plan, run, timeout)
	return nil
}
func askForConfirmation(s string) bool {
	reader := bufio.NewReader(os.Stdin)
	for {
		fmt.Printf("%s [y/n]: ", s)
		response, err := reader.ReadString('\n')
		if err != nil {
			fmt.Printf("Error reading from stdin", err.Error())
			os.Exit(1)
		}
		response = strings.ToLower(strings.TrimSpace(response))
		if response == "y" || response == "yes" {
			return true
		} else if response == "n" || response == "no" {
			return false
		}
	}
}