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

Create repsetdata script #111

Open
wants to merge 14 commits into
base: sel-rep-codi
Choose a base branch
from
Open

Create repsetdata script #111

wants to merge 14 commits into from

Conversation

kmacinnis
Copy link

Just want people to check this over, it shouldn't be merged to this branch.

Copy link
Contributor

@imheresamir imheresamir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

repsetdata.sh Outdated Show resolved Hide resolved
repsetdata.sh Outdated Show resolved Hide resolved
repsetdata.sh Outdated Show resolved Hide resolved
@imheresamir
Copy link
Contributor

I'd recommend running ShellCheck when developing Bash scripts. There's even a handy VSCode plugin for it.

Co-authored-by: Samir Shetty <[email protected]>
repsetdata.sh Outdated
OUTPUT_NAME="variables-by-replication-set-$(date +"%Y_%m_%d_%I_%M_%s").csv"
SELECT_STATEMENT=$(cat <<EOF
SELECT
RTRIM(LTRIM(REPLACE(CAST(replication_sets AS varchar), '{}', 'Full' ), '{'),'}') AS "ReplicationSets",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The replication_sets column is of the format {repset1,repset2,repset3}

Since the script outputs a CSV, we may want to confirm that if a variable belongs to multiple replication sets, the output does not get mangled if each replication set is considered a separate column.

Copy link

@adamouamani adamouamani Dec 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@imheresamir We looked at this yesterday and multiple replication sets will be in a single column. However that was before we removed the leading or trailing { }. I'll let @kmacinnis confirm and check if this will causes issue..

Copy link
Contributor

@imheresamir imheresamir Dec 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Local testing results in the following:

ReplicationSets,Policy,Variable
"follower1,follower2",default:policy:root,vault-synchronizer/lob-1/safe-1/variable-1

Which could be ok depending on requirements. I would expect there to be separate lines for each replication set for each variable belonging to multiple replication sets, like this:

ReplicationSet,Policy,Variable
follower1,default:policy:root,vault-synchronizer/lob-1/safe-1/variable-1
follower2,default:policy:root,vault-synchronizer/lob-1/safe-1/variable-1

That way the ReplicationSet column can be filtered in Excel.

Copy link
Contributor

@imheresamir imheresamir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple more comments

repsetdata.sh Outdated Show resolved Hide resolved
repsetdata.sh Outdated Show resolved Hide resolved
repsetdata.sh Outdated Show resolved Hide resolved
@imheresamir
Copy link
Contributor

There are numerous trailing whitespace characters in the script that are not visible in the GitHub view. Do you mind removing those? VSCode has a handy "Trailing Spaces" extension which identifies and removes them for you.

repsetdata.sh Outdated Show resolved Hide resolved
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

Successfully merging this pull request may close these issues.

3 participants