[SERVER-21] Feature-Req: Flush this record(s) to disk Created: 17/Apr/09  Updated: 25/Aug/09  Resolved: 25/Aug/09

Status: Closed
Project: Core Server
Component/s: Stability
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Minor - P4
Reporter: Jim Jones Assignee: Eliot Horowitz (Inactive)
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

It would be interesting if a client could issue requests for selective msync()s on the server.
Commands like "flush these records to disk" or "flush this collection to disk".



 Comments   
Comment by Eliot Horowitz (Inactive) [ 25/Aug/09 ]

see SERVER-255

Comment by Jim Jones [ 01/Jun/09 ]

Well, mongodump is still a lot more expensive than a constant-time snapshot on our SAN.

With mongodump we have to:

  • Dump to the local disk (it can't write to the network, yet)
  • Transfer that dump to elsewhere

Both can take a while for multi-gigabyte databases.

With a snapshot we'd only have to:

  • Halt mongod
  • Take the snapshot (which is a sub-second operation)
  • Resume mongod

I realize we could just stop mongod altogether but losing all the cached data is undesirable, we'd like to take snapshots hourly.

Comment by Eliot Horowitz (Inactive) [ 31/May/09 ]

unless you need an exaact moment in time snapshot - using mongodump will be almost as fast - and won't halt the db

Comment by Jim Jones [ 31/May/09 ]

A related use-case:

For backup purposes it would be good if we could, on request, sync the entire datastore to disk and halt mongod temporarily (for taking a filesystem snapshot). This could either be implemented through client commands, or under unix with the traditional SIGSTOP/SIGCONT signals.

Ideally mongod would also report back after entering the frozen state, e.g. by touching a predefined file (configured by command line switch).

A simple backup-script could then look like this:

kill -SIGSTOP `pidof mongod`
while [ ! -e /var/mongo/frozen ]; do
sleep 1
done
echo "Mongo is frozen, taking snapshot"

  1. snapshot command goes here
    kill -SIGCONT `pidof mongod`
    while [ -e /var/mongo/frozen ]; do
    sleep 1
    done
    echo "Mongo is back!"
Generated at Thu Feb 08 02:52:49 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.