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

[BucketOp] Delete and get behaviour in case of non-existent keys

    XMLWordPrintable

    Details

    • Triage:
      Untriaged
    • Is this a Regression?:
      Unknown

      Description

      In Eventing, when one tries to delete a key which doesn’t exist from a bucket, we throw an exception. This isn’t the case one tries to delete a key from JS object. Thus, we have different behaviour in the language for the same operator.

      As per the standard, none of these 2 operations throw exceptions when dealing with non-existent keys. “get” will return undefined if the key doesn’t exist. This is a bug as we should stay consistent with the host language as far as possible, and there is no good reason to deviate here.

       We may need to ensure backwards compatibility (MB-35944)

        Attachments

          Issue Links

          For Gerrit Dashboard: MB-32244
          # Subject Branch Project Status CR V

            Activity

            Hide
            build-team Couchbase Build Team added a comment -

            Build couchbase-server-7.0.0-1062 contains eventing commit 944bc5d with commit message:
            MB-32244 Add ability to choose language behaviour

            Show
            build-team Couchbase Build Team added a comment - Build couchbase-server-7.0.0-1062 contains eventing commit 944bc5d with commit message: MB-32244 Add ability to choose language behaviour
            Hide
            jon.strabala Jon Strabala added a comment -

            This update breaks previously exported functions via the CLI as the functions no longer import refer to MB-37040

            Show
            jon.strabala Jon Strabala added a comment - This update breaks previously exported functions via the CLI as the functions no longer import refer to  MB-37040
            Hide
            vikas.chaudhary Vikas Chaudhary added a comment -

            Gautham Banasandra  language behaviour for bucket op exception is there since 5.5.0 , we should have version as 5.5.0 and 6.5.0 as it changes from 6.5.0

            Show
            vikas.chaudhary Vikas Chaudhary added a comment - Gautham Banasandra   language behaviour for bucket op exception is there since 5.5.0 , we should have version as 5.5.0 and 6.5.0 as it changes from 6.5.0
            Hide
            jeelan.poola Jeelan Poola added a comment -

            Vikas Chaudhary We have picked the version of Couchbase Server (6.0.0) which is nearest to the version where we are breaking the compatibility (6.5.0). We will keep it this way as most customers are already at 6.0.x. It makes more sense to keep the lang-compat version as 6.0.0 (old behaviour) and 6.5.0 (new behaviour). Hope this helps.

            Show
            jeelan.poola Jeelan Poola added a comment - Vikas Chaudhary We have picked the version of Couchbase Server (6.0.0) which is nearest to the version where we are breaking the compatibility (6.5.0). We will keep it this way as most customers are already at 6.0.x. It makes more sense to keep the lang-compat version as 6.0.0 (old behaviour) and 6.5.0 (new behaviour). Hope this helps.
            Hide
            vikas.chaudhary Vikas Chaudhary added a comment -

            verified the behaviour 6.5.0 and 6.0.0

            Following handler shows the behaviour of the bucket op

            6.0.0
            function OnUpdate(doc, meta) {
                log('docId', meta.id);
                try{
                var doc=dst_bucket[meta.id];
                log('doc:',doc);
                }catch(e){
                    log('error:',e);
                    //var obj=JSON.parse(e);
                    //log(obj);
                    if(e["message"]["name"]=="LCB_KEY_ENOENT"){
                        dst_bucket[meta.id]=e;
                    }
                }
            }
            
            

            6.5.0
            function OnUpdate(doc, meta) {
                log('docId', meta.id);
                try{
                var doc=dst_bucket[meta.id];
                log('doc:',doc);
                if(typeof(doc)=="undefined"){
                    dst_bucket[meta.id]="no doc found";
                }
                }catch(e){
                    log('error:',e);
                }
            } 

            Show
            vikas.chaudhary Vikas Chaudhary added a comment - verified the behaviour 6.5.0 and 6.0.0 Following handler shows the behaviour of the bucket op 6.0.0 function OnUpdate(doc, meta) {     log('docId', meta.id);     try{     var doc=dst_bucket[meta.id];     log('doc:',doc);     }catch(e){         log('error:',e);         //var obj=JSON.parse(e);         //log(obj);         if(e["message"]["name"]=="LCB_KEY_ENOENT"){             dst_bucket[meta.id]=e;         }     } } 6.5.0 function OnUpdate(doc, meta) {     log('docId', meta.id);     try{     var doc=dst_bucket[meta.id];     log('doc:',doc);     if(typeof(doc)=="undefined"){         dst_bucket[meta.id]="no doc found";     }     }catch(e){         log('error:',e);     } }

              People

              Assignee:
              suraj.naik Suraj Naik (Inactive)
              Reporter:
              Gautham.Banasandra Gautham Banasandra (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes

                    PagerDuty