HDFS-1723. quota errors messages should use the same scale. (Jim Plush via atm)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1140030 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Aaron Myers 2011-06-27 07:05:50 +00:00
parent b866ff64d9
commit f43e0ffa7e
4 changed files with 23 additions and 2 deletions

View File

@ -529,6 +529,9 @@ Trunk (unreleased changes)
HDFS-2087. Declare methods in DataTransferProtocol interface, and change
Sender and Receiver to implement the interface. (szetszwo)
HDFS-1723. quota errors messages should use the same scale. (Jim Plush via
atm)
OPTIMIZATIONS
HDFS-1458. Improve checkpoint performance by avoiding unnecessary image

View File

@ -41,7 +41,8 @@ public String getMessage() {
String msg = super.getMessage();
if (msg == null) {
return "The DiskSpace quota" + (pathName==null?"":(" of " + pathName)) +
" is exceeded: quota=" + quota + " diskspace consumed=" + StringUtils.humanReadableInt(count);
" is exceeded: quota=" + StringUtils.humanReadableInt(quota) +
" diskspace consumed=" + StringUtils.humanReadableInt(count);
} else {
return msg;
}

View File

@ -15440,7 +15440,7 @@
<comparators>
<comparator>
<type>RegexpComparator</type>
<expected-output>put: The DiskSpace quota of /dir1 is exceeded: quota=1024 diskspace consumed=[0-9.]+[kmg]*</expected-output>
<expected-output>put: The DiskSpace quota of /dir1 is exceeded: quota=1.0k diskspace consumed=[0-9.]+[kmg]*</expected-output>
</comparator>
</comparators>
</test>

View File

@ -54,6 +54,23 @@ private void runCommand(DFSAdmin admin, String args[], boolean expectEror)
}
}
/**
* Tests to make sure we're getting human readable Quota exception messages
* Test for @link{ NSQuotaExceededException, DSQuotaExceededException}
* @throws Exception
*/
@Test
public void testDSQuotaExceededExceptionIsHumanReadable() throws Exception {
Integer bytes = 1024;
try {
throw new DSQuotaExceededException(bytes, bytes);
} catch(DSQuotaExceededException e) {
assertEquals("The DiskSpace quota is exceeded: quota=1.0k " +
"diskspace consumed=1.0k", e.getMessage());
}
}
/** Test quota related commands:
* setQuota, clrQuota, setSpaceQuota, clrSpaceQuota, and count
*/