a weird error while post request to server for store object

Christopher Mancini cmancini at basho.com
Mon Sep 12 07:57:31 EDT 2016


Hi Alan,

So, the quick answer, is that CRDTs and secondary indexes are not supported
on riak-ts at the moment which explains why you are getting errors. To
complete the example you were working on, you would need to run it against
riak-kv.

The long answer is our goal is to have TS and KV merged together so you can
have the features of both on one instance of Riak but unfortunately I do
not have a timeline for when that will be available.

Chris

On Wed, Sep 7, 2016 at 9:43 PM HQS^∞^ <hqsoft at qq.com> wrote:

> Hi Luke :
>            I'm sorry , I did not say clear my develop environment which I
> mentioned. I deployed three riak-ts server(at least version 1.3) in
> separate vmware virtual machine , PHP Client Libaray version is 2.0  and
> the riak-ts version is 1.3.0.
>
> Regards
>                                                                    Alan
>
> ------------------ 原始邮件 ------------------
> *发件人:* "Luke Bakken";<lbakken at basho.com>;
> *发送时间:* 2016年9月7日(星期三) 晚上9:27
> *收件人:* "HQS^∞^"<hqsoft at qq.com>;
> *抄送:* "riak-users"<riak-users at lists.basho.com>;
> *主题:* Re: a weird error while post request to server for store object
>
> Hello Alan -
>
> Which PHP client library are you using?
>
> --
> Luke Bakken
> Engineer
> lbakken at basho.com
>
> On Tue, Sep 6, 2016 at 10:29 PM, HQS^∞^ <hqsoft at qq.com> wrote:
> > dear everyone:
> >         I follow the tutorial at
> > http://docs.basho.com/riak/kv/2.1.4/developing/usage/document-store/   ,
> > Step by Step Practice  , when I've Post a request for store object , but
> the
> > riak server respond 400 (Bad Request)  ,  I review my code again and
> again ,
> > but  no problem found . see below:
> >
> > <?php
> >
> >
> > class BlogPost {
> >  var  $_title = '';
> >  var  $_author = '';
> >  var  $_content = '';
> >  var  $_keywords = [];
> >  var  $_datePosted = '';
> >  var  $_published = false;
> >  var  $_bucketType = "cms";
> >  var  $_bucket = null;
> >  var  $_riak = null;
> >  var  $_location = null;
> >   public function __construct(Riak $riak, $bucket, $title, $author,
> > $content, array $keywords, $date, $published)
> >   {
> >     $this->_riak = $riak;
> >     $this->_bucket = new Bucket($bucket, "cms");
> >     $this->_location = new Riak\Location('blog1',$this->_bucket,"cms");
> >     $this->_title = $title;
> >     $this->_author = $author;
> >     $this->_content = $content;
> >     $this->_keywords = $keywords;
> >     $this->_datePosted = $date;
> >     $this->_published = $published;
> >   }
> >
> >   public function store()
> >   {
> >     $setBuilder = (new UpdateSet($this->_riak));
> >
> >     foreach($this->_keywords as $keyword) {
> >       $setBuilder->add($keyword);
> >     }
> > /*
> >    (new UpdateMap($this->_riak))
> >       ->updateRegister('title', $this->_title)
> >       ->updateRegister('author', $this->_author)
> >       ->updateRegister('content', $this->_content)
> >       ->updateRegister('date', $this->_datePosted)
> >       ->updateFlag('published', $this->_published)
> >       ->updateSet('keywords', $setBuilder)
> >       ->withBucket($this->_bucket)
> >       ->build()
> >       ->execute();
> >
> > */
> >    $response = (new UpdateMap($this->_riak))
> >       ->updateRegister('title', $this->_title)
> >       ->updateRegister('author', $this->_author)
> >       ->updateRegister('content', $this->_content)
> >       ->updateRegister('date', $this->_datePosted)
> >       ->updateFlag('published', $this->_published)
> >       ->updateSet('keywords', $setBuilder)
> >       ->atLocation($this->_location)
> >       ->build()
> >       ->execute();
> >
> >     echo '</br>';
> >       var_dump($response);
> >         echo '</br>';
> >   }
> > }
> >
> >  $node = (new Node\Builder)
> >     ->atHost('192.168.111.2')
> >     ->onPort(8098)
> >     ->build();
> >
> >     $riak = new Riak([$node]);
> >
> >
> > $keywords = ['adorbs', 'cheshire'];
> > $date = new \DateTime('now');
> >
> >
> > $post1 = new BlogPost(
> >   $riak,
> >   'cat_pics', // bucket
> >   'This one is so lulz!', // title
> >   'Cat Stevens', // author
> >   'Please check out these cat pics!', // content
> >   $keywords, // keywords
> >   $date, // date posted
> >   true // published
> > );
> > $post1->store();
> >
> > the wireshark captured packet :
> >
> >  192.168.171.124(client ip)  =>  192.168.111.2(riak server ip)    HTTP
> > 511    POST /types/cms/buckets/cat_pics/datatypes/alldoc? HTTP/1.1
> > (application/json)
> >  192.168.111.2    192.168.171.124    HTTP    251    HTTP/1.1 400 Bad
> Request
> >
> >  GET http://192.168.111.2:8098//types/cms/buckets/cat_pics/props
> >
> {"props":{"name":"cat_pics","young_vclock":20,"w":"quorum","small_vclock":50,"search_index":"blog_posts","rw":"quorum","r":"quorum","pw":0,"precommit":[],"pr":0,"postcommit":[],"old_vclock":86400,"notfound_ok":true,"n_val":3,"linkfun":{"mod":"riak_kv_wm_link_walker","fun":"mapreduce_linkfun"},"last_write_wins":false,"dw":"quorum","dvv_enabled":true,"chash_keyfun":{"mod":"riak_core_util","fun":"chash_std_keyfun"},"big_vclock":50,"basic_quorum":false,"allow_mult":true,"datatype":"map","active":true,"claimant":"
> node1 at 192.168.111.1"}}
> >
> >        please help me catch the bugs  thanks in advance!
> >
> > regards
> >
> > Alan
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
-- 
Sincerely,

Christopher Mancini
-----------------------------

employee = {
    purpose: solve problems with code,
    phone:    7164625591,
    email:     cmancini at basho.com,
    github:    http://www.github.com/christophermancini
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20160912/a070cb38/attachment-0002.html>


More information about the riak-users mailing list