cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan Boudreault (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CASSANDRA-6983) DirectoriesTest fails when run as root
Date Tue, 06 Jan 2015 13:31:35 GMT

     [ https://issues.apache.org/jira/browse/CASSANDRA-6983?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Alan Boudreault updated CASSANDRA-6983:
---------------------------------------
    Attachment: 6983-v1.patch

As a non-root user perspective, the test is ok. We have to call the  Directories.create()
if we want to get the internal cassandra disk policy mechanism triggered. If we remove that
fake directory creation, the test will fail since the it is not marked as an unwritable BlacklistedDirectory.


The real issue with that test using the root user is that we cannot set the directory unwritable
using Java. Internally, Java will simply re-set the write permission for the operation since
the root user is allowed to do everything. Please correct me if I'm wrong here about that
Java behavior. 

At this point, we have two options to fix this test:

1.  Do not call Directories.create(), but rather set the directory unwritable manually via
the BlacklistedDirectories class. I don't especially like this option since it doesn't really
trigger the best_effort internal mechanism.  

2. Simulate a fake directory creation by throwing an exception. This will trigger the internal
handleFSError and the best_effort mechanism. This will work for the root user since we are
not playing anymore with the filesystem. I've attached a tentative patch with this solution.

Let me know what you think or if you have any suggestion.

> DirectoriesTest fails when run as root
> --------------------------------------
>
>                 Key: CASSANDRA-6983
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-6983
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Tests
>            Reporter: Brandon Williams
>            Assignee: Ryan McGuire
>            Priority: Minor
>             Fix For: 2.0.12
>
>         Attachments: 6983-v1.patch
>
>
> When you run the DirectoriesTest as a normal user, it passes because it fails to create
the 'bad' directory:
> {noformat}
>     [junit] ------------- Standard Error -----------------
>     [junit] ERROR 16:16:18,111 Failed to create /tmp/cassandra4119802552776680052unittest/ks/bad
directory
>     [junit]  WARN 16:16:18,112 Blacklisting /tmp/cassandra4119802552776680052unittest/ks/bad
for writes
>     [junit] ------------- ---------------- ---------------
> {noformat}
> But when you run the test as root, it succeeds in making the directory, causing an assertion
failure that it's unwritable:
> {noformat}
>     [junit] Testcase: testDiskFailurePolicy_best_effort(org.apache.cassandra.db.DirectoriesTest):
      FAILED
>     [junit] 
>     [junit] junit.framework.AssertionFailedError: 
>     [junit]     at org.apache.cassandra.db.DirectoriesTest.testDiskFailurePolicy_best_effort(DirectoriesTest.java:199)
> {noformat}
> It seems to me that we shouldn't be relying on failing the make the directory.  If we're
just going to test a nonexistent dir, why try to make one at all?  And if that is supposed
to succeed, then we have a problem with either the test or blacklisting.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message