[jira] [Commented] (HDFS-7738) Add more negative tests for truncate

2015-02-07 Thread Konstantin Shvachko (JIRA)

[ 
https://issues.apache.org/jira/browse/HDFS-7738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14310900#comment-14310900
 ] 

Konstantin Shvachko commented on HDFS-7738:
---

I agree your method of partitioning is more uniform. So it is just the logging.
+1 on the patch

 Add more negative tests for truncate
 

 Key: HDFS-7738
 URL: https://issues.apache.org/jira/browse/HDFS-7738
 Project: Hadoop HDFS
  Issue Type: Sub-task
  Components: test
Reporter: Tsz Wo Nicholas Sze
Assignee: Tsz Wo Nicholas Sze
Priority: Minor
 Fix For: 2.7.0

 Attachments: h7738_20150204.patch, h7738_20150205.patch, 
 h7738_20150205b.patch, h7738_20150206.patch, h7738_20150206b.patch, 
 h7738_20150206c.patch


 The following are negative test cases for truncate.
 - new length  old length
 - truncating a directory
 - truncating a non-existing file
 - truncating a file without write permission
 - truncating a file opened for append
 - truncating a file in safemode



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


[jira] [Commented] (HDFS-7738) Add more negative tests for truncate

2015-02-06 Thread Tsz Wo Nicholas Sze (JIRA)

[ 
https://issues.apache.org/jira/browse/HDFS-7738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14309818#comment-14309818
 ] 

Tsz Wo Nicholas Sze commented on HDFS-7738:
---

 In general I don't like random tests because they imply intermittent 
 failures, ...

If there are intermittent failures, it means that there are bugs either in the 
code or in the test.  I guess what you don't like is poorly written random 
tests which may experience intermittent failures.  For well written tests, it 
won't have intermittent failures.

Why we need random tests?  It is because the problem space is huge so that it 
is impossible to try all the cases.  We have to do random sampling.

testBasicTruncate, which is a well written test, does cover a lot of cases.  
However, it only tests a 12 bytes file with 3 blocks.  Also, toTruncate is 
consecutive.  For example, it does not test the case calling truncate to take 
out 10 blocks at once.

 Add more negative tests for truncate
 

 Key: HDFS-7738
 URL: https://issues.apache.org/jira/browse/HDFS-7738
 Project: Hadoop HDFS
  Issue Type: Sub-task
  Components: test
Reporter: Tsz Wo Nicholas Sze
Assignee: Tsz Wo Nicholas Sze
Priority: Minor
 Fix For: 2.7.0

 Attachments: h7738_20150204.patch, h7738_20150205.patch, 
 h7738_20150205b.patch, h7738_20150206.patch


 The following are negative test cases for truncate.
 - new length  old length
 - truncating a directory
 - truncating a non-existing file
 - truncating a file without write permission
 - truncating a file opened for append
 - truncating a file in safemode



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


[jira] [Commented] (HDFS-7738) Add more negative tests for truncate

2015-02-06 Thread Tsz Wo Nicholas Sze (JIRA)

[ 
https://issues.apache.org/jira/browse/HDFS-7738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14309819#comment-14309819
 ] 

Tsz Wo Nicholas Sze commented on HDFS-7738:
---

 TestHAAppend fails waiting on checkBlockRecovery() for me. Does it not fail 
 for you?

The machine you used is probably slow.  It also passed the previous Jenkins run.

 Add more negative tests for truncate
 

 Key: HDFS-7738
 URL: https://issues.apache.org/jira/browse/HDFS-7738
 Project: Hadoop HDFS
  Issue Type: Sub-task
  Components: test
Reporter: Tsz Wo Nicholas Sze
Assignee: Tsz Wo Nicholas Sze
Priority: Minor
 Fix For: 2.7.0

 Attachments: h7738_20150204.patch, h7738_20150205.patch, 
 h7738_20150205b.patch, h7738_20150206.patch


 The following are negative test cases for truncate.
 - new length  old length
 - truncating a directory
 - truncating a non-existing file
 - truncating a file without write permission
 - truncating a file opened for append
 - truncating a file in safemode



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


[jira] [Commented] (HDFS-7738) Add more negative tests for truncate

2015-02-06 Thread Tsz Wo Nicholas Sze (JIRA)

[ 
https://issues.apache.org/jira/browse/HDFS-7738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14309829#comment-14309829
 ] 

Tsz Wo Nicholas Sze commented on HDFS-7738:
---

 If the desire to have these is strong then they need sufficient logging 
 information, which would describe the full conditions under which a failure 
 occurs when it does.

We already have 
{code}
LOG.info(newLength= + newLength + , isReady= + isReady);
{code}
I think it is good enough.  Agree?

 Add more negative tests for truncate
 

 Key: HDFS-7738
 URL: https://issues.apache.org/jira/browse/HDFS-7738
 Project: Hadoop HDFS
  Issue Type: Sub-task
  Components: test
Reporter: Tsz Wo Nicholas Sze
Assignee: Tsz Wo Nicholas Sze
Priority: Minor
 Fix For: 2.7.0

 Attachments: h7738_20150204.patch, h7738_20150205.patch, 
 h7738_20150205b.patch, h7738_20150206.patch


 The following are negative test cases for truncate.
 - new length  old length
 - truncating a directory
 - truncating a non-existing file
 - truncating a file without write permission
 - truncating a file opened for append
 - truncating a file in safemode



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


[jira] [Commented] (HDFS-7738) Add more negative tests for truncate

2015-02-06 Thread Konstantin Shvachko (JIRA)

[ 
https://issues.apache.org/jira/browse/HDFS-7738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14309727#comment-14309727
 ] 

Konstantin Shvachko commented on HDFS-7738:
---

  it is better to have some random test.

In general I don't like random tests because they imply intermittent failures, 
which are hard to reproduce and therefore fix.
If the desire to have these is strong then they need sufficient logging 
information, which would describe the full conditions under which a failure 
occurs when it does.
In this particular case your test is a subset of the existing test on its every 
run.
Will look at the patch in a bit.

 Add more negative tests for truncate
 

 Key: HDFS-7738
 URL: https://issues.apache.org/jira/browse/HDFS-7738
 Project: Hadoop HDFS
  Issue Type: Sub-task
  Components: test
Reporter: Tsz Wo Nicholas Sze
Assignee: Tsz Wo Nicholas Sze
Priority: Minor
 Fix For: 2.7.0

 Attachments: h7738_20150204.patch, h7738_20150205.patch, 
 h7738_20150205b.patch, h7738_20150206.patch


 The following are negative test cases for truncate.
 - new length  old length
 - truncating a directory
 - truncating a non-existing file
 - truncating a file without write permission
 - truncating a file opened for append
 - truncating a file in safemode



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


[jira] [Commented] (HDFS-7738) Add more negative tests for truncate

2015-02-06 Thread Konstantin Shvachko (JIRA)

[ 
https://issues.apache.org/jira/browse/HDFS-7738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14309734#comment-14309734
 ] 

Konstantin Shvachko commented on HDFS-7738:
---

TestHAAppend fails waiting on checkBlockRecovery() for me. Does it not fail for 
you?
{code}
java.lang.AssertionError: inode should complete in ~3 ms.
Expected: is true
 but: was false
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
at org.junit.Assert.assertThat(Assert.java:865)
at 
org.apache.hadoop.hdfs.server.namenode.TestFileTruncate.checkBlockRecovery(TestFileTruncate.java:944)
at 
org.apache.hadoop.hdfs.server.namenode.ha.TestHAAppend.testMultipleAppendsDuringCatchupTailing(TestHAAppend.java:213)
{code}

 Add more negative tests for truncate
 

 Key: HDFS-7738
 URL: https://issues.apache.org/jira/browse/HDFS-7738
 Project: Hadoop HDFS
  Issue Type: Sub-task
  Components: test
Reporter: Tsz Wo Nicholas Sze
Assignee: Tsz Wo Nicholas Sze
Priority: Minor
 Fix For: 2.7.0

 Attachments: h7738_20150204.patch, h7738_20150205.patch, 
 h7738_20150205b.patch, h7738_20150206.patch


 The following are negative test cases for truncate.
 - new length  old length
 - truncating a directory
 - truncating a non-existing file
 - truncating a file without write permission
 - truncating a file opened for append
 - truncating a file in safemode



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


[jira] [Commented] (HDFS-7738) Add more negative tests for truncate

2015-02-06 Thread Hadoop QA (JIRA)

[ 
https://issues.apache.org/jira/browse/HDFS-7738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14310024#comment-14310024
 ] 

Hadoop QA commented on HDFS-7738:
-

{color:red}-1 overall{color}.  Here are the results of testing the latest 
attachment 
  http://issues.apache.org/jira/secure/attachment/12697079/h7738_20150206.patch
  against trunk revision 1425e3d.

{color:green}+1 @author{color}.  The patch does not contain any @author 
tags.

{color:green}+1 tests included{color}.  The patch appears to include 7 new 
or modified test files.

{color:green}+1 javac{color}.  The applied patch does not increase the 
total number of javac compiler warnings.

{color:green}+1 javadoc{color}.  There were no new javadoc warning messages.

{color:green}+1 eclipse:eclipse{color}.  The patch built with 
eclipse:eclipse.

{color:green}+1 findbugs{color}.  The patch does not introduce any new 
Findbugs (version 2.0.3) warnings.

{color:green}+1 release audit{color}.  The applied patch does not increase 
the total number of release audit warnings.

{color:red}-1 core tests{color}.  The patch failed these unit tests in 
hadoop-hdfs-project/hadoop-hdfs:

  org.apache.hadoop.hdfs.TestHFlush

Test results: 
https://builds.apache.org/job/PreCommit-HDFS-Build/9460//testReport/
Console output: https://builds.apache.org/job/PreCommit-HDFS-Build/9460//console

This message is automatically generated.

 Add more negative tests for truncate
 

 Key: HDFS-7738
 URL: https://issues.apache.org/jira/browse/HDFS-7738
 Project: Hadoop HDFS
  Issue Type: Sub-task
  Components: test
Reporter: Tsz Wo Nicholas Sze
Assignee: Tsz Wo Nicholas Sze
Priority: Minor
 Fix For: 2.7.0

 Attachments: h7738_20150204.patch, h7738_20150205.patch, 
 h7738_20150205b.patch, h7738_20150206.patch


 The following are negative test cases for truncate.
 - new length  old length
 - truncating a directory
 - truncating a non-existing file
 - truncating a file without write permission
 - truncating a file opened for append
 - truncating a file in safemode



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


[jira] [Commented] (HDFS-7738) Add more negative tests for truncate

2015-02-06 Thread Hadoop QA (JIRA)

[ 
https://issues.apache.org/jira/browse/HDFS-7738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14310562#comment-14310562
 ] 

Hadoop QA commented on HDFS-7738:
-

{color:red}-1 overall{color}.  Here are the results of testing the latest 
attachment 
  http://issues.apache.org/jira/secure/attachment/12697209/h7738_20150206c.patch
  against trunk revision 8de80ff.

{color:green}+1 @author{color}.  The patch does not contain any @author 
tags.

{color:green}+1 tests included{color}.  The patch appears to include 8 new 
or modified test files.

{color:green}+1 javac{color}.  The applied patch does not increase the 
total number of javac compiler warnings.

{color:green}+1 javadoc{color}.  There were no new javadoc warning messages.

{color:green}+1 eclipse:eclipse{color}.  The patch built with 
eclipse:eclipse.

{color:green}+1 findbugs{color}.  The patch does not introduce any new 
Findbugs (version 2.0.3) warnings.

{color:green}+1 release audit{color}.  The applied patch does not increase 
the total number of release audit warnings.

{color:red}-1 core tests{color}.  The patch failed these unit tests in 
hadoop-hdfs-project/hadoop-hdfs:

  org.apache.hadoop.cli.TestHDFSCLI

Test results: 
https://builds.apache.org/job/PreCommit-HDFS-Build/9482//testReport/
Console output: https://builds.apache.org/job/PreCommit-HDFS-Build/9482//console

This message is automatically generated.

 Add more negative tests for truncate
 

 Key: HDFS-7738
 URL: https://issues.apache.org/jira/browse/HDFS-7738
 Project: Hadoop HDFS
  Issue Type: Sub-task
  Components: test
Reporter: Tsz Wo Nicholas Sze
Assignee: Tsz Wo Nicholas Sze
Priority: Minor
 Fix For: 2.7.0

 Attachments: h7738_20150204.patch, h7738_20150205.patch, 
 h7738_20150205b.patch, h7738_20150206.patch, h7738_20150206b.patch, 
 h7738_20150206c.patch


 The following are negative test cases for truncate.
 - new length  old length
 - truncating a directory
 - truncating a non-existing file
 - truncating a file without write permission
 - truncating a file opened for append
 - truncating a file in safemode



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


[jira] [Commented] (HDFS-7738) Add more negative tests for truncate

2015-02-06 Thread Konstantin Shvachko (JIRA)

[ 
https://issues.apache.org/jira/browse/HDFS-7738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14310394#comment-14310394
 ] 

Konstantin Shvachko commented on HDFS-7738:
---

# Since you kept TestHAAppend in the patch I'd suggest to simplify 
{{randomFilePartition()}}. Something like
{code}
  public static int[] randomFilePartition(int n, int parts) {
assert n  parts : n= + n +  should exceed parts= + parts;
int[] p = new int[parts];
for(int i=0, left=0, right=n-parts; i  parts; left=p[i], right++, i++) {
  p[i] = nextInt(right - left) + left;
}
return p;
  }
{code}
# We also need to log the partitions somewhere to be able to reproduce if 
something fails.
# The test is consistently passing now.

 I think it is good enough. Agree?

I will not argue. But I do not support your preoccupation with random tests, as 
they introduce non-determinism. Random mix of operations is very good as a 
stand alone application, which you can run overnight or for a few days. Such 
apps can be incorporated say with BigTop, but they make poor unit tests, imho.

 Add more negative tests for truncate
 

 Key: HDFS-7738
 URL: https://issues.apache.org/jira/browse/HDFS-7738
 Project: Hadoop HDFS
  Issue Type: Sub-task
  Components: test
Reporter: Tsz Wo Nicholas Sze
Assignee: Tsz Wo Nicholas Sze
Priority: Minor
 Fix For: 2.7.0

 Attachments: h7738_20150204.patch, h7738_20150205.patch, 
 h7738_20150205b.patch, h7738_20150206.patch, h7738_20150206b.patch


 The following are negative test cases for truncate.
 - new length  old length
 - truncating a directory
 - truncating a non-existing file
 - truncating a file without write permission
 - truncating a file opened for append
 - truncating a file in safemode



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


[jira] [Commented] (HDFS-7738) Add more negative tests for truncate

2015-02-06 Thread Hadoop QA (JIRA)

[ 
https://issues.apache.org/jira/browse/HDFS-7738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14310425#comment-14310425
 ] 

Hadoop QA commented on HDFS-7738:
-

{color:red}-1 overall{color}.  Here are the results of testing the latest 
attachment 
  http://issues.apache.org/jira/secure/attachment/12697147/h7738_20150206b.patch
  against trunk revision da2fb2b.

{color:green}+1 @author{color}.  The patch does not contain any @author 
tags.

{color:green}+1 tests included{color}.  The patch appears to include 8 new 
or modified test files.

{color:green}+1 javac{color}.  The applied patch does not increase the 
total number of javac compiler warnings.

{color:green}+1 javadoc{color}.  There were no new javadoc warning messages.

{color:green}+1 eclipse:eclipse{color}.  The patch built with 
eclipse:eclipse.

{color:green}+1 findbugs{color}.  The patch does not introduce any new 
Findbugs (version 2.0.3) warnings.

{color:green}+1 release audit{color}.  The applied patch does not increase 
the total number of release audit warnings.

{color:red}-1 core tests{color}.  The patch failed these unit tests in 
hadoop-hdfs-project/hadoop-hdfs:

  org.apache.hadoop.hdfs.TestEncryptedTransfer
  org.apache.hadoop.hdfs.server.balancer.TestBalancer

Test results: 
https://builds.apache.org/job/PreCommit-HDFS-Build/9470//testReport/
Console output: https://builds.apache.org/job/PreCommit-HDFS-Build/9470//console

This message is automatically generated.

 Add more negative tests for truncate
 

 Key: HDFS-7738
 URL: https://issues.apache.org/jira/browse/HDFS-7738
 Project: Hadoop HDFS
  Issue Type: Sub-task
  Components: test
Reporter: Tsz Wo Nicholas Sze
Assignee: Tsz Wo Nicholas Sze
Priority: Minor
 Fix For: 2.7.0

 Attachments: h7738_20150204.patch, h7738_20150205.patch, 
 h7738_20150205b.patch, h7738_20150206.patch, h7738_20150206b.patch, 
 h7738_20150206c.patch


 The following are negative test cases for truncate.
 - new length  old length
 - truncating a directory
 - truncating a non-existing file
 - truncating a file without write permission
 - truncating a file opened for append
 - truncating a file in safemode



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


[jira] [Commented] (HDFS-7738) Add more negative tests for truncate

2015-02-05 Thread Konstantin Shvachko (JIRA)

[ 
https://issues.apache.org/jira/browse/HDFS-7738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14306822#comment-14306822
 ] 

Konstantin Shvachko commented on HDFS-7738:
---

Hey Nicholas, agreed more test cases is a good idea.
Few comments on the patch:
# I would wrap the {{op}} parameter in {{recoverLeaseInternal()}} as {{enum}} 
rather than passing an arbitrary string.
# The if-esle statement in {{testBasicTruncate()}} can be replaced with a 
single assert
{code}
assertEquals(File is expected to be closed only for truncates to the block 
boundary,
 isReady, (toTruncate == 0 || newLength % BLOCK_SIZE == 0));
{code}
I think comments in asserts are important.
# Why extra bracket blocks in {{testTruncateFailure()}}? I don't think freeing 
local variables worth it.
# In {{testTruncateFailure()}} you should probably handle 
{{InterruptedException}} rather than passing it through the test case.

 Add more negative tests for truncate
 

 Key: HDFS-7738
 URL: https://issues.apache.org/jira/browse/HDFS-7738
 Project: Hadoop HDFS
  Issue Type: Sub-task
  Components: test
Reporter: Tsz Wo Nicholas Sze
Assignee: Tsz Wo Nicholas Sze
Priority: Minor
 Fix For: 2.7.0

 Attachments: h7738_20150204.patch


 The following are negative test cases for truncate.
 - new length  old length
 - truncating a directory
 - truncating a non-existing file
 - truncating a file without write permission
 - truncating a file opened for append
 - truncating a file in safemode



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


[jira] [Commented] (HDFS-7738) Add more negative tests for truncate

2015-02-05 Thread Konstantin Shvachko (JIRA)

[ 
https://issues.apache.org/jira/browse/HDFS-7738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14308779#comment-14308779
 ] 

Konstantin Shvachko commented on HDFS-7738:
---

# {{RecoverLeaseOp}} should be static
# Unused import Assert in {{TestSafeMode}}
# It seems that all test cases of {{testMultipleTruncate()}} are already 
covered in {{testBasicTruncate()}}, and in deterministic way. I would remove 
it. Unless random truncates increase your confidence.
# {{TestHAAppend}} changes look like a complete refactoring of the test. It is 
not necessary, but would've been fine with me if it was not failing. Ran it 
several times, failed every time. It would be OK to move it to another jira if 
you wish. I did not expect so many changes.

 Add more negative tests for truncate
 

 Key: HDFS-7738
 URL: https://issues.apache.org/jira/browse/HDFS-7738
 Project: Hadoop HDFS
  Issue Type: Sub-task
  Components: test
Reporter: Tsz Wo Nicholas Sze
Assignee: Tsz Wo Nicholas Sze
Priority: Minor
 Fix For: 2.7.0

 Attachments: h7738_20150204.patch, h7738_20150205.patch, 
 h7738_20150205b.patch


 The following are negative test cases for truncate.
 - new length  old length
 - truncating a directory
 - truncating a non-existing file
 - truncating a file without write permission
 - truncating a file opened for append
 - truncating a file in safemode



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


[jira] [Commented] (HDFS-7738) Add more negative tests for truncate

2015-02-05 Thread Hadoop QA (JIRA)

[ 
https://issues.apache.org/jira/browse/HDFS-7738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14308616#comment-14308616
 ] 

Hadoop QA commented on HDFS-7738:
-

{color:green}+1 overall{color}.  Here are the results of testing the latest 
attachment 
  http://issues.apache.org/jira/secure/attachment/12696961/h7738_20150205b.patch
  against trunk revision 9d91069.

{color:green}+1 @author{color}.  The patch does not contain any @author 
tags.

{color:green}+1 tests included{color}.  The patch appears to include 7 new 
or modified test files.

{color:green}+1 javac{color}.  The applied patch does not increase the 
total number of javac compiler warnings.

{color:green}+1 javadoc{color}.  There were no new javadoc warning messages.

{color:green}+1 eclipse:eclipse{color}.  The patch built with 
eclipse:eclipse.

{color:green}+1 findbugs{color}.  The patch does not introduce any new 
Findbugs (version 2.0.3) warnings.

{color:green}+1 release audit{color}.  The applied patch does not increase 
the total number of release audit warnings.

{color:green}+1 core tests{color}.  The patch passed unit tests in .

Test results: 
https://builds.apache.org/job/PreCommit-HDFS-Build/9453//testReport/
Console output: https://builds.apache.org/job/PreCommit-HDFS-Build/9453//console

This message is automatically generated.

 Add more negative tests for truncate
 

 Key: HDFS-7738
 URL: https://issues.apache.org/jira/browse/HDFS-7738
 Project: Hadoop HDFS
  Issue Type: Sub-task
  Components: test
Reporter: Tsz Wo Nicholas Sze
Assignee: Tsz Wo Nicholas Sze
Priority: Minor
 Fix For: 2.7.0

 Attachments: h7738_20150204.patch, h7738_20150205.patch, 
 h7738_20150205b.patch


 The following are negative test cases for truncate.
 - new length  old length
 - truncating a directory
 - truncating a non-existing file
 - truncating a file without write permission
 - truncating a file opened for append
 - truncating a file in safemode



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


[jira] [Commented] (HDFS-7738) Add more negative tests for truncate

2015-02-05 Thread Konstantin Shvachko (JIRA)

[ 
https://issues.apache.org/jira/browse/HDFS-7738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14306851#comment-14306851
 ] 

Konstantin Shvachko commented on HDFS-7738:
---

For  truncate tests with HA it should be easy to add the case into 
TestHAAppend. Just create a second file there {{fileToTruncate}}, truncate it 5 
times. The rest should be checked by fsck as in the test.
Would you like to incorporate it in your patch or should we open another jira?

 Add more negative tests for truncate
 

 Key: HDFS-7738
 URL: https://issues.apache.org/jira/browse/HDFS-7738
 Project: Hadoop HDFS
  Issue Type: Sub-task
  Components: test
Reporter: Tsz Wo Nicholas Sze
Assignee: Tsz Wo Nicholas Sze
Priority: Minor
 Fix For: 2.7.0

 Attachments: h7738_20150204.patch


 The following are negative test cases for truncate.
 - new length  old length
 - truncating a directory
 - truncating a non-existing file
 - truncating a file without write permission
 - truncating a file opened for append
 - truncating a file in safemode



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


[jira] [Commented] (HDFS-7738) Add more negative tests for truncate

2015-02-05 Thread Tsz Wo Nicholas Sze (JIRA)

[ 
https://issues.apache.org/jira/browse/HDFS-7738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14308317#comment-14308317
 ] 

Tsz Wo Nicholas Sze commented on HDFS-7738:
---

h7738_20150205.patch:
- adds RecoverLeaseOp;
- uses assertEquals as suggested
- changes DFSTestUtil.getFileSystemAs to not throwing InterruptedException
- moves safemode test to TestSafeMode
- adds truncate tests with HA

Konstantin, thanks for the review.  I incorporated all your comments except #3 
since I like to reuse the variable names.  Logically, they are separated test 
cases.

For the HA test, it cannot truncate for 5 times unless truncating at block 
boundaries since the file is not ready (it is under recovery.)

 Add more negative tests for truncate
 

 Key: HDFS-7738
 URL: https://issues.apache.org/jira/browse/HDFS-7738
 Project: Hadoop HDFS
  Issue Type: Sub-task
  Components: test
Reporter: Tsz Wo Nicholas Sze
Assignee: Tsz Wo Nicholas Sze
Priority: Minor
 Fix For: 2.7.0

 Attachments: h7738_20150204.patch, h7738_20150205.patch


 The following are negative test cases for truncate.
 - new length  old length
 - truncating a directory
 - truncating a non-existing file
 - truncating a file without write permission
 - truncating a file opened for append
 - truncating a file in safemode



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


[jira] [Commented] (HDFS-7738) Add more negative tests for truncate

2015-02-05 Thread Hadoop QA (JIRA)

[ 
https://issues.apache.org/jira/browse/HDFS-7738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14308535#comment-14308535
 ] 

Hadoop QA commented on HDFS-7738:
-

{color:red}-1 overall{color}.  Here are the results of testing the latest 
attachment 
  http://issues.apache.org/jira/secure/attachment/12696913/h7738_20150205.patch
  against trunk revision b77ff37.

{color:green}+1 @author{color}.  The patch does not contain any @author 
tags.

{color:green}+1 tests included{color}.  The patch appears to include 6 new 
or modified test files.

{color:green}+1 javac{color}.  The applied patch does not increase the 
total number of javac compiler warnings.

{color:green}+1 javadoc{color}.  There were no new javadoc warning messages.

{color:green}+1 eclipse:eclipse{color}.  The patch built with 
eclipse:eclipse.

{color:green}+1 findbugs{color}.  The patch does not introduce any new 
Findbugs (version 2.0.3) warnings.

{color:green}+1 release audit{color}.  The applied patch does not increase 
the total number of release audit warnings.

{color:red}-1 core tests{color}.  The patch failed these unit tests in 
hadoop-hdfs-project/hadoop-hdfs:

  org.apache.hadoop.hdfs.TestEncryptedTransfer
  org.apache.hadoop.hdfs.TestHFlush
  org.apache.hadoop.hdfs.server.namenode.ha.TestDFSUpgradeWithHA
  org.apache.hadoop.hdfs.TestFileCreation

  The following test timeouts occurred in 
hadoop-hdfs-project/hadoop-hdfs:

org.apache.hadoop.hdfs.server.namenode.ha.TestStandbyCheckpoints

Test results: 
https://builds.apache.org/job/PreCommit-HDFS-Build/9446//testReport/
Console output: https://builds.apache.org/job/PreCommit-HDFS-Build/9446//console

This message is automatically generated.

 Add more negative tests for truncate
 

 Key: HDFS-7738
 URL: https://issues.apache.org/jira/browse/HDFS-7738
 Project: Hadoop HDFS
  Issue Type: Sub-task
  Components: test
Reporter: Tsz Wo Nicholas Sze
Assignee: Tsz Wo Nicholas Sze
Priority: Minor
 Fix For: 2.7.0

 Attachments: h7738_20150204.patch, h7738_20150205.patch


 The following are negative test cases for truncate.
 - new length  old length
 - truncating a directory
 - truncating a non-existing file
 - truncating a file without write permission
 - truncating a file opened for append
 - truncating a file in safemode



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


[jira] [Commented] (HDFS-7738) Add more negative tests for truncate

2015-02-04 Thread Tsz Wo Nicholas Sze (JIRA)

[ 
https://issues.apache.org/jira/browse/HDFS-7738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14306563#comment-14306563
 ] 

Tsz Wo Nicholas Sze commented on HDFS-7738:
---

Thanks for the quick review.  Since AlreadyBeingCreatedException is in 
org.apache.hadoop.hdfs.protocol, changing is to something else is a bigger 
change which need more thought.  I rather keep this patch simple.  Sounds good?

 Add more negative tests for truncate
 

 Key: HDFS-7738
 URL: https://issues.apache.org/jira/browse/HDFS-7738
 Project: Hadoop HDFS
  Issue Type: Sub-task
  Components: test
Reporter: Tsz Wo Nicholas Sze
Assignee: Tsz Wo Nicholas Sze
Priority: Minor
 Fix For: 2.7.0

 Attachments: h7738_20150204.patch


 The following are negative test cases for truncate.
 - new length  old length
 - truncating a directory
 - truncating a non-existing file
 - truncating a file without write permission
 - truncating a file opened for append
 - truncating a file in safemode



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


[jira] [Commented] (HDFS-7738) Add more negative tests for truncate

2015-02-04 Thread Hadoop QA (JIRA)

[ 
https://issues.apache.org/jira/browse/HDFS-7738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14306717#comment-14306717
 ] 

Hadoop QA commented on HDFS-7738:
-

{color:red}-1 overall{color}.  Here are the results of testing the latest 
attachment 
  http://issues.apache.org/jira/secure/attachment/12696653/h7738_20150204.patch
  against trunk revision 0b567f4.

{color:green}+1 @author{color}.  The patch does not contain any @author 
tags.

{color:green}+1 tests included{color}.  The patch appears to include 1 new 
or modified test files.

{color:green}+1 javac{color}.  The applied patch does not increase the 
total number of javac compiler warnings.

{color:green}+1 javadoc{color}.  There were no new javadoc warning messages.

{color:green}+1 eclipse:eclipse{color}.  The patch built with 
eclipse:eclipse.

{color:green}+1 findbugs{color}.  The patch does not introduce any new 
Findbugs (version 2.0.3) warnings.

{color:green}+1 release audit{color}.  The applied patch does not increase 
the total number of release audit warnings.

{color:red}-1 core tests{color}.  The patch failed these unit tests in 
hadoop-hdfs-project/hadoop-hdfs:

  org.apache.hadoop.hdfs.TestFileCreation

Test results: 
https://builds.apache.org/job/PreCommit-HDFS-Build/9436//testReport/
Console output: https://builds.apache.org/job/PreCommit-HDFS-Build/9436//console

This message is automatically generated.

 Add more negative tests for truncate
 

 Key: HDFS-7738
 URL: https://issues.apache.org/jira/browse/HDFS-7738
 Project: Hadoop HDFS
  Issue Type: Sub-task
  Components: test
Reporter: Tsz Wo Nicholas Sze
Assignee: Tsz Wo Nicholas Sze
Priority: Minor
 Fix For: 2.7.0

 Attachments: h7738_20150204.patch


 The following are negative test cases for truncate.
 - new length  old length
 - truncating a directory
 - truncating a non-existing file
 - truncating a file without write permission
 - truncating a file opened for append
 - truncating a file in safemode



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


[jira] [Commented] (HDFS-7738) Add more negative tests for truncate

2015-02-04 Thread Yi Liu (JIRA)

[ 
https://issues.apache.org/jira/browse/HDFS-7738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14306558#comment-14306558
 ] 

Yi Liu commented on HDFS-7738:
--

I notice the patch distinguishes recover lease exception string for 
create/truncate/append/recover file, it's great, I also had the same thought, 
but the exception is still {{AlreadyBeingCreatedException}}, should we redefine 
it?
Besides this, I'm +1 for the patch and pending Jenkins.

 Add more negative tests for truncate
 

 Key: HDFS-7738
 URL: https://issues.apache.org/jira/browse/HDFS-7738
 Project: Hadoop HDFS
  Issue Type: Sub-task
  Components: test
Reporter: Tsz Wo Nicholas Sze
Assignee: Tsz Wo Nicholas Sze
Priority: Minor
 Fix For: 2.7.0

 Attachments: h7738_20150204.patch


 The following are negative test cases for truncate.
 - new length  old length
 - truncating a directory
 - truncating a non-existing file
 - truncating a file without write permission
 - truncating a file opened for append
 - truncating a file in safemode



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


[jira] [Commented] (HDFS-7738) Add more negative tests for truncate

2015-02-04 Thread Yi Liu (JIRA)

[ 
https://issues.apache.org/jira/browse/HDFS-7738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14306573#comment-14306573
 ] 

Yi Liu commented on HDFS-7738:
--

{quote}
I rather keep this patch simple. Sounds good?
{quote}
I'm OK for this. +1. 

{quote}
Since AlreadyBeingCreatedException is in org.apache.hadoop.hdfs.protocol, 
changing is to something else is a bigger change which need more thought
{quote}
Yes, but actually {{AlreadyBeingCreatedException}} is only explicitly thrown by 
{{ClientProtocol#create}} . My thought is we can define a separate recover 
lease exception which extends IOException and let 
{{AlreadyBeingCreatedException}} extends it, otherwise people may see already 
being created exception when he does an append/truncate operation, that's odd. 
Of course, it's a minor improvement, we can also do it in a follow-on JIRA if 
you think it's necessary. 

 Add more negative tests for truncate
 

 Key: HDFS-7738
 URL: https://issues.apache.org/jira/browse/HDFS-7738
 Project: Hadoop HDFS
  Issue Type: Sub-task
  Components: test
Reporter: Tsz Wo Nicholas Sze
Assignee: Tsz Wo Nicholas Sze
Priority: Minor
 Fix For: 2.7.0

 Attachments: h7738_20150204.patch


 The following are negative test cases for truncate.
 - new length  old length
 - truncating a directory
 - truncating a non-existing file
 - truncating a file without write permission
 - truncating a file opened for append
 - truncating a file in safemode



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