[ https://issues.apache.org/jira/browse/HDFS-1515?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12990420#comment-12990420
]
Po Cheung commented on HDFS-1515:
---------------------------------
There exists a testcase for quotas and append in TestQuota.testSpaceCommands. Will that suffice?
{noformat}
// Test Append :
// verify space quota
c = dfs.getContentSummary(quotaDir1);
assertEquals(c.getSpaceQuota(), 4 * fileSpace);
// verify space before append;
c = dfs.getContentSummary(dstPath);
assertEquals(c.getSpaceConsumed(), 3 * fileSpace);
OutputStream out = dfs.append(file2);
// appending 1 fileLen should succeed
out.write(new byte[fileLen]);
out.close();
file2Len += fileLen; // after append
// verify space after append;
c = dfs.getContentSummary(dstPath);
assertEquals(c.getSpaceConsumed(), 4 * fileSpace);
// now increase the quota for quotaDir1
dfs.setQuota(quotaDir1, FSConstants.QUOTA_DONT_SET, 5 * fileSpace);
// Now, appending more than 1 fileLen should result in an error
out = dfs.append(file2);
hasException = false;
try {
out.write(new byte[fileLen + 1024]);
out.flush();
out.close();
} catch (DSQuotaExceededException e) {
hasException = true;
IOUtils.closeStream(out);
}
assertTrue(hasException);
file2Len += fileLen; // after partial append
// verify space after partial append
c = dfs.getContentSummary(dstPath);
assertEquals(c.getSpaceConsumed(), 5 * fileSpace);
{noformat}
> Test append and quotas
> -----------------------
>
> Key: HDFS-1515
> URL: https://issues.apache.org/jira/browse/HDFS-1515
> Project: Hadoop HDFS
> Issue Type: Test
> Components: test
> Affects Versions: 0.22.0, 0.23.0
> Reporter: Eli Collins
> Assignee: Eli Collins
> Priority: Blocker
> Fix For: 0.22.0, 0.23.0
>
>
> There is no test coverage for quotas and append. Let's add a test to TestQuota that covers
that quotas are updated correctly when appending to a file.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|