Skip to content

Uploader refactoring and additional attempts for immediate uploaders#1724

Merged
ssalinas merged 6 commits into
masterfrom
uploader_fixes
Feb 26, 2018
Merged

Uploader refactoring and additional attempts for immediate uploaders#1724
ssalinas merged 6 commits into
masterfrom
uploader_fixes

Conversation

@ssalinas

Copy link
Copy Markdown
Contributor

@darcatron I'm folding #1714 into this as well to avoid too many merge conflicts. Will close the other when they are both in hs_qa

There were a few cases where an immediate uploader could miss files. Particularly, if an uploader was immediate, but then something attempted to recreate it (wrote the file again), before the original one expired and was removed. This updates the uploader driver to:

  • Trigger additional immediately upload attempts when the metadata is written to
  • Check for any remaining files matching the glob on immediate uploader expiration, uploading them if some are found
  • Refactor a number of things to java8-ify them and store immediate uploaders in a way that better matches regular uploaders

private final List<S3UploadMetadata> immediateUploadMetadata;
private final ReentrantLock lock;
private final ConcurrentMap<SingularityUploader, Future<Integer>> immediateUploaders;
private final Map<S3UploadMetadata, SingularityUploader> metadataToimmediateUploader;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit metadataToimmediateUploader -> metadataToImmediateUploader (capitalize immediate)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

LOG.debug("Retrying immediate uploader {}", uploaderMetadata);
performImmediateUpload(uploader);
} else {
LOG.debug("Uploader for metadata {} not found to retry, recreating", uploaderMetadata);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not sure I understand this debug line. What is being re-created?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah, copy-pasta error. the ,recreating should be removed, if we don't find the uploader in the map it means it somehow got added to both toRemove and toRetry, which theoretically should never happen, but better than throwing a NPE, updated the message

SingularityUploader uploader = metadataToimmediateUploader.remove(uploaderMetadata);
if (uploader != null) {
LOG.debug("Retrying immediate uploader {}", uploaderMetadata);
performImmediateUpload(uploader);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For this retry loop, the uploader is removed from metadataToImmeditateUploader and when it's called to upload immediately, it'll be added to the immediteUploadersFutures map. During the next run of checkUploads, won't the uploader be missing from metadataToImmediateUploader and cause the check to skip adding the uploadedFiles to the total count? Instead it'll be moved to the toRemove list and hit the 30 second check

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good catch. It ends up working out that it still retries, but that should be a .get so we can do the full retry -> toRemove loop . Fixed

@matush-v

Copy link
Copy Markdown
Contributor

lgtm 🚢

@ssalinas ssalinas added this to the 0.20.0 milestone Feb 20, 2018
@ssalinas ssalinas merged commit 48f5435 into master Feb 26, 2018
@ssalinas ssalinas deleted the uploader_fixes branch February 26, 2018 16:55
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.

2 participants