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

gRPC backupClient.EnumerateWithFilters to support date ranges #1955

Open
dvasilen opened this issue Nov 12, 2021 · 1 comment
Open

gRPC backupClient.EnumerateWithFilters to support date ranges #1955

dvasilen opened this issue Nov 12, 2021 · 1 comment

Comments

@dvasilen
Copy link

Is this a BUG REPORT or FEATURE REQUEST?:

Feature Request

What happened:

We have rather large number of PX volumes (about 20K) and associated cloud snapshots.
We have to generate weekly reports for the status of newly performed cloud snapshots. The PX volumes are created on demand. We do not use PX schedules to backup volumes and only back them up as needed (if a volume was updated).
The gRPC backupClient.EnumerateWithFilters call works but it takes hours to get all the snapshots and select ones which are in the date range.

What you expected to happen:

Given the date range we need some way to quickly select cloud snapshots.

How to reproduce it (as minimally and precisely as possible):

	// Get the first batch and maybe that is it
	enumerateResponse, err = backupClient.EnumerateWithFilters(context.Background(),
		&api.SdkCloudBackupEnumerateWithFiltersRequest{
			CredentialId: credentialId,
		})

	if err != nil {
		gerr, _ := status.FromError(err)
		return fmt.Errorf("Error Code[%d] Message[%s]\n", gerr.Code(), gerr.Message())
	}

	logger.Info("Received the first backup batch")

	for _, info := range enumerateResponse.Backups {
		backup := &BackupInfo{SdkCloudBackupInfo: info}
		if dateRange.In(backup.Timestamp) {
			logger.Info("Adding backup %s for the further processing", backup.Timestamp.String())
			backupInfos = append(backupInfos, backup)
		} else {
			logger.Info("The backup %s is not in the date range", backup.Timestamp.String())
		}
	}

	// Continue, if we have more items to fetch...
	for len(enumerateResponse.ContinuationToken) > 0 {
		logger.Info("Retrieving the next chunk using continuation token %s", enumerateResponse.ContinuationToken)
		enumerateResponse, err = backupClient.EnumerateWithFilters(context.Background(),
			&api.SdkCloudBackupEnumerateWithFiltersRequest{
				CredentialId: credentialId,
			})

		if err != nil {
			gerr, _ := status.FromError(err)
			return fmt.Errorf("Error Code[%d] Message[%s]\n", gerr.Code(), gerr.Message())
		}

		for _, info := range enumerateResponse.Backups {
			backup := &BackupInfo{SdkCloudBackupInfo: info}
			if dateRange.In(backup.Timestamp) {
				logger.Info("Adding backup %s for the further processing", backup.Timestamp.String())
				backupInfos = append(backupInfos, backup)
			} else {
				logger.Info("The backup %s is not in the date range", backup.Timestamp.String())
			}
		}
	}

	logger.Info("Collected %d the backups of interest", len(backupInfos))

Anything else we need to know?:

Environment:

  • Container Orchestrator and version: PX 2.8
  • Cloud provider or hardware configuration: IBM Cloud Kubernetes 1.22
  • OS (e.g. from /etc/os-release):
NAME="Red Hat Enterprise Linux"
VERSION="8.4 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.4"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.4 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8.4:GA"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/red_hat_enterprise_linux/8/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_BUGZILLA_PRODUCT_VERSION=8.4
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.4"
  • Kernel (e.g. uname -a)
Linux XXX 4.15.0-159-generic #167-Ubuntu SMP Tue Sep 21 08:55:05 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
@dvasilen
Copy link
Author

/cc @lpabon

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

No branches or pull requests

1 participant