Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-8149

Add optional 'max' option to db command 'convertToCapped'

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Admin
    • None
    • Storage Execution

      We rely on both the 'size' and 'max' options for a particular capped collection in our application. We also allow configuration changes to the 'max' option. When this happens, we drop and re-create the capped collection with the new 'max' option.

      The problem is that we have a lot of other programs that are always inserting lots of data to this collection... so in between the drop and create, if an insert occurs, our collection is no longer capped:

      my $cmd = Tie::IxHash->new(create => "Logs", capped => boolean::true, size => MAX_CAPPED_SIZE, max => $max_msgs);
      $db->run_command(Tie::IxHash->new(drop => 'Logs'));
      $db->run_command($cmd);
      

      The only solution I could find was the 'convertToCapped' database command, which would help us by locking the collection while converting. However, this command doesn't support the 'max' option.

      Another solution would be the ability to drop and create a collection atomically (i.e. one database command instead of two), since the 'create' command supports the max 'option'

            Assignee:
            backlog-server-execution [DO NOT USE] Backlog - Storage Execution Team
            Reporter:
            schou@barracuda.com Samuel Chou
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: