[
https://issues.apache.org/jira/browse/MINIFICPP-1644?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Martin Zink updated MINIFICPP-1644:
-----------------------------------
Description:
The ProcessSession::read will read until the resource claims size, not the
flowfiles size.
If the flowfiles size/offset doesnt match the size/offset of its resource
claim, this could cause problems. One way this could happend is using the
_ProcessSession::clone(const std::shared_ptr<core::FlowFile> &parent, int64_t
offset, int64_t size)_
The behaviour is also dependant on the type of ContentRepository
e.g.
using FileSystemContentRepository or VolatileContentRepository
{code:java}
auto first_half_clone = session->clone(original_ff, 0,
original_ff->getSize()/2);
auto second_half_clone = session->clone(original_ff, original_ff->getSize()/2,
original_ff->getSize()/2);
session->read(original_ff, reader); // Reads foobar
session->read(first_half_clone, reader); // Reads foobar expected foo
session->read(second_half_clone, reader); // Reads bar
{code}
using DatabaseContentRepository
{code:java}
auto first_half_clone = session->clone(original_ff, 0,
original_ff->getSize()/2);
auto second_half_clone = session->clone(original_ff, original_ff->getSize()/2,
original_ff->getSize()/2);
session->read(original_ff, reader); // Reads foobar
session->read(first_half_clone, reader); // Reads foobar expected foo
session->read(second_half_clone, reader); // Reads foobar expected bar{code}
was:
The ProcessSession::read will read until the resource claims size, not the
flowfiles size.
If the flowfiles size/offset doesnt match the size/offset of its resource
claim, this could cause problems. One way this could happend is using the
_ProcessSession::clone(const std::shared_ptr<core::FlowFile> &parent, int64_t
offset, int64_t size)_
The behaviour is also dependant on the type of ContentRepository
e.g.
using FileSystemContentRepository or VolatileContentRepository
{code:java}
auto first_half_clone = session->clone(original_ff, 0,
original_ff->getSize()/2);
auto second_half_clone = session->clone(original_ff, original_ff->getSize()/2,
original_ff->getSize()/2);
session->read(original_ff, reader); // Reads foobar
session->read(first_half_clone, reader); // Reads foobar
session->read(second_half_clone, reader); // Reads bar
{code}
using DatabaseContentRepository
{code:java}
auto first_half_clone = session->clone(original_ff, 0,
original_ff->getSize()/2);
auto second_half_clone = session->clone(original_ff, original_ff->getSize()/2,
original_ff->getSize()/2);
session->read(original_ff, reader); // Reads foobar
session->read(first_half_clone, reader); // Reads foobar
session->read(second_half_clone, reader); // Reads foobar{code}
> ProcessSession::read ignores the size/offset of the flowfile
> ------------------------------------------------------------
>
> Key: MINIFICPP-1644
> URL: https://issues.apache.org/jira/browse/MINIFICPP-1644
> Project: Apache NiFi MiNiFi C++
> Issue Type: Improvement
> Reporter: Martin Zink
> Assignee: Martin Zink
> Priority: Minor
>
>
> The ProcessSession::read will read until the resource claims size, not the
> flowfiles size.
> If the flowfiles size/offset doesnt match the size/offset of its resource
> claim, this could cause problems. One way this could happend is using the
> _ProcessSession::clone(const std::shared_ptr<core::FlowFile> &parent, int64_t
> offset, int64_t size)_
> The behaviour is also dependant on the type of ContentRepository
> e.g.
> using FileSystemContentRepository or VolatileContentRepository
> {code:java}
> auto first_half_clone = session->clone(original_ff, 0,
> original_ff->getSize()/2);
> auto second_half_clone = session->clone(original_ff,
> original_ff->getSize()/2, original_ff->getSize()/2);
> session->read(original_ff, reader); // Reads foobar
> session->read(first_half_clone, reader); // Reads foobar expected foo
> session->read(second_half_clone, reader); // Reads bar
> {code}
> using DatabaseContentRepository
> {code:java}
> auto first_half_clone = session->clone(original_ff, 0,
> original_ff->getSize()/2);
> auto second_half_clone = session->clone(original_ff,
> original_ff->getSize()/2, original_ff->getSize()/2);
> session->read(original_ff, reader); // Reads foobar
> session->read(first_half_clone, reader); // Reads foobar expected foo
> session->read(second_half_clone, reader); // Reads foobar expected bar{code}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)