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

Update RDS postgres restore command #1118

Merged
merged 5 commits into from
Oct 18, 2021
Merged

Update RDS postgres restore command #1118

merged 5 commits into from
Oct 18, 2021

Conversation

akankshakumari393
Copy link
Contributor

Change Overview

This PR updates RDS Postgres restore command to replace LOCALE with LC_COLLATE for the RDS Postgres DB Instance engine version less than 13.0 .

Pull request type

Please check the type of change your PR introduces:

  • 🚧 Work in Progress
  • 🌈 Refactoring (no functional changes, no api changes)
  • 🐹 Trivial/Minor
  • 🐛 Bugfix
  • 🌻 Feature
  • 🗺️ Documentation
  • 🤖 Test

Issues

  • #XXX

Test Plan

  • 💪 Manual
  • ⚡ Unit test
  • 💚 E2E

go test -v -check.f=RDSFunctionsTest.TestPrepareCommand

=== RUN Test
OK: 1 passed
--- PASS: Test (0.00s)
PASS
ok github.com/kanisterio/kanister/pkg/function 0.053s

pkg/function/utils.go Outdated Show resolved Hide resolved
return nil, errors.Wrapf(err, "Couldn't find DBInstance Version")
}
// Add Constraints
constraints, err := version.NewConstraint(">= 13.0")
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets declare version as const

akankshakumari393 and others added 2 commits October 18, 2021 16:37
Co-authored-by: Prasad Ghangal <prasad.ghangal@gmail.com>
return nil, errors.Wrapf(err, "Couldn't add constraint to DBInstance Version")
}
// Verify Constraints
if !constraints.Check(v1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

is it same as v1 >= RDSPostgresDBInstanceEngineVersion?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@PrasadG193 Since we have used !constraints.Check(v1) . It will be same as v1 < RDSPostgresDBInstanceEngineVersion which is if v1 < 13.0. Let me reverse the constraint used in line number 201 and update the If condition to make it more readable.

Copy link
Contributor

@PrasadG193 PrasadG193 left a comment

Choose a reason for hiding this comment

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

Looks good

}

if (len(dbInstance.DBInstances) == 0) || (dbInstance.DBInstances[0].EngineVersion == nil) {
return "", errors.Errorf("Received nil engine version")
Copy link
Contributor

@viveksinghggits viveksinghggits Oct 18, 2021

Choose a reason for hiding this comment

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

should we change this to
DB instance's Engine version is nil

@@ -208,6 +208,20 @@ func findRDSEndpoint(ctx context.Context, rdsCli *rds.RDS, instanceID string) (s
return *dbInstance.DBInstances[0].Endpoint.Address, nil
}

// findRDSDBEngineVersion returns the database engine version
func findRDSDBEngineVersion(ctx context.Context, rdsCli *rds.RDS, instanceID string) (string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
func findRDSDBEngineVersion(ctx context.Context, rdsCli *rds.RDS, instanceID string) (string, error) {
func rdsDBEngineVersion(ctx context.Context, rdsCli *rds.RDS, instanceID string) (string, error) {

@mergify mergify bot merged commit 4527d93 into master Oct 18, 2021
@mergify mergify bot deleted the rds_postgre_restore_cmd branch October 18, 2021 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants