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

Fixes etcdutl snapshot restore memory alloc. issue #16055

Closed

Conversation

fatihusta
Copy link
Contributor

Signed-off-by: Fatih USTA <fatihusta86@gmail.com>
@@ -75,6 +76,7 @@ func NewSnapshotRestoreCommand() *cobra.Command {
cmd.Flags().StringVar(&restorePeerURLs, "initial-advertise-peer-urls", defaultInitialAdvertisePeerURLs, "List of this member's peer URLs to advertise to the rest of the cluster")
cmd.Flags().StringVar(&restoreName, "name", defaultName, "Human-readable name for this member")
cmd.Flags().BoolVar(&skipHashCheck, "skip-hash-check", false, "Ignore snapshot integrity hash value (required if copied from data directory)")
cmd.Flags().Int64Var(&quotaBackendBytes, "quota-backend-bytes", 0, "Backend quota size. 0 means use the default quota.)")
Copy link
Member

Choose a reason for hiding this comment

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

Can you add information about what is the default quota.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I refactored all PR. I hope better then old PR. Could you please review again.

@@ -75,6 +76,7 @@ func NewSnapshotRestoreCommand() *cobra.Command {
cmd.Flags().StringVar(&restorePeerURLs, "initial-advertise-peer-urls", defaultInitialAdvertisePeerURLs, "List of this member's peer URLs to advertise to the rest of the cluster")
cmd.Flags().StringVar(&restoreName, "name", defaultName, "Human-readable name for this member")
cmd.Flags().BoolVar(&skipHashCheck, "skip-hash-check", false, "Ignore snapshot integrity hash value (required if copied from data directory)")
cmd.Flags().Int64Var(&quotaBackendBytes, "quota-backend-bytes", 0, "Backend quota size. 0 means use the default quota.)")
Copy link
Member

Choose a reason for hiding this comment

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

Can you replace 0 with the default quota?

@@ -151,6 +151,15 @@ type BackendConfig struct {
Hooks Hooks
}

type NewDefBackend struct {
Copy link
Member

Choose a reason for hiding this comment

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

No need for struct here.

Signed-off-by: Fatih USTA <fatihusta86@gmail.com>
Signed-off-by: Fatih USTA <fatihusta86@gmail.com>
Signed-off-by: Fatih USTA <fatihusta86@gmail.com>
@@ -38,6 +38,7 @@ var (
restorePeerURLs string
restoreName string
skipHashCheck bool
initialMmapSize = uint64(10 * 1024 * 1024 * 1024)
Copy link
Contributor

Choose a reason for hiding this comment

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

10 gigs? why so large?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I copied from here

Copy link
Member

@jmhbnz jmhbnz left a comment

Choose a reason for hiding this comment

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

I think this is looking pretty good, thanks @fatihusta.

Suggest potentially squashing commits down to 1 or 2 if you have time. Also one small nitpick on alignment.

@@ -124,6 +124,7 @@ type ServerConfig struct {
CompactionBatchLimit int
CompactionSleepInterval time.Duration
QuotaBackendBytes int64
InitialMmapSize uint64
Copy link
Member

Choose a reason for hiding this comment

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

Nit - Alignment of unit64 here looks slight off.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. :) thanks for your review.

Signed-off-by: Fatih USTA <fatihusta86@gmail.com>
Signed-off-by: Fatih USTA <fatihusta86@gmail.com>
Signed-off-by: Fatih USTA <fatihusta86@gmail.com>
Copy link
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

LGTM if the commits can be squashed so that it can be easy to backport.

@ivanvc
Copy link
Member

ivanvc commented Jan 19, 2024

As discussed in the fortnightly etcd triage meeting, I'm continuing the work by squashing the commit and rebasing main in PR #17277.

@ahrtr
Copy link
Member

ahrtr commented Feb 11, 2024

superseded by #17277

@ahrtr ahrtr closed this Feb 11, 2024
@fatihusta fatihusta deleted the etcdutl-memory-allocate-problem branch February 11, 2024 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

etcdutl snapshot restore cannot allocate memory
7 participants