-
Type: Improvement
-
Resolution: Won't Fix
-
Priority: 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'