Github user tdas commented on the pull request: https://github.com/apache/spark/pull/791#issuecomment-43744004 This seems really promising!! However, can you explain whether the following sequence of events is possible or not in `ensureFreeSpace`? Both thread 1 and thread 2 wants to insert blocks of 100 bytes. Existing blocks include block A and block B of 100 bytes each, and the total capacity is 200 bytes. Next, - Thread 1 selects block A (not marked yet) and exits the `entries.synchronized { // select }` - Thread 2 selects block A as well (not marked yet) and exist `entries.synchronized { // select }` - Thread 1 enters `entries.synchronized { // mark }` and marks block A to be dropped - Thread 2 also enters `entries.synchronized { // mark } ` and marks block A to be dropped again (this seems to be possible since there is no double check to see whether each block has already been marked or not) - Thread 1 then drops Block A to disk - Thread 2 tries to drop Block A to disk as well, but since it is already dropped, no more action is taken. - Both threads think that 100 bytes have been cleared. Hence 2 x 100 bytes are inserted after dropping only 100 bytes. Is this sequence possible?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---