Closed weilintsaiWand closed 9 years ago
First stable version for review is ready #199 . Will run regression tonight. Can commit tomorrow if regression pass.
Btw, this patch pass 200 times regression. Although it can not finish 2000 times regression due to unknown reasons.
Sounds like the right solution. Couple of suggestions on code organisation:
checkIfRacing()
to checkFileClosed()
put
parameter should be just the key
as you don't use anything else from the put itself.isFileStateEquals
and just add its contents into checkFileClosed()
. The latter method is small enough, and you actually do not isFileStateEquals
anywhere else.(kvs.size() == 1)
. I think it would be more generic just to look for FileField.LEASE
. We may later need to update other fields while updating the lease.Update is ready for second review.
In checkFileClosed()
, we check if someone tries to update lease while the file is closed.
There are two situations:
kvs.size() == 1
. Which means it from updateINodeLease()
. We discard the update this caseGreat. Looks good. We should also add a LOG.warn() in case when the lease update comes after close:
Attempt to update lease for a file that has been already closed. Ignoring.
This is a sub issue from #184. There are 3 types of failure in #184, the first one of them are clarified while the other two are still under investigation. Hence, we create this issue to focus on the first one so we can solve #184 step by step.
Failure Log
Root Cause
It's a race condition between
renewLease()
andinternalReleaseLease()
. Whenever a new file is created, it will create a block and then call renewLease() to set lease. However, we have another running process to check if the lease expired periodically. Since the lease expiration time is set to be super short in our test. The file can be expired and can be closed byinternalReleaseLease()
beforerenewLease()
taking place. Therefore, the lease is set tonon-null
byrenewLease()
after the file is closed. However, the lease is expected to benull
since we think the file is closed. As a result, the assert report a failure because the lease is not null