Changeset 1790 for box/chris/general/lib/backupstore/BackupStoreCheck.cpp
- Timestamp:
- 03/08/2007 00:29:31 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
box/chris/general/lib/backupstore/BackupStoreCheck.cpp
r969 r1790 103 103 if(!mQuiet) 104 104 { 105 ::printf("Couldn't lock the account -- did not check.\nTry again later after the client has disconnected.\nAlternatively, forcibly kill the server.\n");105 BOX_ERROR("Failed to lock the account -- did not check.\nTry again later after the client has disconnected.\nAlternatively, forcibly kill the server."); 106 106 } 107 107 THROW_EXCEPTION(BackupStoreException, CouldNotLockStoreAccount) … … 111 111 if(!mQuiet && mFixErrors) 112 112 { 113 ::printf("NOTE: Will fix errors encountered during checking.\n");113 BOX_NOTICE("Will fix errors encountered during checking."); 114 114 } 115 115 … … 117 117 if(!mQuiet) 118 118 { 119 ::printf("Check store account ID %08x\nPhase 1, check objects...\n", mAccountID); 119 BOX_INFO("Checking store account ID " << 120 BOX_FORMAT_ACCOUNT(mAccountID) << "..."); 121 BOX_INFO("Phase 1, check objects..."); 120 122 } 121 123 CheckObjects(); … … 124 126 if(!mQuiet) 125 127 { 126 ::printf("Phase 2, check directories...\n");128 BOX_INFO("Phase 2, check directories..."); 127 129 } 128 130 CheckDirectories(); … … 131 133 if(!mQuiet) 132 134 { 133 ::printf("Phase 3, check root...\n");135 BOX_INFO("Phase 3, check root..."); 134 136 } 135 137 CheckRoot(); … … 138 140 if(!mQuiet) 139 141 { 140 ::printf("Phase 4, fix unattached objects...\n");142 BOX_INFO("Phase 4, fix unattached objects..."); 141 143 } 142 144 CheckUnattachedObjects(); … … 145 147 if(!mQuiet) 146 148 { 147 ::printf("Phase 5, fix unrecovered inconsistencies...\n");149 BOX_INFO("Phase 5, fix unrecovered inconsistencies..."); 148 150 } 149 151 FixDirsWithWrongContainerID(); … … 153 155 if(!mQuiet) 154 156 { 155 ::printf("Phase 6, regenerate store info...\n");157 BOX_INFO("Phase 6, regenerate store info..."); 156 158 } 157 159 WriteNewStoreInfo(); … … 161 163 if(mNumberErrorsFound > 0) 162 164 { 163 ::printf("%lld errors found\n", mNumberErrorsFound); 165 BOX_WARNING("Finished checking store account ID " << 166 BOX_FORMAT_ACCOUNT(mAccountID) << ": " << 167 mNumberErrorsFound << " errors found"); 164 168 if(!mFixErrors) 165 169 { 166 ::printf("NOTE: No changes to the store account have been made.\n"); 170 BOX_WARNING("No changes to the store account " 171 "have been made."); 167 172 } 168 173 if(!mFixErrors && mNumberErrorsFound > 0) 169 174 { 170 ::printf("Run again with fix option to fix these errors\n"); 171 } 172 if(mNumberErrorsFound > 0) 173 { 174 ::printf("You should now use bbackupquery on the client machine to examine the store.\n"); 175 BOX_WARNING("Run again with fix option to " 176 "fix these errors"); 177 } 178 if(mFixErrors && mNumberErrorsFound > 0) 179 { 180 BOX_WARNING("You should now use bbackupquery " 181 "on the client machine to examine the store."); 175 182 if(mLostAndFoundDirectoryID != 0) 176 183 { 177 ::printf("A lost+found directory was created in the account root.\n"\ 178 "This contains files and directories which could not be matched to existing directories.\n"\ 179 "bbackupd will delete this directory in a few days time.\n"); 184 BOX_WARNING("A lost+found directory was " 185 "created in the account root.\n" 186 "This contains files and directories " 187 "which could not be matched to " 188 "existing directories.\n"\ 189 "bbackupd will delete this directory " 190 "in a few days time."); 180 191 } 181 192 } … … 183 194 else 184 195 { 185 ::printf("Store account checked, no errors found.\n"); 196 BOX_NOTICE("Finished checking store account ID " << 197 BOX_FORMAT_ACCOUNT(mAccountID) << ": " 198 "no errors found"); 186 199 } 187 200 } … … 305 318 else 306 319 { 307 ::printf("Spurious or invalid directory %s/%s found%s -- delete manually\n", rDirName.c_str(), (*i).c_str(), mFixErrors?", deleting":""); 320 BOX_WARNING("Spurious or invalid directory " << 321 rDirName << DIRECTORY_SEPARATOR << 322 (*i) << " found, " << 323 (mFixErrors?"deleting":"delete manually")); 308 324 ++mNumberErrorsFound; 309 325 } … … 337 353 if(!RaidFileRead::DirectoryExists(mDiscSetNumber, dirName)) 338 354 { 339 TRACE1("RaidFile dir %s does not exist\n", dirName.c_str());355 BOX_WARNING("RaidFile dir " << dirName << " does not exist"); 340 356 return; 341 357 } … … 379 395 { 380 396 // Unexpected or bad file, delete it 381 ::printf("Spurious file %s" DIRECTORY_SEPARATOR "%s "382 "found%s\n", dirName.c_str(), (*i).c_str(),383 mFixErrors?", deleting":"");397 BOX_WARNING("Spurious file " << dirName << 398 DIRECTORY_SEPARATOR << (*i) << " found" << 399 (mFixErrors?", deleting":"")); 384 400 ++mNumberErrorsFound; 385 401 if(mFixErrors) … … 402 418 { 403 419 // File was bad, delete it 404 ::printf("Corrupted file %s%s found%s\n", dirName.c_str(), leaf, mFixErrors?", deleting":""); 420 BOX_WARNING("Corrupted file " << dirName << 421 leaf << " found" << 422 (mFixErrors?", deleting":"")); 405 423 ++mNumberErrorsFound; 406 424 if(mFixErrors) … … 510 528 { 511 529 // Get that dodgy thing deleted! 512 ::printf("Have file as root directory. This is bad.\n");530 BOX_ERROR("Have file as root directory. This is bad."); 513 531 return -1; 514 532 } … … 597 615 { 598 616 // Wasn't quite right, and has been modified 599 ::printf("Directory ID %llx has bad structure\n", pblock->mID[e]); 617 BOX_WARNING("Directory ID " << 618 BOX_FORMAT_OBJECTID(pblock->mID[e]) << 619 " has bad structure"); 600 620 ++mNumberErrorsFound; 601 621 isModified = true; … … 623 643 { 624 644 // Entry is of wrong type 625 ::printf("Directory ID %llx references object %llx which has a different type than expected.\n", pblock->mID[e], en->GetObjectID()); 645 BOX_WARNING("Directory ID " << 646 BOX_FORMAT_OBJECTID(pblock->mID[e]) << 647 " references object " << 648 BOX_FORMAT_OBJECTID(en->GetObjectID()) << 649 " which has a different type than expected."); 626 650 badEntry = true; 627 651 } … … 631 655 if(iflags & Flags_IsContained) 632 656 { 657 BOX_WARNING("Directory ID " << 658 BOX_FORMAT_OBJECTID(pblock->mID[e]) << 659 " references object " << 660 BOX_FORMAT_OBJECTID(en->GetObjectID()) << 661 " which is already contained."); 633 662 badEntry = true; 634 ::printf("Directory ID %llx references object %llx which is already contained.\n", pblock->mID[e], en->GetObjectID());635 663 } 636 664 else … … 646 674 { 647 675 // Add to will fix later list 648 ::printf("Directory ID %llx has wrong container ID.\n", en->GetObjectID());676 BOX_WARNING("Directory ID " << BOX_FORMAT_OBJECTID(en->GetObjectID()) << " has wrong container ID."); 649 677 mDirsWithWrongContainerID.push_back(en->GetObjectID()); 650 678 } … … 652 680 { 653 681 // This is OK for files, they might move 654 ::printf("File ID %llx has different container ID, probably moved\n", en->GetObjectID());682 BOX_WARNING("File ID " << BOX_FORMAT_OBJECTID(en->GetObjectID()) << " has different container ID, probably moved"); 655 683 } 656 684 … … 671 699 isModified = true; 672 700 // Tell user 673 ::printf("Directory ID %llx has wrong size for object %llx\n", pblock->mID[e], en->GetObjectID());701 BOX_WARNING("Directory ID " << BOX_FORMAT_OBJECTID(pblock->mID[e]) << " has wrong size for object " << BOX_FORMAT_OBJECTID(en->GetObjectID())); 674 702 } 675 703 } … … 687 715 // Just remove the entry 688 716 badEntry = true; 689 ::printf("Directory ID %llx references object %llx which does not exist.\n", pblock->mID[e], en->GetObjectID());717 BOX_WARNING("Directory ID " << BOX_FORMAT_OBJECTID(pblock->mID[e]) << " references object " << BOX_FORMAT_OBJECTID(en->GetObjectID()) << " which does not exist."); 690 718 } 691 719 } … … 730 758 if(isModified && mFixErrors) 731 759 { 732 ::printf("Fixing directory ID %llx\n", pblock->mID[e]);760 BOX_WARNING("Fixing directory ID " << BOX_FORMAT_OBJECTID(pblock->mID[e])); 733 761 734 762 // Save back to disc
Note: See TracChangeset
for help on using the changeset viewer.
