Changeset 3025
- Timestamp:
- 12/10/2011 00:41:47 (8 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp
r3023 r3025 773 773 // Filename of this file 774 774 std::string filename(MakeFullPath(rLocalPath, *f)); 775 std::string nonVssFilePath = ConvertVssPathToRealPath(filename, 776 rBackupLocation); 775 777 776 778 // Get relevant info about file … … 786 788 if(EMU_LSTAT(filename.c_str(), &st) != 0) 787 789 { 788 rNotifier.NotifyFileStatFailed(this, 789 filename,strerror(errno));790 rNotifier.NotifyFileStatFailed(this, nonVssFilePath, 791 strerror(errno)); 790 792 791 793 // Report the error (logs and 792 794 // eventual email to administrator) 793 SetErrorWhenReadingFilesystemObject(rParams, filename);795 SetErrorWhenReadingFilesystemObject(rParams, nonVssFilePath); 794 796 795 797 // Ignore this entry for now. … … 846 848 box_time_t srvModTime = 0, srvAttributesHash = 0; 847 849 BackupStoreFilenameClear oldLeafname; 848 if(rContext.FindFilename(renameObjectID, renameInDirectory, localPotentialOldName, isDir, isCurrentVersion, &srvModTime, &srvAttributesHash, &oldLeafname)) 850 if(rContext.FindFilename(renameObjectID, renameInDirectory, 851 localPotentialOldName, isDir, isCurrentVersion, 852 &srvModTime, &srvAttributesHash, &oldLeafname)) 849 853 { 850 854 // Only interested if it's a file and the latest version … … 866 870 { 867 871 // Rename the existing files (ie include old versions) on the server 868 connection.QueryMoveObject(renameObjectID, renameInDirectory, mObjectID /* move to this directory */, 872 connection.QueryMoveObject(renameObjectID, 873 renameInDirectory, 874 mObjectID /* move to this directory */, 869 875 BackupProtocolMoveObject::Flags_MoveAllWithSameName | 870 876 BackupProtocolMoveObject::Flags_AllowMoveOverDeletedObject, … … 877 883 // Create new entry in the directory for it 878 884 // -- will be near enough what's actually on the server for the rest to work. 879 en = pDirOnStore->AddEntry(storeFilename, srvModTime, renameObjectID, 0 /* size in blocks unknown, but not needed */, 880 BackupStoreDirectory::Entry::Flags_File, srvAttributesHash); 885 en = pDirOnStore->AddEntry(storeFilename, 886 srvModTime, renameObjectID, 887 0 /* size in blocks unknown, but not needed */, 888 BackupStoreDirectory::Entry::Flags_File, 889 srvAttributesHash); 881 890 882 891 // Store the object ID for the inode lookup map later … … 920 929 921 930 bool doUpload = false; 931 std::string decisionReason = "unknown"; 922 932 923 933 // Only upload a file if the mod time locally is … … 935 945 { 936 946 doUpload = true; 937 BOX_TRACE("Upload decision: " << 938 filename << ": will upload " 939 "(not on server)"); 947 decisionReason = "not on server"; 940 948 } 941 949 else if (modTime >= rParams.mSyncPeriodStart) 942 950 { 943 951 doUpload = true; 944 BOX_TRACE("Upload decision: " << 945 filename << ": will upload " 946 "(modified since last sync)"); 952 decisionReason = "modified since last sync"; 947 953 } 948 954 } … … 961 967 { 962 968 doUpload = true; 963 BOX_TRACE("Upload decision: " << 964 filename << ": will upload " 965 "(continually modified)"); 969 decisionReason = "continually modified"; 966 970 } 967 971 … … 979 983 { 980 984 doUpload = true; 981 BOX_TRACE("Upload decision: " << 982 filename << ": will upload " 983 "(mod time changed)"); 985 decisionReason = "mod time changed"; 984 986 } 985 987 … … 992 994 { 993 995 doUpload = true; 994 BOX_TRACE("Upload decision: " << 995 filename << ": will upload " 996 "(mod time in the future)"); 996 decisionReason = "mod time in the future"; 997 997 } 998 998 } … … 1000 1000 if (en != 0 && en->GetModificationTime() == modTime) 1001 1001 { 1002 BOX_TRACE("Upload decision: " << 1003 filename << ": will not upload " 1004 "(not modified since last upload)"); 1002 doUpload = false; 1003 decisionReason = "not modified since last upload"; 1005 1004 } 1006 1005 else if (!doUpload) … … 1011 1010 int age = BoxTimeToSeconds(now - 1012 1011 modTime); 1013 BOX_TRACE("Upload decision: " <<1014 filename << ": will not upload"1015 " (modified too recently: "1016 "only " << age << " seconds ago)");1012 std::ostringstream s; 1013 s << "modified too recently: " 1014 "only " << age << " seconds ago"; 1015 decisionReason = s.str(); 1017 1016 } 1018 1017 else 1019 1018 { 1020 BOX_TRACE("Upload decision: " << 1021 filename << ": will not upload " 1022 "(mod time is " << modTime << 1019 std::ostringstream s; 1020 s << "mod time is " << modTime << 1023 1021 " which is outside sync window, " 1024 1022 << rParams.mSyncPeriodStart << " to " 1025 << rParams.mSyncPeriodEnd << ")"); 1026 } 1027 } 1023 << rParams.mSyncPeriodEnd; 1024 decisionReason = s.str(); 1025 } 1026 } 1027 1028 BOX_TRACE("Upload decision: " << nonVssFilePath << ": " << 1029 (doUpload ? "will upload" : "will not upload") << 1030 "(" << decisionReason << ")"); 1028 1031 1029 1032 bool fileSynced = true; … … 1079 1082 // more problems. 1080 1083 rNotifier.NotifyFileUploadException( 1081 this, filename, e);1084 this, nonVssFilePath, e); 1082 1085 throw; 1083 1086 } … … 1096 1099 allUpdatedSuccessfully = false; 1097 1100 // Log it. 1098 SetErrorWhenReadingFilesystemObject(rParams, filename); 1099 rNotifier.NotifyFileUploadException(this, filename, e); 1101 SetErrorWhenReadingFilesystemObject(rParams, 1102 nonVssFilePath); 1103 rNotifier.NotifyFileUploadException(this, 1104 nonVssFilePath, e); 1100 1105 } 1101 1106 … … 1115 1120 else 1116 1121 { 1117 rNotifier.NotifyFileSkippedServerFull(this, 1118 ConvertVssPathToRealPath(filename, rBackupLocation)); 1122 rNotifier.NotifyFileSkippedServerFull(this, nonVssFilePath); 1119 1123 } 1120 1124 } … … 1136 1140 try 1137 1141 { 1138 rNotifier.NotifyFileUploadingAttributes( 1139 this, filename);1142 rNotifier.NotifyFileUploadingAttributes(this, 1143 nonVssFilePath); 1140 1144 1141 1145 // Update store … … 1148 1152 catch (BoxException &e) 1149 1153 { 1150 BOX_ERROR("Failed to read or store " 1151 "file attributes for '" << 1152 filename << "', will try " 1153 "again later"); 1154 BOX_ERROR("Failed to read or store file attributes " 1155 "for '" << nonVssFilePath << "', will try again " 1156 "later"); 1154 1157 } 1155 1158 } … … 1195 1198 // Use this one 1196 1199 BOX_TRACE("Storing uploaded file ID " << 1197 inodeNum << " (" << filename<< ") "1200 inodeNum << " (" << nonVssFilePath << ") " 1198 1201 "in ID map as object " << 1199 1202 latestObjectID << " with parent " << … … 1212 1215 if (dirid != mObjectID) 1213 1216 { 1214 BOX_WARNING("Found conflicting parent ID for file ID " << inodeNum << " (" << filename << "): expected " << mObjectID << " but found " << dirid << " (same directory used in two different locations?)"); 1217 BOX_WARNING("Found conflicting parent ID for " 1218 "file ID " << inodeNum << " (" << 1219 nonVssFilePath << "): expected " << 1220 mObjectID << " but found " << dirid << 1221 " (same directory used in two different " 1222 "locations?)"); 1215 1223 } 1216 1224 … … 1222 1230 // not indicate anything wrong. 1223 1231 // Run the release version for real life use, where this check is not made. 1224 BOX_TRACE("Storing found file ID " << 1225 inodeNum << " (" << filename << 1226 ") in ID map as object " << 1227 objid << " with parent " << 1228 mObjectID); 1232 BOX_TRACE("Storing found file ID " << inodeNum << 1233 " (" << nonVssFilePath << ") in ID map as " 1234 "object " << objid << " with parent " << mObjectID); 1229 1235 idMap.AddToMap(inodeNum, objid, 1230 1236 mObjectID /* containing directory */); … … 1235 1241 if (fileSynced) 1236 1242 { 1237 rNotifier.NotifyFileSynchronised(this, filename,1243 rNotifier.NotifyFileSynchronised(this, nonVssFilePath, 1238 1244 fileSize); 1239 1245 } … … 1261 1267 // Get the local filename 1262 1268 std::string dirname(MakeFullPath(rLocalPath, *d)); 1269 std::string nonVssDirPath = ConvertVssPathToRealPath(dirname, 1270 rBackupLocation); 1263 1271 1264 1272 // See if it's in the listing (if we have one) … … 1352 1360 "of directory, cannot check " 1353 1361 "for rename, assuming new: '" 1354 << dirname<< "'");1362 << nonVssDirPath << "'"); 1355 1363 failedToReadAttributes = true; 1356 1364 } … … 1370 1378 bool isDir = false; 1371 1379 bool isCurrentVersion = false; 1372 if(rContext.FindFilename(renameObjectID, renameInDirectory, localPotentialOldName, isDir, isCurrentVersion)) 1380 if(rContext.FindFilename(renameObjectID, 1381 renameInDirectory, localPotentialOldName, 1382 isDir, isCurrentVersion)) 1373 1383 { 1374 1384 // Only interested if it's a directory … … 1400 1410 { 1401 1411 // Rename the existing directory on the server 1402 connection.QueryMoveObject(renameObjectID, renameInDirectory, mObjectID /* move to this directory */, 1412 connection.QueryMoveObject(renameObjectID, 1413 renameInDirectory, 1414 mObjectID /* move to this directory */, 1403 1415 BackupProtocolMoveObject::Flags_MoveAllWithSameName | 1404 1416 BackupProtocolMoveObject::Flags_AllowMoveOverDeletedObject, … … 1419 1431 { 1420 1432 // Create a new directory 1421 std::auto_ptr<BackupProtocolSuccess> dirCreate(connection.QueryCreateDirectory( 1422 mObjectID, attrModTime, storeFilename, attrStream)); 1433 std::auto_ptr<BackupProtocolSuccess> dirCreate( 1434 connection.QueryCreateDirectory( 1435 mObjectID, attrModTime, storeFilename, 1436 attrStream)); 1423 1437 subDirObjectID = dirCreate->GetObjectID(); 1424 1438 … … 1427 1441 rNotifier.NotifyDirectoryCreated(subDirObjectID, 1428 1442 storeFilename.GetClearFilename(), 1429 dirname);1443 nonVssDirPath); 1430 1444 } 1431 1445 } … … 1491 1505 std::string localName = MakeFullPath(rLocalPath, 1492 1506 clear.GetClearFilename()); 1507 std::string nonVssLocalName = ConvertVssPathToRealPath(localName, 1508 rBackupLocation); 1493 1509 1494 1510 // Delete this entry -- file or directory? … … 1516 1532 delete rec; 1517 1533 1518 std::string name = MakeFullPath( 1519 rLocalPath, 1520 dirname.GetClearFilename()); 1521 1522 BOX_TRACE("Deleted directory record " 1523 "for " << name); 1534 BOX_TRACE("Deleted directory record for " << 1535 nonVssLocalName); 1524 1536 } 1525 1537 }
Note: See TracChangeset
for help on using the changeset viewer.
