You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by Jordan Zimmerman <jo...@jordanzimmerman.com> on 2015/05/08 17:58:54 UTC

Create2Request vs CreateRequest

Why was it necessary to define the Create2Request class? It’s exactly the same as CreateRequest. I’m working on ZOOKEEPER-2163 and need to understand the difference/need.

-Jordan



Re: Create2Request vs CreateRequest

Posted by Jordan Zimmerman <jo...@jordanzimmerman.com>.
That’s exactly what I thought. The same could be said of Create and Create2. Yet, Create2Request was made.

-JZ


On May 8, 2015 at 10:27:47 PM, Raúl Gutiérrez Segalés (rgs@itevenworks.net) wrote:

On 8 May 2015 at 15:24, Jordan Zimmerman <jo...@jordanzimmerman.com> wrote:  

> But that could’ve been done with just the new opcode of  
> ZooDefs.OpCode.create2, right? I need to understand if I need a new Request  
> class for the container feature or not.  
>  

Why would you need that for ZOOKEEPER-2163 if you'd just be using a bit  
from flags in CreateRequest:  

class CreateRequest {  
ustring path;  
buffer data;  
vector<org.apache.zookeeper.data.ACL> acl;  
int flags;  
}  

No new request type/class would be needed, no? Since you are just adding a  
new mode (CreateMode.CONTAINER).  


-rgs  


> -Jordan  
>  
>  
>  
> On May 8, 2015 at 4:58:37 PM, Patrick Hunt (phunt@apache.org) wrote:  
>  
> Pretty sure that's why we did it that way. Otw old clients could have  
> issues.  
>  
> Patrick  
>  
> On Fri, May 8, 2015 at 9:40 AM, Chris Nauroth <cn...@hortonworks.com>  
> wrote:  
>  
> > Looking at "git blame zookeeper.jute", I traced the change back to  
> > ZOOKEEPER-1297 (add stat information to create call). Comments in the  
> > jira and corresponding Review Board request indicate that a new  
> > request/response pair was introduced in order to preserve backwards  
> > compatibility with existing clients. Although CreateRequest and  
> > Create2Request are the same, CreateResponse and Create2Response are  
> > different. It looks like new clients sending Create2Request would receive  
> > the new data, but old clients that still send CreateRequest would  
> continue  
> > to receive the old data, thus preserving compatibility.  
> >  
> > Disclaimer: I was not involved with any of this work. I'm just someone  
> > with a git log and a browser pointed at jira. :-) This does appear to be  
> > the rationale for Create2Request though.  
> >  
> > https://issues.apache.org/jira/browse/ZOOKEEPER-1297  
> >  
> >  
> > https://reviews.apache.org/r/7283/  
> >  
> >  
> > --Chris Nauroth  
> >  
> >  
> >  
> >  
> > On 5/8/15, 8:58 AM, "Jordan Zimmerman" <jo...@jordanzimmerman.com>  
> wrote:  
> >  
> > >Why was it necessary to define the Create2Request class? It¹s exactly  
> the  
> > >same as CreateRequest. I¹m working on ZOOKEEPER-2163 and need to  
> > >understand the difference/need.  
> > >  
> > >-Jordan  
> > >  
> > >  
> >  
> >  
>  

Re: Create2Request vs CreateRequest

Posted by Raúl Gutiérrez Segalés <rg...@itevenworks.net>.
On 8 May 2015 at 15:24, Jordan Zimmerman <jo...@jordanzimmerman.com> wrote:

> But that could’ve been done with just the new opcode of
> ZooDefs.OpCode.create2, right? I need to understand if I need a new Request
> class for the container feature or not.
>

Why would you need that for ZOOKEEPER-2163 if you'd just be using a bit
from flags in CreateRequest:

    class CreateRequest {
        ustring path;
        buffer data;
        vector<org.apache.zookeeper.data.ACL> acl;
        int flags;
    }

No new request type/class would be needed, no? Since you are just adding a
new mode (CreateMode.CONTAINER).


-rgs


> -Jordan
>
>
>
> On May 8, 2015 at 4:58:37 PM, Patrick Hunt (phunt@apache.org) wrote:
>
> Pretty sure that's why we did it that way. Otw old clients could have
> issues.
>
> Patrick
>
> On Fri, May 8, 2015 at 9:40 AM, Chris Nauroth <cn...@hortonworks.com>
> wrote:
>
> > Looking at "git blame zookeeper.jute", I traced the change back to
> > ZOOKEEPER-1297 (add stat information to create call). Comments in the
> > jira and corresponding Review Board request indicate that a new
> > request/response pair was introduced in order to preserve backwards
> > compatibility with existing clients. Although CreateRequest and
> > Create2Request are the same, CreateResponse and Create2Response are
> > different. It looks like new clients sending Create2Request would receive
> > the new data, but old clients that still send CreateRequest would
> continue
> > to receive the old data, thus preserving compatibility.
> >
> > Disclaimer: I was not involved with any of this work. I'm just someone
> > with a git log and a browser pointed at jira. :-) This does appear to be
> > the rationale for Create2Request though.
> >
> > https://issues.apache.org/jira/browse/ZOOKEEPER-1297
> >
> >
> > https://reviews.apache.org/r/7283/
> >
> >
> > --Chris Nauroth
> >
> >
> >
> >
> > On 5/8/15, 8:58 AM, "Jordan Zimmerman" <jo...@jordanzimmerman.com>
> wrote:
> >
> > >Why was it necessary to define the Create2Request class? It¹s exactly
> the
> > >same as CreateRequest. I¹m working on ZOOKEEPER-2163 and need to
> > >understand the difference/need.
> > >
> > >-Jordan
> > >
> > >
> >
> >
>

Re: Create2Request vs CreateRequest

Posted by Raúl Gutiérrez Segalés <rg...@itevenworks.net>.
Hi,

On 8 May 2015 at 15:24, Jordan Zimmerman <jo...@jordanzimmerman.com> wrote:

> But that could’ve been done with just the new opcode of
> ZooDefs.OpCode.create2, right? I need to understand if I need a new Request
> class for the container feature or not.
>

It should work, the structs are the same except for the opcode. So for Java
this would be enough:

         h.setType(ZooDefs.OpCode.create2);
-        Create2Request request = new Create2Request();
+        CreateRequest request = new CreateRequest();
         Create2Response response = new Create2Response();

Similarly, for the C library you would have something like:

struct RequestHeader h = { get_xid(), ZOO_CREATE_OP };

instead of:

struct RequestHeader h = { get_xid(), ZOO_CREATE2_OP };


-rgs

Re: Create2Request vs CreateRequest

Posted by Raúl Gutiérrez Segalés <rg...@itevenworks.net>.
On 8 May 2015 at 20:29, Raúl Gutiérrez Segalés <rg...@itevenworks.net> wrote:

> On 8 May 2015 at 16:57, Patrick Hunt <ph...@apache.org> wrote:
>
>> I think it's more a consistency thing than anything.
>>
>
> Hmm, it does lead to some code duplication which makes the
> PrepRequestProcessor considerably longer. I'll propose this patch (written
> by Santtu) in a JIRA:
>
> https://gist.github.com/rgs1/1fd74c4d6e6223696a1a
>

For posterity: https://issues.apache.org/jira/browse/ZOOKEEPER-2187


-rgs

Re: Create2Request vs CreateRequest

Posted by Raúl Gutiérrez Segalés <rg...@itevenworks.net>.
On 8 May 2015 at 16:57, Patrick Hunt <ph...@apache.org> wrote:

> I think it's more a consistency thing than anything.
>

Hmm, it does lead to some code duplication which makes the
PrepRequestProcessor considerably longer. I'll propose this patch (written
by Santtu) in a JIRA:

https://gist.github.com/rgs1/1fd74c4d6e6223696a1a


-rgs



>
> On Fri, May 8, 2015 at 3:24 PM, Jordan Zimmerman <
> jordan@jordanzimmerman.com
> > wrote:
>
> > But that could’ve been done with just the new opcode of
> > ZooDefs.OpCode.create2, right? I need to understand if I need a new
> Request
> > class for the container feature or not.
> >
> > -Jordan
> >
> >
> >
> > On May 8, 2015 at 4:58:37 PM, Patrick Hunt (phunt@apache.org) wrote:
> >
> > Pretty sure that's why we did it that way. Otw old clients could have
> > issues.
> >
> > Patrick
> >
> > On Fri, May 8, 2015 at 9:40 AM, Chris Nauroth <cn...@hortonworks.com>
> > wrote:
> >
> > > Looking at "git blame zookeeper.jute", I traced the change back to
> > > ZOOKEEPER-1297 (add stat information to create call). Comments in the
> > > jira and corresponding Review Board request indicate that a new
> > > request/response pair was introduced in order to preserve backwards
> > > compatibility with existing clients. Although CreateRequest and
> > > Create2Request are the same, CreateResponse and Create2Response are
> > > different. It looks like new clients sending Create2Request would
> > receive
> > > the new data, but old clients that still send CreateRequest would
> > continue
> > > to receive the old data, thus preserving compatibility.
> > >
> > > Disclaimer: I was not involved with any of this work. I'm just someone
> > > with a git log and a browser pointed at jira. :-) This does appear to
> be
> > > the rationale for Create2Request though.
> > >
> > > https://issues.apache.org/jira/browse/ZOOKEEPER-1297
> > >
> > >
> > > https://reviews.apache.org/r/7283/
> > >
> > >
> > > --Chris Nauroth
> > >
> > >
> > >
> > >
> > > On 5/8/15, 8:58 AM, "Jordan Zimmerman" <jo...@jordanzimmerman.com>
> > wrote:
> > >
> > > >Why was it necessary to define the Create2Request class? It¹s exactly
> > the
> > > >same as CreateRequest. I¹m working on ZOOKEEPER-2163 and need to
> > > >understand the difference/need.
> > > >
> > > >-Jordan
> > > >
> > > >
> > >
> > >
> >
> >
>

Re: Create2Request vs CreateRequest

Posted by Patrick Hunt <ph...@apache.org>.
I think it's more a consistency thing than anything.

Patrick

On Fri, May 8, 2015 at 3:24 PM, Jordan Zimmerman <jordan@jordanzimmerman.com
> wrote:

> But that could’ve been done with just the new opcode of
> ZooDefs.OpCode.create2, right? I need to understand if I need a new Request
> class for the container feature or not.
>
> -Jordan
>
>
>
> On May 8, 2015 at 4:58:37 PM, Patrick Hunt (phunt@apache.org) wrote:
>
> Pretty sure that's why we did it that way. Otw old clients could have
> issues.
>
> Patrick
>
> On Fri, May 8, 2015 at 9:40 AM, Chris Nauroth <cn...@hortonworks.com>
> wrote:
>
> > Looking at "git blame zookeeper.jute", I traced the change back to
> > ZOOKEEPER-1297 (add stat information to create call). Comments in the
> > jira and corresponding Review Board request indicate that a new
> > request/response pair was introduced in order to preserve backwards
> > compatibility with existing clients. Although CreateRequest and
> > Create2Request are the same, CreateResponse and Create2Response are
> > different. It looks like new clients sending Create2Request would
> receive
> > the new data, but old clients that still send CreateRequest would
> continue
> > to receive the old data, thus preserving compatibility.
> >
> > Disclaimer: I was not involved with any of this work. I'm just someone
> > with a git log and a browser pointed at jira. :-) This does appear to be
> > the rationale for Create2Request though.
> >
> > https://issues.apache.org/jira/browse/ZOOKEEPER-1297
> >
> >
> > https://reviews.apache.org/r/7283/
> >
> >
> > --Chris Nauroth
> >
> >
> >
> >
> > On 5/8/15, 8:58 AM, "Jordan Zimmerman" <jo...@jordanzimmerman.com>
> wrote:
> >
> > >Why was it necessary to define the Create2Request class? It¹s exactly
> the
> > >same as CreateRequest. I¹m working on ZOOKEEPER-2163 and need to
> > >understand the difference/need.
> > >
> > >-Jordan
> > >
> > >
> >
> >
>
>

Re: Create2Request vs CreateRequest

Posted by Jordan Zimmerman <jo...@jordanzimmerman.com>.
But that could’ve been done with just the new opcode of ZooDefs.OpCode.create2, right? I need to understand if I need a new Request class for the container feature or not.

-Jordan



On May 8, 2015 at 4:58:37 PM, Patrick Hunt (phunt@apache.org) wrote:

Pretty sure that's why we did it that way. Otw old clients could have  
issues.  

Patrick  

On Fri, May 8, 2015 at 9:40 AM, Chris Nauroth <cn...@hortonworks.com>  
wrote:  

> Looking at "git blame zookeeper.jute", I traced the change back to  
> ZOOKEEPER-1297 (add stat information to create call). Comments in the  
> jira and corresponding Review Board request indicate that a new  
> request/response pair was introduced in order to preserve backwards  
> compatibility with existing clients. Although CreateRequest and  
> Create2Request are the same, CreateResponse and Create2Response are  
> different. It looks like new clients sending Create2Request would receive  
> the new data, but old clients that still send CreateRequest would continue  
> to receive the old data, thus preserving compatibility.  
>  
> Disclaimer: I was not involved with any of this work. I'm just someone  
> with a git log and a browser pointed at jira. :-) This does appear to be  
> the rationale for Create2Request though.  
>  
> https://issues.apache.org/jira/browse/ZOOKEEPER-1297  
>  
>  
> https://reviews.apache.org/r/7283/  
>  
>  
> --Chris Nauroth  
>  
>  
>  
>  
> On 5/8/15, 8:58 AM, "Jordan Zimmerman" <jo...@jordanzimmerman.com> wrote:  
>  
> >Why was it necessary to define the Create2Request class? It¹s exactly the  
> >same as CreateRequest. I¹m working on ZOOKEEPER-2163 and need to  
> >understand the difference/need.  
> >  
> >-Jordan  
> >  
> >  
>  
>  

Re: Create2Request vs CreateRequest

Posted by Patrick Hunt <ph...@apache.org>.
Pretty sure that's why we did it that way. Otw old clients could have
issues.

Patrick

On Fri, May 8, 2015 at 9:40 AM, Chris Nauroth <cn...@hortonworks.com>
wrote:

> Looking at "git blame zookeeper.jute", I traced the change back to
> ZOOKEEPER-1297 (add stat information to create call).  Comments in the
> jira and corresponding Review Board request indicate that a new
> request/response pair was introduced in order to preserve backwards
> compatibility with existing clients.  Although CreateRequest and
> Create2Request are the same, CreateResponse and Create2Response are
> different.  It looks like new clients sending Create2Request would receive
> the new data, but old clients that still send CreateRequest would continue
> to receive the old data, thus preserving compatibility.
>
> Disclaimer: I was not involved with any of this work.  I'm just someone
> with a git log and a browser pointed at jira.  :-)  This does appear to be
> the rationale for Create2Request though.
>
> https://issues.apache.org/jira/browse/ZOOKEEPER-1297
>
>
> https://reviews.apache.org/r/7283/
>
>
> --Chris Nauroth
>
>
>
>
> On 5/8/15, 8:58 AM, "Jordan Zimmerman" <jo...@jordanzimmerman.com> wrote:
>
> >Why was it necessary to define the Create2Request class? It¹s exactly the
> >same as CreateRequest. I¹m working on ZOOKEEPER-2163 and need to
> >understand the difference/need.
> >
> >-Jordan
> >
> >
>
>

Re: Create2Request vs CreateRequest

Posted by Chris Nauroth <cn...@hortonworks.com>.
Looking at "git blame zookeeper.jute", I traced the change back to
ZOOKEEPER-1297 (add stat information to create call).  Comments in the
jira and corresponding Review Board request indicate that a new
request/response pair was introduced in order to preserve backwards
compatibility with existing clients.  Although CreateRequest and
Create2Request are the same, CreateResponse and Create2Response are
different.  It looks like new clients sending Create2Request would receive
the new data, but old clients that still send CreateRequest would continue
to receive the old data, thus preserving compatibility.

Disclaimer: I was not involved with any of this work.  I'm just someone
with a git log and a browser pointed at jira.  :-)  This does appear to be
the rationale for Create2Request though.

https://issues.apache.org/jira/browse/ZOOKEEPER-1297


https://reviews.apache.org/r/7283/


--Chris Nauroth




On 5/8/15, 8:58 AM, "Jordan Zimmerman" <jo...@jordanzimmerman.com> wrote:

>Why was it necessary to define the Create2Request class? It¹s exactly the
>same as CreateRequest. I¹m working on ZOOKEEPER-2163 and need to
>understand the difference/need.
>
>-Jordan
>
>