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

N1QL DML is not preserving expiration set by the SDK

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • bug-backlog
    • 4.0.0
    • query
    • Security Level: Public
    • None
    • 8570 on ubuntu 12 with .net SDK 2.1

    Description

      high level flow----

      • .net app: create a doc with expiry set to 5 mins.
      • update the document with N1QL using update with the document key.
      • read the document metadata from the .net app. the expiry and flags value is gone.

      detailed code
      .net app:

      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Text;
      using System.Threading.Tasks;
      using Couchbase.Core;
      using Couchbase.Configuration;
      using Couchbase;
      using Couchbase.Configuration.Client;
      using System.Configuration;
       
       
      namespace ConsoleApplication4
      {
          class Program
          {
              static void Main(string[] args)
              {
                  var config = new ClientConfiguration
                  {
                      Servers = new List<Uri> { new Uri("http://10.0.0.44:8091/pools") },
                      UseSsl = false,
                      DefaultOperationLifespan = 1000,
                      BucketConfigs = new Dictionary<string, BucketConfiguration>
                      {
                        {"default", new BucketConfiguration
                        {
                            BucketName = "default",
                            UseSsl = false,
                            Password = "",
                            DefaultOperationLifespan = 2000,
                            PoolConfiguration = new PoolConfiguration
                            {
                              MaxSize = 10,
                              MinSize = 5,
                              SendTimeout = 12000
                            }
                        }
                       }
                      }
                  };
       
                  Cluster cbCluster = new Cluster(config);
                  Document<object> cbDoc = new Document<dynamic> { Id = "01", Content = new { a="a", b=1}, Expiry=5*60*1000 };
                  using (var cbBucket = cbCluster.OpenBucket())
                  {
       
                      var upd = cbBucket.Upsert(cbDoc);
                      if (upd.Success)
                      {
                          Console.WriteLine("before N1ql update - Expiry:" + cbDoc.Expiry.ToString());
                          Console.ReadKey();
                      }
       
                      var get = cbBucket.GetDocument<dynamic>("01");
                      if (get.Success)
                      {
                          Console.WriteLine("after N1ql update - Expiry:" + get.Document.Expiry.ToString());
                          Console.ReadKey();
                      }
                  }
       
              }
          }
      }
      

      N1QL Queries:
      run the following at the first readkey()

      • verify the update is successful and the key exists:
        select * from default use keys["01"];
      • update statement to issue
        update default use keys ["01"] SET a="a-updates" returning *;

      Attachments

        Issue Links

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

          Activity

            People

              keshav Keshav Murthy
              cihan Cihan Biyikoglu (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              21 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty