You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-issues@hadoop.apache.org by "Brahma Reddy Battula (JIRA)" <ji...@apache.org> on 2012/05/03 16:58:50 UTC
[jira] [Created] (HDFS-3361) read(long position, byte[] buffer, int
offset, int length) is not behaving as expected
Brahma Reddy Battula created HDFS-3361:
------------------------------------------
Summary: read(long position, byte[] buffer, int offset, int length) is not behaving as expected
Key: HDFS-3361
URL: https://issues.apache.org/jira/browse/HDFS-3361
Project: Hadoop HDFS
Issue Type: Bug
Components: hdfs client
Affects Versions: 2.0.0, 3.0.0
Reporter: Brahma Reddy Battula
Fix For: 2.0.0
Start NN and DN
write a file with size 1024
now try to read file using following api
fsin.read(10, writeBuff, 10, fsin.available())
Here it's returning zero..But actual file length is 1024
*Java Docs provided*
{code}
/**
* Read bytes from the given position in the stream to the given buffer.
*
* @param position position in the input stream to seek
* @param buffer buffer into which data is read
* @param offset offset into the buffer in which data is written
* @param length maximum number of bytes to read
* @return total number of bytes read into the buffer, or <code>-1</code>
* if there is no more data because the end of the stream has been
* reached
*/
public int read(long position, byte[] buffer, int offset, int length)
throws IOException {
return ((PositionedReadable)in).read(position, buffer, offset, length);
}
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (HDFS-3361) read(long position, byte[] buffer,
int offset, int length) is not behaving as expected
Posted by "Brahma Reddy Battula (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HDFS-3361?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Brahma Reddy Battula resolved HDFS-3361.
----------------------------------------
Resolution: Not A Problem
availble method will the actual data that can be read
since in my first call i used available() (gave me full length of file and pos in the stream is updated)
next when i called the available it will return 0 since the pos is incremented and no new data written.
since this is inline with java i feel this is not a problem
> read(long position, byte[] buffer, int offset, int length) is not behaving as expected
> ---------------------------------------------------------------------------------------
>
> Key: HDFS-3361
> URL: https://issues.apache.org/jira/browse/HDFS-3361
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: hdfs client
> Affects Versions: 2.0.0, 3.0.0
> Reporter: Brahma Reddy Battula
> Fix For: 2.0.0
>
>
> Start NN and DN
> write a file with size 1024
> now try to read file using following api
> fsin.read(writeBuff, 1024, fsin.available())..This is retuning correctly as expected.
> fsin.read(10, writeBuff, 10, fsin.available())(this is retunring zero.)
> Here it's returning zero..But actual file length is 1024
>
> *Java Docs provided*
> {code}
> /**
> * Read bytes from the given position in the stream to the given buffer.
> *
> * @param position position in the input stream to seek
> * @param buffer buffer into which data is read
> * @param offset offset into the buffer in which data is written
> * @param length maximum number of bytes to read
> * @return total number of bytes read into the buffer, or <code>-1</code>
> * if there is no more data because the end of the stream has been
> * reached
> */
> public int read(long position, byte[] buffer, int offset, int length)
> throws IOException {
> return ((PositionedReadable)in).read(position, buffer, offset, length);
> }
> {code}
> But If I try with only ->fsin.read(10, writeBuff, 10, fsin.available())(client prog contains only one read method)
> I am getting actual length...I am not sure actual cause..
> Please correct me If I am wrong.........
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (HDFS-3361) read(long position, byte[] buffer,
int offset, int length) is not behaving as expected
Posted by "Suresh Srinivas (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HDFS-3361?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Suresh Srinivas resolved HDFS-3361.
-----------------------------------
Resolution: Invalid
This issue is invalid.
> read(long position, byte[] buffer, int offset, int length) is not behaving as expected
> ---------------------------------------------------------------------------------------
>
> Key: HDFS-3361
> URL: https://issues.apache.org/jira/browse/HDFS-3361
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: hdfs client
> Affects Versions: 2.0.0, 3.0.0
> Reporter: Brahma Reddy Battula
> Fix For: 2.0.0
>
>
> Start NN and DN
> write a file with size 1024
> now try to read file using following api
> fsin.read(writeBuff, 1024, fsin.available())..This is retuning correctly as expected.
> fsin.read(10, writeBuff, 10, fsin.available())(this is retunring zero.)
> Here it's returning zero..But actual file length is 1024
>
> *Java Docs provided*
> {code}
> /**
> * Read bytes from the given position in the stream to the given buffer.
> *
> * @param position position in the input stream to seek
> * @param buffer buffer into which data is read
> * @param offset offset into the buffer in which data is written
> * @param length maximum number of bytes to read
> * @return total number of bytes read into the buffer, or <code>-1</code>
> * if there is no more data because the end of the stream has been
> * reached
> */
> public int read(long position, byte[] buffer, int offset, int length)
> throws IOException {
> return ((PositionedReadable)in).read(position, buffer, offset, length);
> }
> {code}
> But If I try with only ->fsin.read(10, writeBuff, 10, fsin.available())(client prog contains only one read method)
> I am getting actual length...I am not sure actual cause..
> Please correct me If I am wrong.........
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (HDFS-3361) read(long position, byte[] buffer, int
offset, int length) is not behaving as expected
Posted by "Brahma Reddy Battula (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HDFS-3361?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Brahma Reddy Battula updated HDFS-3361:
---------------------------------------
Description:
Start NN and DN
write a file with size 1024
now try to read file using following api
fsin.read(writeBuff, 1024, fsin.available())..This is retuning correctly as expected.
fsin.read(10, writeBuff, 10, fsin.available())(this is retunring zero.)
Here it's returning zero..But actual file length is 1024
*Java Docs provided*
{code}
/**
* Read bytes from the given position in the stream to the given buffer.
*
* @param position position in the input stream to seek
* @param buffer buffer into which data is read
* @param offset offset into the buffer in which data is written
* @param length maximum number of bytes to read
* @return total number of bytes read into the buffer, or <code>-1</code>
* if there is no more data because the end of the stream has been
* reached
*/
public int read(long position, byte[] buffer, int offset, int length)
throws IOException {
return ((PositionedReadable)in).read(position, buffer, offset, length);
}
{code}
But If I try with only ->fsin.read(10, writeBuff, 10, fsin.available())(client prog contains only one read method)
I am getting actual length...I am not sure actual cause..
Please correct me If I am wrong.........
was:
Start NN and DN
write a file with size 1024
now try to read file using following api
fsin.read(10, writeBuff, 10, fsin.available())
Here it's returning zero..But actual file length is 1024
*Java Docs provided*
{code}
/**
* Read bytes from the given position in the stream to the given buffer.
*
* @param position position in the input stream to seek
* @param buffer buffer into which data is read
* @param offset offset into the buffer in which data is written
* @param length maximum number of bytes to read
* @return total number of bytes read into the buffer, or <code>-1</code>
* if there is no more data because the end of the stream has been
* reached
*/
public int read(long position, byte[] buffer, int offset, int length)
throws IOException {
return ((PositionedReadable)in).read(position, buffer, offset, length);
}
{code}
> read(long position, byte[] buffer, int offset, int length) is not behaving as expected
> ---------------------------------------------------------------------------------------
>
> Key: HDFS-3361
> URL: https://issues.apache.org/jira/browse/HDFS-3361
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: hdfs client
> Affects Versions: 2.0.0, 3.0.0
> Reporter: Brahma Reddy Battula
> Fix For: 2.0.0
>
>
> Start NN and DN
> write a file with size 1024
> now try to read file using following api
> fsin.read(writeBuff, 1024, fsin.available())..This is retuning correctly as expected.
> fsin.read(10, writeBuff, 10, fsin.available())(this is retunring zero.)
> Here it's returning zero..But actual file length is 1024
>
> *Java Docs provided*
> {code}
> /**
> * Read bytes from the given position in the stream to the given buffer.
> *
> * @param position position in the input stream to seek
> * @param buffer buffer into which data is read
> * @param offset offset into the buffer in which data is written
> * @param length maximum number of bytes to read
> * @return total number of bytes read into the buffer, or <code>-1</code>
> * if there is no more data because the end of the stream has been
> * reached
> */
> public int read(long position, byte[] buffer, int offset, int length)
> throws IOException {
> return ((PositionedReadable)in).read(position, buffer, offset, length);
> }
> {code}
> But If I try with only ->fsin.read(10, writeBuff, 10, fsin.available())(client prog contains only one read method)
> I am getting actual length...I am not sure actual cause..
> Please correct me If I am wrong.........
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Reopened] (HDFS-3361) read(long position, byte[] buffer,
int offset, int length) is not behaving as expected
Posted by "Suresh Srinivas (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HDFS-3361?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Suresh Srinivas reopened HDFS-3361:
-----------------------------------
> read(long position, byte[] buffer, int offset, int length) is not behaving as expected
> ---------------------------------------------------------------------------------------
>
> Key: HDFS-3361
> URL: https://issues.apache.org/jira/browse/HDFS-3361
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: hdfs client
> Affects Versions: 2.0.0, 3.0.0
> Reporter: Brahma Reddy Battula
> Fix For: 2.0.0
>
>
> Start NN and DN
> write a file with size 1024
> now try to read file using following api
> fsin.read(writeBuff, 1024, fsin.available())..This is retuning correctly as expected.
> fsin.read(10, writeBuff, 10, fsin.available())(this is retunring zero.)
> Here it's returning zero..But actual file length is 1024
>
> *Java Docs provided*
> {code}
> /**
> * Read bytes from the given position in the stream to the given buffer.
> *
> * @param position position in the input stream to seek
> * @param buffer buffer into which data is read
> * @param offset offset into the buffer in which data is written
> * @param length maximum number of bytes to read
> * @return total number of bytes read into the buffer, or <code>-1</code>
> * if there is no more data because the end of the stream has been
> * reached
> */
> public int read(long position, byte[] buffer, int offset, int length)
> throws IOException {
> return ((PositionedReadable)in).read(position, buffer, offset, length);
> }
> {code}
> But If I try with only ->fsin.read(10, writeBuff, 10, fsin.available())(client prog contains only one read method)
> I am getting actual length...I am not sure actual cause..
> Please correct me If I am wrong.........
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira