zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sékine Coulibaly <scoulib...@gmail.com>
Subject Re: Howto use zkCli.sh with spaces in the data ?
Date Mon, 30 Dec 2013 16:05:12 GMT
Ooops, overlooked the acl, sorry.

The problem with this is that the following would fail :

create /zk/conf/1 '{"name":"O'Connor"}'

Don't you thing generalizing something like the following is more long-term
solution then ? :

cmd -data= -acl=

is something acceptable ? If yes, this will make it possible to parse the
args properly, but we will have to handle both styles for backward
compatibility reasons :(, and generalize it through the wholz zkCli
commands to be consistent.

Let's see if any opinions arise.




2013/12/30 Bharath Vissapragada <bharathv@cloudera.com>

> Yep, I thought of this approach but the problem is that we end up adding
> acl (if the user provides one) to the data. Since we are splitting by
> spaces, there is no way we can know if the user has provided an acl since
> its an optional argument. We should use some other delim that separates
> actual data from acl and other args.
>
>
> On Mon, Dec 30, 2013 at 8:53 PM, Sékine Coulibaly <scoulibaly@gmail.com
> >wrote:
>
> > Another one would be not to use any delimiter, but gather subsequent
> args (
> > args[first+2] + args[first+3] + ... + args[first+last] ) alltogether and
> > use that as the second parameter of create (see L.700 of
> > ZooKeeperMain.java, v3.4.5) since in this version, only 3rd space
> delimited
> > value is used :
> >
> > String newPath = zk.create(path,
> > "all_args_after_and_including_first+2".getBytes(), acl,
> >                     flags);
> >
> > Would allow for not caring about the quotes. However my mind is not clear
> > enough if this would break anything (you wrote about a regex parser ? Are
> > you talking about the arguments parsing in processZKCmd() ? ).
> >
> >
> >
> >
> > 2013/12/30 Bharath Vissapragada <bharathv@cloudera.com>
> >
> > > I wrote a patch that works with inputs like
> > >
> > > create [-s] [-e] znode '<value with spaces enclosed in single quotes>'
> > > [acl]  ( single quote delimiter is configurable, any char other than
> > > space). However the downside is that the value cannot contain the
> > delimiter
> > > for the regex parser to work correctly. Is that hack ok? If yes, I can
> > > submit a patch for that ticket.
> > >
> > >
> > >
> > >
> > > On Mon, Dec 30, 2013 at 6:54 PM, Sékine Coulibaly <
> scoulibaly@gmail.com
> > > >wrote:
> > >
> > > > Flavio,
> > > >
> > > > Yes I still am. Having the zkCli patched is the way to go. Using
> Raul's
> > > > client is more like a workaround.
> > > >
> > > > I start working on it then and will post a diff file here somewhere
> > > during
> > > > next week.
> > > >
> > > > Rgds
> > > >
> > > >
> > > > 2013/12/30 Flavio Junqueira <fpjunqueira@yahoo.com>
> > > >
> > > > > I don't know if you are still interested in working on the patch
> > after
> > > > > trying our Raul's shell, but I'll answer your question regardless.
> > > > >
> > > > > If you have time to work on a patch, it is best that you try to
> patch
> > > the
> > > > > code and propose a diff file. Once you have a patch, we can start
> > > > > discussing the changes and making progress towards a solution that
> > > > > satisfies your requirements.
> > > > >
> > > > > -Flavio
> > > > >
> > > > > On Dec 28, 2013, at 11:43 PM, Sékine Coulibaly <
> scoulibaly@gmail.com
> > >
> > > > > wrote:
> > > > >
> > > > > > Hi Flavio,
> > > > > >
> > > > > > Thanks for you feedback. I searched the JIRA and couldn't find
> any
> > > > > neither.
> > > > > > As a consequence, I opened the following one :
> > > > > > ZOOKEEPER-1853 : zkCli.sh can't issue a CREATE command containing
> > > > spaces
> > > > > in
> > > > > > the data (https://issues.apache.org/jira/browse/ZOOKEEPER-1853).
> > > > > >
> > > > > > Plenty of interest (will find some time!) to help on this. Shall
> I
> > > > > suggest
> > > > > > something, or the usual way you handle this is maintainers first
> > > > > > investigate and suggest a patch strategy ?
> > > > > >
> > > > > > Rgds
> > > > > >
> > > > > > Sekine
> > > > > >
> > > > > >
> > > > > > 2013/12/28 Flavio Junqueira <fpjunqueira@yahoo.com>
> > > > > >
> > > > > >> Hi there,
> > > > > >>
> > > > > >> I'm not aware of any jira issue open for this. If there
isn't
> one
> > > > > already,
> > > > > >> then we could open one and propose a fix. If you have time
and
> > > > interest,
> > > > > >> please feel free to work on a patch for this, I would be
happy
> to
> > > help
> > > > > out
> > > > > >> here.
> > > > > >>
> > > > > >> -Flavio
> > > > > >>
> > > > > >>
> > > > > >> On Dec 28, 2013, at 5:28 PM, Sékine Coulibaly <
> > scoulibaly@gmail.com
> > > >
> > > > > >> wrote:
> > > > > >>
> > > > > >>> I wish I could use ZooKeeper to store json data.
> > > > > >>>
> > > > > >>> My json data contains spaces, eg :
> > > > > >>>
> > > > > >>>   {"country":"CA","name":"De La Salle"}
> > > > > >>>
> > > > > >>> Issuing the following command to zkClient only stores
> > > > > >>> {"id":1,"fullname":"De which is wrong :
> > > > > >>>
> > > > > >>>   create /contacts/1  {"country":"CA","name":"De La
Salle"}
> > > > > >>>
> > > > > >>> The store command seems to be croped after the first
space of
> the
> > > > data
> > > > > >>> payload.
> > > > > >>>
> > > > > >>> From what I can see, this issuehas been raised several
times
> (eg.
> > > > here
> > > > > >>>
> > > > > >>
> > > > >
> > > >
> > >
> >
> http://stackoverflow.com/questions/11408542/zookeeper-cli-read-znode-with-space
> > > > > >>> and
> > > > > >>> here
> > > > > >>>
> > > > > >>
> > > > >
> > > >
> > >
> >
> http://zookeeper-user.578899.n2.nabble.com/Best-way-to-update-node-using-command-line-td7578581.html
> > > > > >> )
> > > > > >>> but I was unable to find a better workaround than "patch
the
> java
> > > > > client
> > > > > >> by
> > > > > >>> yourself", so that the parameters are not splitted by
a space.
> > > > > >>>
> > > > > >>> Are there any plans to fix this (yes, I suggest this
is some
> kind
> > > of
> > > > > >> bug"),
> > > > > >>> or a working "escaping" trick ?
> > > > > >>>
> > > > > >>> Thank you
> > > > > >>
> > > > > >>
> > > > >
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Bharath Vissapragada
> > > <http://www.cloudera.com>
> > >
> >
>
>
>
> --
> Bharath Vissapragada
> <http://www.cloudera.com>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message