Issue Details (XML | Word | Printable)

Key: HADOOP-4806
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Tsz Wo (Nicholas), SZE
Reporter: Tsz Wo (Nicholas), SZE
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Hadoop Common

HDFS rename does not work correctly if src contains Java regular expression special characters

Created: 09/Dec/08 04:07 AM   Updated: 08/Jul/09 04:43 PM
Return to search
Component/s: None
Affects Version/s: 0.18.2
Fix Version/s: 0.18.3

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works 4806_20081208.patch 2008-12-09 07:08 AM Tsz Wo (Nicholas), SZE 2 kB
Text File Licensed for inclusion in ASF works 4806_20081208_0.18.patch 2008-12-09 08:56 PM Tsz Wo (Nicholas), SZE 14 kB
Text File Licensed for inclusion in ASF works 4806_20081209.patch 2008-12-09 09:45 PM Tsz Wo (Nicholas), SZE 1 kB
Text File Licensed for inclusion in ASF works 4806_20081209_0.18.patch 2008-12-10 08:11 PM Tsz Wo (Nicholas), SZE 14 kB
Issue Links:
Reference

Hadoop Flags: Reviewed
Resolution Date: 10/Dec/08 09:47 PM


 Description  « Hide
For examples,
  1. create a file /a+b/foo but not close it
  2. rename /a+b/foo to /a+b/bar/foo
    Then, the corresponding INodeFileUnderConstruction will be moved from /a+b/foo to /a+b/bar/foo but the lease path remains unchanged.


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Tsz Wo (Nicholas), SZE added a comment - 09/Dec/08 04:11 AM
In LeaseManager.changeLease(...), the variable overwrite is not a regular expression pattern but is used as a regular expression pattern in
final String newpath = oldpath.replaceFirst(overwrite, replaceBy);

Tsz Wo (Nicholas), SZE added a comment - 09/Dec/08 07:08 AM
4806_20081208.patch: fixed string replacement bug.

Tsz Wo (Nicholas), SZE added a comment - 09/Dec/08 07:14 AM
S3FileSystem.renameRecursive(...) also has this problem.

Tsz Wo (Nicholas), SZE added a comment - 09/Dec/08 08:56 PM
4806_20081208_0.18.patch: for 0.18 (added TestRenameWhileOpen)

Hairong Kuang added a comment - 09/Dec/08 09:36 PM
Could we Pattern#quote "overwrite"? I just want to be safe...

Tsz Wo (Nicholas), SZE added a comment - 09/Dec/08 09:45 PM
4806_20081209.patch: using Pattern.quote(..).

Tsz Wo (Nicholas), SZE added a comment - 09/Dec/08 09:45 PM
4806_20081209_0.18.patch: for 0.18

Hairong Kuang added a comment - 09/Dec/08 09:53 PM
+1

Tsz Wo (Nicholas), SZE added a comment - 10/Dec/08 01:47 AM
     [exec] +1 overall.  

     [exec]     +1 @author.  The patch does not contain any @author tags.

     [exec]     +1 tests included.  The patch appears to include 3 new or modified tests.

     [exec]     +1 javadoc.  The javadoc tool did not generate any warning messages.

     [exec]     +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

     [exec]     +1 findbugs.  The patch does not introduce any new Findbugs warnings.

     [exec]     +1 Eclipse classpath. The patch retains Eclipse classpath integrity.

Running tests locally.


Tsz Wo (Nicholas), SZE added a comment - 10/Dec/08 06:30 PM
Only org.apache.hadoop.chukwa.datacollection.adaptor.filetailer.TestStartAtOffset failed and it is not related to this patch.

Tsz Wo (Nicholas), SZE added a comment - 10/Dec/08 08:11 PM
4806_20081209_0.18.patch: the previous file was wrong. Should be this one.

Tsz Wo (Nicholas), SZE added a comment - 10/Dec/08 09:47 PM
I just committed this.

Hudson added a comment - 11/Dec/08 02:19 PM
Integrated in Hadoop-trunk #685 (See http://hudson.zones.apache.org/hudson/job/Hadoop-trunk/685/)
. HDFS rename should not use src path as a regular expression. (szetszwo)

Tsz Wo (Nicholas), SZE added a comment - 12/Jun/09 05:50 PM
It turned out that the first patch is safer. See HADOOP-6017.