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

Optimize processUpsert, processDelete to avoid running hash function when not needed

    XMLWordPrintable

Details

    • Untriaged
    • No

    Description

      processUpsert, processDelete  and processUpsertDelete find the slice to do the operation on by running GetSliceByIndexKey method which runs a hash function on the mutation key. This is done to figure out which SliceId the mutation belongs to. In our current design, we only have one slice per partition. Hence, running of hash function is unnecessary when numSlices = 1. 

      GetSliceIdByIndexKey can be optimized to skip running the hash function, along the lines of:
      func (sc *HashedSliceContainer) GetSliceIdByIndexKey(key common.IndexKey) SliceId {

      if sc.NumSlices == 1 {
      return SliceId(0)
      }

      //run hash function on index key and return slice id
      hash := crc32.ChecksumIEEE([]byte(key))
      sliceId := int(hash) % sc.NumSlices

      return SliceId(sliceId)
      }

      Attachments

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

        Activity

          People

            sai.teja Sai Krishna Teja
            prathibha Prathibha Bisarahalli (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty