Skip to content

Commit

Permalink
fixed localfs and remotefs processors to check for timestamp equality…
Browse files Browse the repository at this point in the history
… only with second precission
  • Loading branch information
yantom committed Nov 4, 2024
1 parent aa3d486 commit afd3e84
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ data
application.yml
application.properties
local-storage-folder/
sample-storage-dir/
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -196,7 +197,7 @@ public void forgetObject(String objectIdAtStorage, String dataSpace, Instant for
Files.deleteIfExists(folder.resolve(objectIdAtStorage));
} else {
if (objectMetadata != null) {
if (objectMetadata.getCreated() != null && objectMetadata.getCreated().isAfter(forgetAuditTimestamp)) {
if (objectMetadata.getCreated() != null && objectMetadata.getCreated().truncatedTo(ChronoUnit.MILLIS).isAfter(forgetAuditTimestamp.truncatedTo(ChronoUnit.MILLIS))) {
log.trace("skipping propagation of FORGET operation on {} as the forget operation was related to object which has been overridden by other", objectIdAtStorage);
return;
}
Expand Down Expand Up @@ -376,7 +377,7 @@ private ObjectConsistencyVerificationResultDto fillObjectStateInfo(ObjectConsist
if (metadataAtStorage == null)
throw new FileDoesNotExistException(metadataFilePath(folder, object.getStorageId()).toString(), storage);
boolean stateMetadataConsistent = metadataAtStorage.getState() == object.getState();
boolean timestampMetadataConsistent = object.getCreated().equals(metadataAtStorage.getCreated());
boolean timestampMetadataConsistent = object.getCreated().getEpochSecond() == (metadataAtStorage.getCreated().getEpochSecond());
boolean checksumMetadataConsistent = object.getChecksum().equals(metadataAtStorage.getChecksum());
info.setMetadataConsistent(stateMetadataConsistent && checksumMetadataConsistent && timestampMetadataConsistent);
if (object.getState().contentMustBeStoredAtLogicalStorage()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ private ObjectConsistencyVerificationResultDto fillObjectStateInfo(ObjectConsist
if (metadataAtStorage == null)
throw new FileDoesNotExistException(metadataFilePath(folder, object.getStorageId()), storage);
boolean stateMetadataConsistent = metadataAtStorage.getState() == object.getState();
boolean timestampMetadataConsistent = object.getCreated().equals(metadataAtStorage.getCreated());
boolean timestampMetadataConsistent = object.getCreated().getEpochSecond() == (metadataAtStorage.getCreated().getEpochSecond());
boolean checksumMetadataConsistent = object.getChecksum().equals(metadataAtStorage.getChecksum());
info.setMetadataConsistent(stateMetadataConsistent && checksumMetadataConsistent && timestampMetadataConsistent);
if (object.getState().contentMustBeStoredAtLogicalStorage()) {
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ spring:
password: changeme
jpa:
show-sql: false
database-platform: org.hibernate.dialect.PostgreSQLDialect
hibernate:
ddl-auto: validate
naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
Expand Down

0 comments on commit afd3e84

Please sign in to comment.