scan_consistency request_plus not working in REST service

Hi guys,

I’ve tried to create a new document and getting it through the n1ql rest interface. I’ve read in a previous posting that the request_plus param is there to prevent the query to get an empty resultset after an insert. Unfortunately it doen’t seem to work for me. Below my code snippet:

      $translation = new Translation();
        $translation->date_created = $this->di->get('time')->format(\DateTime::ISO8601);
        $translation->translation_type_id = $voiceCall->sid;
        $translation->save();

$query = "statement=SELECT * FROM bucket where type = 'translation' order by date_created desc limit 1 &scan_consistency=request_plus";
        
        print "\n".$query."\n\n";
        
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, 'http://myserver:8093/query/service');
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
        curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);        
        $result = curl_exec($ch);
        curl_close($ch);
        
        $resjson = json_decode($result, true);
        if (isset($resjson['errors'])) {
            throw new \CouchbaseException($resjson['errors'][0]['msg'], 999);
        }
                
        print_r($resjson);

Any ideas?

Thanks

Hi,

The scan_consistency for view indexes was implemented after we cut DP4. It will be in our next DP release in a few weeks.

Can you use a sleep delay for now?

-Gerald

Hi Gerald,

thanks for your response. It’s a bit frustrating because it said in the release notes that the scan consistency feature is supported. I’ve wasted an entire day trying to debug this thing because I assumed that it would solve the query problem. I’ll now have to find a workaround because using a sleep timer is not a good practice at all.

Thanks,
Marcel

Hi Marcel,

Let me have my colleagues confirm this on Monday. If the release notes say it is supported, then I misspoke. We will do whatever it takes to get you a version with scan consistency.

Gerald

Hi Marcel,

Scan consistency is not really implemented in DP4 for views. Probably an error in the docs. It is implemented though in the current codebase but won’t be available until the next release.

Cheers,
Manik

Hi guys,

thanks for letting me know. I appreciate your effort. I look forward to the next release :smile:

Cheers,
Marcel

Also FYI, by default if no stale= parameter is specified the view engine assumes stale=update_after. What this means is that the view is updated right after a query. What this means for you is that if you ran the same query twice, you would get the correct results second time around :).

Cheers,
Manik

Hi Manik,

Cool, thanks for letting me know. I’ll give it a try in a second :smile:

Cheers,
Marcel

Hi Gerald,

I just wanted to ask if you know when the next release is coming out?

Cheers,

Marcel

Hi @willewolle, we are expecting it to be in Q2/Q3 at this point but we are gated on the quality of the product so the date may change based on feedback. There will however be a developer preview soon in a few weeks time. So if you have tolerance to play with early builds, you will get the opportunity to do that soon.

Hi Marcel,

The next Developer Preview release, which will be for the whole Couchbase Server 4.0, including N1QL, will be released around mid-April.

Thanks,
Gerald

Hi Gerald,

awesome! Thanks for letting me know guys. I’m about to launch my in-call translation platform by the end of April, so the next DP comes just in time …

Cheers,

Marcel