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

Able to create memcached buckets with invalid arguments in REST API

    XMLWordPrintable

Details

    • Untriaged
    • Centos 64-bit
    • 1
    • No

    Description

      Build: 6.6.0 build 7687

      Scenario:

      Create memcached bucket using the REST API with durability_min_level.

      Observation:

      Bucket creation successful, but the bucket is actually created with durability_min_level=none in the server.

      Expected behavior:

      Bucket creation should fail if min_durability_level != none for memcached bucket

      Testcase:

      epengine.bucket_level_durability.CreateBucketTests:
           test_create_bucket_using_rest,nodes_init=2,bucket_type=memcached,GROUP=P0

      Note: Attaching full pcap capture for reference.

      Attachments

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

        Activity

          ns_server ignores arguments that don't apply to the type of bucket being created. As a result couchbase-cli does some enforcement:

                  if opts.type == "memcached":
                      _deprecated("Memcached buckets are deprecated, please use ephemeral buckets instead")
                      if opts.replica_count is not None:
                          _exitIfErrors(["--bucket-replica cannot be specified for a memcached bucket"])
                      if opts.conflict_resolution is not None:
                          _exitIfErrors(["--conflict-resolution cannot be specified for a memcached bucket"])
                      if opts.replica_indexes is not None:
                          _exitIfErrors(["--enable-index-replica cannot be specified for a memcached bucket"])
                      if opts.priority is not None:
                          _exitIfErrors(["--bucket-priority cannot be specified for a memcached bucket"])
                      if opts.eviction_policy is not None:
                          _exitIfErrors(["--bucket-eviction-policy cannot be specified for a memcached bucket"])
                      if opts.max_ttl is not None:
                          _exitIfErrors(["--max-ttl cannot be specified for a memcached bucket"])
                      if opts.compression_mode is not None:
                          _exitIfErrors(["--compression-mode cannot be specified for a memcached bucket"])
          

          Here's an example using "bucket-eviction-policy".

          stevewatanabe @ ~ $ curl -u Administrator:asdasd http://localhost:9000/pools/default/buckets -d name=hello -d bucketType=memcached -d ramQuotaMB=100 -d bucket-eviction-policy=fullEviction
          stevewatanabe @ ~ $
          

          So this issue is not new and is much bigger than just this one attribute.

          steve.watanabe Steve Watanabe added a comment - ns_server ignores arguments that don't apply to the type of bucket being created. As a result couchbase-cli does some enforcement: if opts. type = = "memcached" : _deprecated( "Memcached buckets are deprecated, please use ephemeral buckets instead" ) if opts.replica_count is not None : _exitIfErrors([ "--bucket-replica cannot be specified for a memcached bucket" ]) if opts.conflict_resolution is not None : _exitIfErrors([ "--conflict-resolution cannot be specified for a memcached bucket" ]) if opts.replica_indexes is not None : _exitIfErrors([ "--enable-index-replica cannot be specified for a memcached bucket" ]) if opts.priority is not None : _exitIfErrors([ "--bucket-priority cannot be specified for a memcached bucket" ]) if opts.eviction_policy is not None : _exitIfErrors([ "--bucket-eviction-policy cannot be specified for a memcached bucket" ]) if opts.max_ttl is not None : _exitIfErrors([ "--max-ttl cannot be specified for a memcached bucket" ]) if opts.compression_mode is not None : _exitIfErrors([ "--compression-mode cannot be specified for a memcached bucket" ]) Here's an example using "bucket-eviction-policy". stevewatanabe @ ~ $ curl -u Administrator:asdasd http://localhost:9000/pools/default/buckets -d name=hello -d bucketType=memcached -d ramQuotaMB=100 -d bucket-eviction-policy=fullEviction stevewatanabe @ ~ $ So this issue is not new and is much bigger than just this one attribute.

          In fact, ns_server looks for applicable attributes and ignores any other ones. Here I specify "thisisnotvalid" and the bucket gets successfully created.

          stevewatanabe @ ~ $ curl -u Administrator:asdasd http://localhost:9000/pools/default/buckets -d name=hello2 -d bucketType=memcached -d ramQuotaMB=100 -d bucket-eviction-policy=fullEviction -d thisisnotvalid=haha
          stevewatanabe @ ~ $
          

          steve.watanabe Steve Watanabe added a comment - In fact, ns_server looks for applicable attributes and ignores any other ones. Here I specify "thisisnotvalid" and the bucket gets successfully created. stevewatanabe @ ~ $ curl -u Administrator:asdasd http://localhost:9000/pools/default/buckets -d name=hello2 -d bucketType=memcached -d ramQuotaMB=100 -d bucket-eviction-policy=fullEviction -d thisisnotvalid=haha stevewatanabe @ ~ $

          People

            Abhijeeth.Nuthan Abhijeeth Nuthan
            ashwin.govindarajulu Ashwin Govindarajulu
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty