summaryrefslogtreecommitdiff
path: root/src/mongo/db/db.cpp
diff options
context:
space:
mode:
authorChristian W. Zuckschwerdt <christian@zuckschwerdt.org>2013-10-02 15:09:20 +0200
committerMatt Kangas <matt.kangas@mongodb.com>2013-10-07 12:35:48 -0400
commitb7660950c4888052f2c68a02f6667c114a72dfbd (patch)
tree8798fe18d38655d9d39cd0f9bd4aac6c34acfc9a /src/mongo/db/db.cpp
parent69079a7fd2144b71153a77934947b62794b6d824 (diff)
downloadmongo-b7660950c4888052f2c68a02f6667c114a72dfbd.tar.gz
adding try/catch around boost::filesystem::exists() to handle inaccessible path (fixed indent).
Signed-off-by: Matt Kangas <matt.kangas@mongodb.com>
Diffstat (limited to 'src/mongo/db/db.cpp')
-rw-r--r--src/mongo/db/db.cpp54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index a25d2c55f04..24a6d6ae0fe 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -594,40 +594,40 @@ namespace mongo {
#ifdef __linux__
try
{
- const dev_t dev = getPartition(dir);
-
- // This path handles the case where the filesystem uses the whole device (including LVM)
- string path = str::stream() <<
- "/sys/dev/block/" << major(dev) << ':' << minor(dev) << "/queue/read_ahead_kb";
-
- if (!boost::filesystem::exists(path)){
- // This path handles the case where the filesystem is on a partition.
- path = str::stream()
- << "/sys/dev/block/" << major(dev) << ':' << minor(dev) // this is a symlink
- << "/.." // parent directory of a partition is for the whole device
- << "/queue/read_ahead_kb";
- }
+ const dev_t dev = getPartition(dir);
+
+ // This path handles the case where the filesystem uses the whole device (including LVM)
+ string path = str::stream() <<
+ "/sys/dev/block/" << major(dev) << ':' << minor(dev) << "/queue/read_ahead_kb";
+
+ if (!boost::filesystem::exists(path)){
+ // This path handles the case where the filesystem is on a partition.
+ path = str::stream()
+ << "/sys/dev/block/" << major(dev) << ':' << minor(dev) // this is a symlink
+ << "/.." // parent directory of a partition is for the whole device
+ << "/queue/read_ahead_kb";
+ }
- if (boost::filesystem::exists(path)) {
- ifstream file (path.c_str());
- if (file.is_open()) {
- int kb;
- file >> kb;
- if (kb > 256) {
- log() << startupWarningsLog;
+ if (boost::filesystem::exists(path)) {
+ ifstream file (path.c_str());
+ if (file.is_open()) {
+ int kb;
+ file >> kb;
+ if (kb > 256) {
+ log() << startupWarningsLog;
- log() << "** WARNING: Readahead for " << dir << " is set to " << kb << "KB"
- << startupWarningsLog;
+ log() << "** WARNING: Readahead for " << dir << " is set to " << kb << "KB"
+ << startupWarningsLog;
- log() << "** We suggest setting it to 256KB (512 sectors) or less"
- << startupWarningsLog;
+ log() << "** We suggest setting it to 256KB (512 sectors) or less"
+ << startupWarningsLog;
- log() << "** http://dochub.mongodb.org/core/readahead"
- << startupWarningsLog;
+ log() << "** http://dochub.mongodb.org/core/readahead"
+ << startupWarningsLog;
+ }
}
}
}
- }
catch (const boost::filesystem::filesystem_error& ex)
{
log() << ex.what() << endl;