[
https://issues.apache.org/jira/browse/HDDS-347?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16579239#comment-16579239
]
LiXin Ge commented on HDDS-347:
-------------------------------
[~xyao] Thanks for reviewing this, I'm sorry that I didn't make it clear.
Please take a look at the comments I added in the code below.
{code:java|title=KeyValueContainer.java|borderStyle=solid}
public void close() throws StorageContainerException {
try {
writeLock();
containerData.closeContainer(); <--- container state will changes to
CLOSED from CLOSING
File containerFile = getContainerFile();
// update the new container data to .container File
updateContainerFile(containerFile); <--- may take hundreds of
milliseconds to process containerFile.
} catch (StorageContainerException ex) {
} finally {
... <--- out of this close() funtion,
will printf the 'LOG' which the test expected
...
{code}
The 'LOG' may delay several hundred milliseconds to appear after the condition
_containerData.isClosed_ been satisfied. So, IMO, the sleep is still necessary
to wait for the appearance of the 'LOG'.
> Fix : testCloseContainerViaStandaAlone fails sometimes
> ------------------------------------------------------
>
> Key: HDDS-347
> URL: https://issues.apache.org/jira/browse/HDDS-347
> Project: Hadoop Distributed Data Store
> Issue Type: Bug
> Reporter: LiXin Ge
> Assignee: LiXin Ge
> Priority: Major
> Fix For: 0.2.1
>
> Attachments: HDDS-347.000.patch
>
>
> This issue was finded in the automatic JenKins unit test of HDDS-265.
> The container life cycle state is : Open -> Closing -> closed, this test
> submit the container close command and wait for container state change to
> *not equal to open*, actually even when the state condition(not equal to
> open) is satisfied, the container may still in process of closing, so the LOG
> which will printf after the container closed can't be find sometimes and the
> test fails.
> {code:java|title=KeyValueContainer.java|borderStyle=solid}
> try {
> writeLock();
> containerData.closeContainer();
> File containerFile = getContainerFile();
> // update the new container data to .container File
> updateContainerFile(containerFile);
> } catch (StorageContainerException ex) {
> {code}
> Looking at the code above, the container state changes from CLOSING to CLOSED
> in the first step, the remaining *updateContainerFile* may take hundreds of
> milliseconds, so even we modify the test logic to wait for the *CLOSED* state
> will not guarantee the test success, too.
> These are two way to fix this:
> 1, Remove one of the double check which depends on the LOG.
> 2, If we have to preserve the double check, we should wait for the *CLOSED*
> state and sleep for a while to wait for the LOG appears.
> patch 000 is based on the second way.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]