[ 
https://issues.apache.org/jira/browse/ASTERIXDB-1929?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16035813#comment-16035813
 ] 

Yingyi Bu commented on ASTERIXDB-1929:
--------------------------------------

OK, I see the point.  The current implementation makes some sense to me now.

Then, my only left concern is the usage of factory -- can we remove 
setAntimatter from the LSMTreeRefrencingTupleWriterFactory, and instead, only 
set/unset antimatter in the tuple writer ?

{noformat}
public class LSMTreeRefrencingTupleWriterFactory implements 
ITreeIndexTupleWriterFactory {
    private static final long serialVersionUID = 1L;

    private final ITreeIndexTupleWriterFactory factory;
    private transient ILSMTreeTupleWriter createdTupleWriter;

    public LSMTreeRefrencingTupleWriterFactory(ITreeIndexTupleWriterFactory 
factory) {
        this.factory = factory;
    }

    @Override
    public ITreeIndexTupleWriter createTupleWriter() {
        createdTupleWriter = (ILSMTreeTupleWriter) factory.createTupleWriter();
        return createdTupleWriter;
    }

    public void setAntimatter(boolean isAntimatter) {
        if (this.createdTupleWriter != null) {
            this.createdTupleWriter.setAntimatter(isAntimatter);
        }
    }
}
{noformat}


> Factor out isAntimatter from TupleWriter and TupleWriterFactory
> ---------------------------------------------------------------
>
>                 Key: ASTERIXDB-1929
>                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-1929
>             Project: Apache AsterixDB
>          Issue Type: Improvement
>          Components: Storage
>            Reporter: Yingyi Bu
>            Assignee: Chen Luo
>
> isAntimatter is a property of the tuple that we're writing, but not a 
> property of the Writer.  Hence, we probably should remove setAntimatter(...) 
> from the TupleWriter.
> Currently, for each tuple write operation, we need to call setAntimatter() in 
> both TupleWriterFactory and TupleWriter.  This is painful and potentially 
> buggy -- a XxxFactory typically is one per NC.
> Instead, we can add a parameter to write tuple method:
> public int writeTuple(ITupleReference tuple, byte[] targetBuf, int targetOff) 
> ->
> public int writeTuple(ITupleReference tuple, byte[] targetBuf, int targetOff, 
> boolean isDelete)



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to