Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-26939

Recursive mutations are not prevented when using N1QL

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 5.5.0
    • 5.5.0
    • eventing
    • Vagrant box
    • Untriaged
    • Unknown

    Description

      I observed that recursive mutations are happening when document is updated via N1QL query which further triggered onUpdate() in handler code

      Sample handler code

      function OnUpdate(doc,meta) {
          try {
              var docId = new Date();
              sleep(1000);
              var insert_ = INSERT INTO `src_bucket` ( KEY, VALUE ) VALUES ( :docId ,:docId);
              insert_.execQuery();
              dst_bucket[docId]=new Date();
          } catch (e) {
              log(e);
          }
      }
       
      function sleep(milliseconds) {
        var start = new Date().getTime();
        for (var i = 0; i < 1e7; i++) {
          if ((new Date().getTime() - start) > milliseconds){
            break;
          }
        }
      }

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Gautham.Banasandra Gautham Banasandra (Inactive)
            vikas.chaudhary Vikas Chaudhary
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty