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

Checkpoint expelling can skip expellable items

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 6.5.1
    • 6.5.0
    • couchbase-bucket
    • None
    • Triaged
    • No

    Description

      Summary

      The checkpoint expelling code added in Mad-Hatter can fail to expel an item from a Checkpoint if there's only 1 candidate item to expel.

      This can result in increased memory usage (see MB-37294), which is more significant for large Documents / small memory quotas.

      (Separated out from MB-37294.)

      Steps to Reproduce
      Difficult to precisely trigger this scenario in full-stack tests, however you want to attempt to end up with a Checkpoint as follows, and then have expelling be attempted:

      CheckpointManager[0x105dfa740] with numItems:3 checkpoints:1
          Checkpoint[0x105f3b000] with id:1 seqno:{1001,1002} snap:{0,1002, visible:1002} state:CHECKPOINT_OPEN numCursors:1 type:Memory hcs:-- items:[
      	{1001,empty,cid:0x1:empty,110,[m]}
      	{1001,checkpoint_start,cid:0x1:checkpoint_start,121,[m]}
      	{1001,mutation,cid:0x0:key0,109,}
      	{1002,mutation,cid:0x0:key1,109,}
      ]
          cursors:[
              persistence: CheckpointCursor[0x105c5d998] with name:persistence currentCkpt:{id:1 state:CHECKPOINT_OPEN} currentPos:1002
          ]
      

      • Two adjacent mutations (at seqnos 1001 and 1002).
      • The the first mutation shares its seqno with the remainder of the items in the checkpoint (here with meta-items checkpoint_start & empty).

      Note that checkpoint state can be examined via:

      cbstats localhost:11210 -u Administrator -p <PASSWORD> raw "_checkpoint-dump <VBID>
      

      Any set regular workload under DGM (e.g. pillowfight) should trigger this.

      Expected Results
      Such checkpoints should allow all but the last item (1002) to be expelled:

      CheckpointManager[0x105efb740] with numItems:3 checkpoints:1
          Checkpoint[0x10803c000] with id:1 seqno:{1002,1002} snap:{0,1002, visible:1002} state:CHECKPOINT_OPEN numCursors:1 type:Memory hcs:-- items:[
      	{1001,empty,cid:0x1:empty,110,[m]}
      	{1002,mutation,cid:0x0:key1,109,}
      ]
          cursors:[
              persistence: CheckpointCursor[0x105c5e998] with name:persistence currentCkpt:{id:1 state:CHECKPOINT_OPEN} currentSeq:1002 distance:1
          ]
      

      Actual Results
      No items are expelled.

      Attachments

        Issue Links

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

          Activity

            People

              drigby Dave Rigby (Inactive)
              drigby Dave Rigby (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty