Skip to content

Conversation

@hgromer
Copy link
Collaborator

@hgromer hgromer commented Dec 3, 2025

Use an async call to take the snapshot so we don't need to do any weird looping. this is simpler

@hgromer
Copy link
Collaborator Author

hgromer commented Dec 3, 2025

This implementation doesn't attempt any unnecessary procedures

}

if (!admin.isSnapshotFinished(desc)) {
throw new IOException("Snapshot " + snapshotName + " not finished.");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Won't this still throw if the snapshot takes longer than waitMs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The initial problem I set out to solve was that the loop would re-try to take the snapshot on a later attempt and fail b/c the snapshot already exists. My initial fix is a bit clunky, and I thought this was cleaner

it's okay to throw if we timeout waiting for the snapshot to finish imo. we can up the config value if we want to. what do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's fine

Copy link
Collaborator

@rmdmattingly rmdmattingly left a comment

Choose a reason for hiding this comment

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

Main change looks good (use snapshotAsync + bounded wait to avoid Admin RPC timeouts), but a couple correctness/compat notes before I can approve:

  1. Snapshot already exists / timeout race: old code returned early if snapshotName already exists (to handle cases where snapshot is still running but the Admin call timed out). New code will throw on timeout or on “snapshot already exists”. Suggest: on TimeoutException/ExecutionException, check if a snapshot with this name exists (or use isSnapshotFinished when possible) and treat that as success if finished.

  2. Exception type: snapshotTable() declares throws IOException but wraps all Exceptions in RuntimeException. Prefer rethrow as IOException (or propagate IOException directly) to keep callers consistent.

  3. SnapshotType.FLUSH: previously used admin.snapshot(name, table) which may default to a different type in some versions. If FLUSH is intended, maybe add a short comment noting why.

Config: BACKUP_WAIT_MS_KEY + DEFAULT_BACKUP_WAIT_MS matches prior 10*10s behavior; just make sure release notes mention the key rename.

@charlesconnell charlesconnell changed the title (Not upstreamed yet) Use async client (Not upstreamed yet) Use async client in FullTableBackupClient Feb 10, 2026
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.

4 participants