Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion priam/src/main/java/com/netflix/priam/aws/S3FileSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,14 @@ protected long uploadFileImpl(Path localPath, Path remotePath) throws BackupRest
}
byte[] chunk = byteArrayOutputStream.toByteArray();
long compressedFileSize = chunk.length;
rateLimiter.acquire(chunk.length);

/**
* Weird, right that we are checking for length which is positive. You can thanks
* this to sometimes C* creating files which are zero bytes, and giving that in
* snapshot for some unknown reason.
*/
if (chunk.length > 0) rateLimiter.acquire(chunk.length);

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.

I assume we still want to proceed with the upload of this 0 byte file to keep our s3 snapshots consistent with C* snapshot view, and hence we do not skip the rest of the upload code path even if the file has 0 byte - is this correct?


ObjectMetadata objectMetadata = getObjectMetadata(localPath);
objectMetadata.setContentLength(chunk.length);
PutObjectRequest putObjectRequest =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ public AbstractFileSystem(
// Add notifications.
this.addObserver(backupNotificationMgr);
this.objectCache =
CacheBuilder.newBuilder().maximumSize(configuration.getBackupQueueSize()).build();
CacheBuilder.newBuilder()
.maximumSize(configuration.getBackupQueueSize())
.expireAfterAccess(configuration.getBackupCacheTTLInDays(), TimeUnit.DAYS)
.build();
tasksQueued = new ConcurrentHashMap<>().newKeySet();
/*
Note: We are using different queue for upload and download as with Backup V2.0 we might download all the meta
Expand Down
11 changes: 11 additions & 0 deletions priam/src/main/java/com/netflix/priam/config/IConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,17 @@ default int getBackupQueueSize() {
return 100000;
}

/**
* TTL (in days) for the entries - filenames which will be cached internally when successfully
* uploaded to remote file system. This cache is used to avoid bombarding the remote file system
* to check if object exists.
*
* @return
*/
default int getBackupCacheTTLInDays() {
return 2;
}

/**
* Queue size to be used for file downloads. Note that once queue is full, we would wait for
* {@link #getDownloadTimeout()} to add any new item before declining the request and throwing
Expand Down