|
[
Permlink
| « Hide
]
dhruba borthakur added a comment - 14/Apr/08 08:05 PM
One option for this API would be a new method in the FileSystem.open() that takes in the pathname to be opened (and permissions, etc) and returns an FSDataOutputStream. The next write into this stream will occur at the end of the file.
FileSystem.open currently returns a FSDataInputStream. Clearly, we cannot use an InputStream to do append. I guess we might want to define a new method, say "append", in the FileSystem API.
My mistake. I wanted to that we should create another method called FileSystem.create() with an "append" flag.
I like the name 'append' for this.
public FSDataOutputStream append(Path f) {
return append(f, getDefaultBufferSize(), null);
}
public FSDataOutputStream append(Path f, int bufferSize) {
return append(f, buffersize, null);
}
public abstract FSDataOutputStream append(Path f, int bufferSize, Progressible progress);
+1 on Doug's proposal.
If the path exists and is not being written to, then append() will return a OutputStream to the file. If the path does not exist, then append will generate a IOException. The DFSClient will issue ClientProtocol.append() call to the namenode. If the file was being written to by another writer but it has exceeded the soft-lease period, then the namenode would start a distributed lease recovery. However, it will not make the client wait for the recovery to complete. The namenode will return an AlreadyBeingCreatedException as if the soft-limit has not yet expired. 3250_20080529.patch:
I think you need to add an implementation for FTPFileSystem now too. Otherwise, this looks good to me.
3250_20080530.patch:
+1 overall. Here are the results of testing the latest attachment
http://issues.apache.org/jira/secure/attachment/12383145/3250_20080530.patch against trunk revision 661918. +1 @author. The patch does not contain any @author tags. +1 tests included. The patch appears to include 4 new or modified tests. +1 javadoc. The javadoc tool did not generate any warning messages. +1 javac. The applied patch does not increase the total number of javac compiler warnings. +1 findbugs. The patch does not introduce any new Findbugs warnings. +1 release audit. The applied patch does not increase the total number of release audit warnings. +1 core tests. The patch passed core unit tests. +1 contrib tests. The patch passed contrib unit tests. Test results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/2527/testReport/ This message is automatically generated. I just committed this. Thanks, Nicholas
Integrated in Hadoop-trunk #511 (See http://hudson.zones.apache.org/hudson/job/Hadoop-trunk/511/
Removed release note so as to not confuse folks about whether 1700 is done.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||