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

With Boost::filesystem v3 on Windows, we need to work with canonical file paths

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.3.0
    • Affects Version/s: None
    • Component/s: Internal Code
    • None
    • Environment:
      Windows
    • ALL

      We use string comparisons internally to match file specifications in several places, but users can provide any legal combination of slash and backslash in specifying paths (dbpath, etc.). Moreover, Boost::filesystem v3's string() function prefers "native" path separator characters (so backslash on Windows).

      We need to convert path characters to a common format (e.g. Unix-style "/") and use Boost::filesystem v3's generic_string() (or similar) so that string comparisons work as expected.

      Buildbot failures:
      http://buildlogs.mongodb.org/Windows%2064-bit%20DEBUG/builds/257/test/disk/repair.js

      m31000| Mon Oct 15 12:16:47 [conn1] opening db: /data/db/jstests_disk_repair/repairDir/backup_repairDatabase_0 jstests_disk_repair
       m31000| Mon Oct 15 12:16:47 [conn1] info PageFaultRetryableSection will not yield, already locked upon reaching
       m31000| Mon Oct 15 12:16:47 [FileAllocator] allocating new datafile /data/db/jstests_disk_repair/repairDir/backup_repairDatabase_0\jstests_disk_repair.ns, filling with zeroes...
       m31000| Mon Oct 15 12:16:47 [FileAllocator] creating directory /data/db/jstests_disk_repair/repairDir/backup_repairDatabase_0\_tmp
       m31000| Mon Oct 15 12:16:48 [FileAllocator] done allocating datafile /data/db/jstests_disk_repair/repairDir/backup_repairDatabase_0\jstests_disk_repair.ns, size: 16MB,  took 0.132 secs
       m31000| Mon Oct 15 12:16:48 [FileAllocator] allocating new datafile /data/db/jstests_disk_repair/repairDir/backup_repairDatabase_0\jstests_disk_repair.0, filling with zeroes...
       m31000| Mon Oct 15 12:16:48 [FileAllocator] done allocating datafile /data/db/jstests_disk_repair/repairDir/backup_repairDatabase_0\jstests_disk_repair.0, size: 64MB,  took 0.548 secs
       m31000| Mon Oct 15 12:16:48 [conn1] datafileheader::init initializing /data/db/jstests_disk_repair/repairDir/backup_repairDatabase_0\jstests_disk_repair.0 n:0
       m31000| Mon Oct 15 12:16:48 [FileAllocator] allocating new datafile /data/db/jstests_disk_repair/repairDir/backup_repairDatabase_0\jstests_disk_repair.1, filling with zeroes...
       m31000| Mon Oct 15 12:16:48 [conn1] build index jstests_disk_repair.jstests_disk_repair { _id: 1 }
       m31000| Mon Oct 15 12:16:48 [conn1] 	 fastBuildIndex dupsToDrop:0
       m31000| Mon Oct 15 12:16:48 [conn1] build index done.  scanned 1 total records. 0.001 secs
       m31000| Mon Oct 15 12:16:49 [conn1] journal error applying writes, file /data/db/jstests_disk_repair\repairDir/backup_repairDatabase_0\jstests_disk_repair.ns is not open
       m31000| Mon Oct 15 12:16:49 [conn1]   Assertion failure false src\mongo\db\dur_recover.cpp 244
       m31000| Mon Oct 15 12:16:49 [conn1] mongod.exe  ...\src\mongo\util\stacktrace.cpp(161)         mongo::printStackTrace+0x5b
       m31000| Mon Oct 15 12:16:49 [conn1] mongod.exe  ...\src\mongo\util\log.cpp(435)                mongo::logContext+0x72
       m31000| Mon Oct 15 12:16:49 [conn1] mongod.exe  ...\src\mongo\util\assert_util.cpp(109)        mongo::verifyFailed+0x190
       m31000| Mon Oct 15 12:16:49 [conn1] mongod.exe  ...\src\mongo\db\dur_recover.cpp(244)          mongo::dur::RecoveryJob::Last::newEntry+0x236
       m31000| Mon Oct 15 12:16:49 [conn1] mongod.exe  ...\src\mongo\db\dur_recover.cpp(264)          mongo::dur::RecoveryJob::write+0x108
       m31000| Mon Oct 15 12:16:49 [conn1] mongod.exe  ...\src\mongo\db\dur_recover.cpp(295)          mongo::dur::RecoveryJob::applyEntry+0x3b5
       m31000| Mon Oct 15 12:16:49 [conn1] mongod.exe  ...\src\mongo\db\dur_recover.cpp(348)          mongo::dur::RecoveryJob::applyEntries+0x1a3
       m31000| Mon Oct 15 12:16:49 [conn1] mongod.exe  ...\src\mongo\db\dur_recover.cpp(415)          mongo::dur::RecoveryJob::processSection+0x5c5
       m31000| Mon Oct 15 12:16:49 [conn1] mongod.exe  ...\src\mongo\db\dur_writetodatafiles.cpp(33)  mongo::dur::WRITETODATAFILES_Impl1+0xdb
       m31000| Mon Oct 15 12:16:49 [conn1] mongod.exe  ...\src\mongo\db\dur_writetodatafiles.cpp(87)  mongo::dur::WRITETODATAFILES+0x45
       m31000| Mon Oct 15 12:16:49 [conn1] mongod.exe  ...\src\mongo\db\dur.cpp(664)                  mongo::dur::_groupCommit+0x15c
       m31000| Mon Oct 15 12:16:49 [conn1] mongod.exe  ...\src\mongo\db\dur.cpp(713)                  mongo::dur::groupCommit+0x4f
       m31000| Mon Oct 15 12:16:49 [conn1] mongod.exe  ...\src\mongo\db\dur.cpp(207)                  mongo::dur::DurableImpl::commitNow+0x3b
       m31000| Mon Oct 15 12:16:49 [conn1] mongod.exe  ...\src\mongo\db\dur.cpp(302)                  mongo::dur::DurableImpl::_aCommitIsNeeded+0x341
       m31000| Mon Oct 15 12:16:49 [conn1] mongod.exe  ...\src\mongo\db\dur.cpp(330)                  mongo::dur::DurableImpl::commitIfNeeded+0x7f
       m31000| Mon Oct 15 12:16:49 [conn1] mongod.exe  ...\src\mongo\db\dur.cpp(766)                  mongo::dur::closingFileNotification+0x4a
       m31000| Mon Oct 15 12:16:49 [conn1] mongod.exe  ...\src\mongo\db\mongommf.cpp(229)             mongo::MongoMMF::close+0x149
       m31000| Mon Oct 15 12:16:49 [conn1] mongod.exe  ...\src\mongo\db\mongommf.cpp(209)             mongo::MongoMMF::~MongoMMF+0x40
       m31000| Mon Oct 15 12:16:49 [conn1] mongod.exe                                                 mongo::MongoDataFile::~MongoDataFile+0x28
       m31000| Mon Oct 15 12:16:49 [conn1] mongod.exe                                                 mongo::MongoDataFile::`scalar deleting destructor'+0x2c
       

      If you compare the file specifications in line 5 and 13 above, you can see the problem:

      line  5 = /data/db/jstests_disk_repair/repairDir/backup_repairDatabase_0\jstests_disk_repair.ns
                                            |
      line 13 = /data/db/jstests_disk_repair\repairDir/backup_repairDatabase_0\jstests_disk_repair.ns
      

      At the "pipe" character (|), the directory separators are not the same.

            Assignee:
            schwerin@mongodb.com Andy Schwerin
            Reporter:
            tad Tad Marshall
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: