Changeset 2401
- Timestamp:
- 05/12/2008 20:56:00 (15 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp
r2394 r2401 1040 1040 if(!rContext.StorageLimitExceeded()) 1041 1041 { 1042 // Update store 1043 BackupClientFileAttributes attr; 1044 attr.ReadAttributes(filename.c_str(), false /* put mod times in the attributes, please */); 1045 MemBlockStream attrStream(attr); 1046 connection.QuerySetReplacementFileAttributes(mObjectID, attributesHash, storeFilename, attrStream); 1047 fileSynced = true; 1042 try 1043 { 1044 // Update store 1045 BackupClientFileAttributes attr; 1046 attr.ReadAttributes(filename.c_str(), false /* put mod times in the attributes, please */); 1047 MemBlockStream attrStream(attr); 1048 connection.QuerySetReplacementFileAttributes(mObjectID, attributesHash, storeFilename, attrStream); 1049 fileSynced = true; 1050 } 1051 catch (BoxException &e) 1052 { 1053 BOX_ERROR("Failed to read or store " 1054 "file attributes for '" << 1055 filename << "', will try " 1056 "again later"); 1057 } 1048 1058 } 1049 1059 } … … 1087 1097 { 1088 1098 // Use this one 1089 BOX_TRACE("Storing uploaded file ID " << inodeNum << " (" << filename << ") in ID map as object " << latestObjectID << " with parent " << mObjectID << " (" << rLocalPath << ")"); 1099 BOX_TRACE("Storing uploaded file ID " << 1100 inodeNum << " (" << filename << ") " 1101 "in ID map as object " << 1102 latestObjectID << " with parent " << 1103 mObjectID); 1090 1104 idMap.AddToMap(inodeNum, latestObjectID, mObjectID /* containing directory */); 1091 1105 } … … 1101 1115 if (dirid != mObjectID) 1102 1116 { 1103 BOX_WARNING("Found conflicting parent ID for file ID " << inodeNum << " (" << filename << "): expected " << mObjectID << " (" << rLocalPath << ")but found " << dirid << " (same directory used in two different locations?)");1117 BOX_WARNING("Found conflicting parent ID for file ID " << inodeNum << " (" << filename << "): expected " << mObjectID << " but found " << dirid << " (same directory used in two different locations?)"); 1104 1118 } 1105 1119 … … 1111 1125 // not indicate anything wrong. 1112 1126 // Run the release version for real life use, where this check is not made. 1113 BOX_TRACE("Storing found file ID " << inodeNum << " (" << filename << ") in ID map as object " << latestObjectID << " with parent " << mObjectID << " (" << rLocalPath << ")"); 1114 idMap.AddToMap(inodeNum, objid, mObjectID /* containing directory */); 1127 BOX_TRACE("Storing found file ID " << 1128 inodeNum << " (" << filename << 1129 ") in ID map as object " << 1130 objid << " with parent " << 1131 mObjectID); 1132 idMap.AddToMap(inodeNum, objid, 1133 mObjectID /* containing directory */); 1115 1134 } 1116 1135 } … … 1173 1192 1174 1193 // Flag for having created directory, so can optimise the 1175 // recu sive call not to read it again, because we know1194 // recursive call not to read it again, because we know 1176 1195 // it's empty. 1177 1196 bool haveJustCreatedDirOnServer = false; … … 1179 1198 // Next, see if it's in the list of sub directories 1180 1199 BackupClientDirectoryRecord *psubDirRecord = 0; 1181 std::map<std::string, BackupClientDirectoryRecord *>::iterator e(mSubDirectories.find(*d)); 1200 std::map<std::string, BackupClientDirectoryRecord *>::iterator 1201 e(mSubDirectories.find(*d)); 1202 1182 1203 if(e != mSubDirectories.end()) 1183 1204 { … … 1219 1240 InodeRefType inodeNum = 0; 1220 1241 BackupClientFileAttributes attr; 1221 attr.ReadAttributes(dirname.c_str(), true /* directories have zero mod times */, 1222 0 /* not interested in mod time */, &attrModTime, 0 /* not file size */, 1223 &inodeNum); 1242 bool failedToReadAttributes = false; 1243 1244 try 1245 { 1246 attr.ReadAttributes(dirname.c_str(), 1247 true /* directories have zero mod times */, 1248 0 /* not interested in mod time */, 1249 &attrModTime, 0 /* not file size */, 1250 &inodeNum); 1251 } 1252 catch (BoxException &e) 1253 { 1254 BOX_WARNING("Failed to read attributes " 1255 "of directory, cannot check " 1256 "for rename, assuming new: '" 1257 << dirname << "'"); 1258 failedToReadAttributes = true; 1259 } 1224 1260 1225 1261 // Check to see if the directory been renamed … … 1229 1265 const BackupClientInodeToIDMap &idMap( 1230 1266 rContext.GetCurrentIDMap()); 1231 if(idMap.Lookup(inodeNum, renameObjectID, renameInDirectory)) 1267 1268 if(!failedToReadAttributes && idMap.Lookup(inodeNum, 1269 renameObjectID, renameInDirectory)) 1232 1270 { 1233 1271 // Look up on the server to get the name, to build the local filename
