Skip to content

Commit

Permalink
fix(sql): Avoid migrating objects solely due to s3 precision loss
Browse files Browse the repository at this point in the history
S3 returns an RFC 1123 Last-Modified time which lacks seconds and
in-fact is common rounded up to the next second.

This PR will compare old and new w/ 1s of buffer.

A modification in S3 will only be migrated if it is > 1s newer than
whatever is in SQL.
  • Loading branch information
ajordens committed Jul 8, 2019
1 parent 56c9723 commit 0b0420a
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ class StorageServiceMigrator(
* - does not exist in 'target'
* or
* - has been more recently modified in 'source'
* (with "some" buffer to account for precision loss on s3 due to RFC 1123 being used for last modified values)
*/
!targetObjectKeys.containsKey(e.key) || targetObjectKeys[e.key]!! < e.value
!targetObjectKeys.containsKey(e.key) || targetObjectKeys[e.key]!! < (e.value - 1000)
}

if (migratableObjectKeys.isEmpty()) {
Expand Down

0 comments on commit 0b0420a

Please sign in to comment.