Clone
coraxs <djvelickovic234@gmail.com>
committed
on 08 Jan 18
Fix parallel uploading in Amazon S3
Binary value must be marked as "used" (unused=false) when storing in fileSystemCache (no matter what is … Show more
Fix parallel uploading in Amazon S3

Binary value must be marked as "used" (unused=false) when storing in fileSystemCache (no matter what is value of "markAsUnused"). In following case it can be crucial:

If couple of threads are trying to add different files in same S3BinaryStore at same time, they will store files in the same fileSystemCache, and when some thread finish, it will delete all files marked as unused from cache (that will be all files stored in cache from another threads), and exception:

org.modeshape.jcr.value.binary.BinaryStoreException: Unable to find binary value with key "78ed7457b289ba42ff67256f33a88b5bf0ca3012" within binary store at "/tmp/modeshape-binary-store"

at org.modeshape.jcr.value.binary.S3BinaryStore.storeValue(S3BinaryStore.java:251)

at org.modeshape.jcr.value.binary.BinaryStoreValueFactory.create(BinaryStoreValueFactory.java:244)

... 164 more

will be thrown in all other threads (with different SHA-1). Show less

master + 5 more