Changeset 2828 for box/trunk/lib


Ignore:
Timestamp:
08/01/2011 21:33:19 (17 months ago)
Author:
chris
Message:

Log the path, name and size of files being restored at TRACE level for
users wanting more detailed restore output.

Disable printing dots when logging at TRACE level is enabled.

Warn rather than failing to restore when the file attributes could not
be restored. (merges [2745], [2827]).

Location:
box/trunk/lib/backupclient
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • box/trunk/lib/backupclient/BackupClientFileAttributes.cpp

    r2636 r2828  
    844844                if(::utimes(Filename, times) != 0) 
    845845                { 
    846                         BOX_LOG_SYS_ERROR("Failed to change times of " 
    847                                 "file '" << Filename << "'"); 
    848                         THROW_EXCEPTION(CommonException, OSFileError) 
     846                        BOX_LOG_SYS_WARNING("Failed to change times of " 
     847                                "file '" << Filename << "' to ctime=" << 
     848                                BOX_FORMAT_TIMESPEC(times[0]) << ", mtime=" <<  
     849                                BOX_FORMAT_TIMESPEC(times[1])); 
    849850                } 
    850851        } 
  • box/trunk/lib/backupclient/BackupClientRestore.cpp

    r2170 r2828  
    212212// -------------------------------------------------------------------------- 
    213213static int BackupClientRestoreDir(BackupProtocolClient &rConnection, 
    214         int64_t DirectoryID, std::string &rLocalDirectoryName, 
     214        int64_t DirectoryID, const std::string &rRemoteDirectoryName, 
     215        const std::string &rLocalDirectoryName, 
    215216        RestoreParams &Params, RestoreResumeInfo &rLevel) 
    216217{ 
     
    224225                        rLevel.mNextLevelLocalName); 
    225226                BackupClientRestoreDir(rConnection, rLevel.mNextLevelID, 
    226                         localDirname, Params, *rLevel.mpNextLevel); 
     227                        rRemoteDirectoryName + '/' +  
     228                        rLevel.mNextLevelLocalName, localDirname, 
     229                        Params, *rLevel.mpNextLevel); 
    227230                 
    228231                // Add it to the list of done itmes 
     
    527530                                } 
    528531                                 
     532                                BOX_TRACE("Restoring file: " << 
     533                                        rRemoteDirectoryName + '/' +  
     534                                        nm.GetClearFilename() << " (" << 
     535                                        en->GetSizeInBlocks() << " blocks)"); 
     536 
    529537                                // Request it from the store 
    530538                                rConnection.QueryGetFile(DirectoryID, 
     
    740748                                 
    741749                                // Recurse 
     750 
     751                                BOX_TRACE("Entering directory: " << 
     752                                        rRemoteDirectoryName + '/' +  
     753                                        nm.GetClearFilename()); 
     754 
    742755                                int result = BackupClientRestoreDir( 
    743756                                        rConnection, en->GetObjectID(),  
    744                                         localDirname, Params, rnextLevel); 
     757                                        rRemoteDirectoryName + '/' +  
     758                                        nm.GetClearFilename(), localDirname, 
     759                                        Params, rnextLevel); 
    745760 
    746761                                if (result != Restore_Complete) 
     
    825840// -------------------------------------------------------------------------- 
    826841int BackupClientRestore(BackupProtocolClient &rConnection, 
    827         int64_t DirectoryID, const char *LocalDirectoryName, 
    828         bool PrintDots, bool RestoreDeleted, 
     842        int64_t DirectoryID, const char *RemoteDirectoryName, 
     843        const char *LocalDirectoryName, bool PrintDots, bool RestoreDeleted, 
    829844        bool UndeleteAfterRestoreDeleted, bool Resume, 
    830845        bool ContinueAfterErrors) 
     
    873888         
    874889        // Restore the directory 
    875         std::string localName(LocalDirectoryName); 
    876890        int result = BackupClientRestoreDir(rConnection, DirectoryID,  
    877                 localName, params, params.mResumeInfo); 
     891                RemoteDirectoryName, LocalDirectoryName, params, 
     892                params.mResumeInfo); 
    878893        if (result != Restore_Complete) 
    879894        { 
  • box/trunk/lib/backupclient/BackupClientRestore.h

    r2157 r2828  
    2525int BackupClientRestore(BackupProtocolClient &rConnection, 
    2626        int64_t DirectoryID, 
     27        const char *RemoteDirectoryName, 
    2728        const char *LocalDirectoryName, 
    2829        bool PrintDots = false, 
  • box/trunk/lib/backupclient/BackupStoreFile.cpp

    r2804 r2828  
    315315                 
    316316                // Write the attributes 
    317                 stream->GetAttributes().WriteAttributes(DecodedFilename); 
     317                try 
     318                { 
     319                        stream->GetAttributes().WriteAttributes(DecodedFilename); 
     320                } 
     321                catch (std::exception& e) 
     322                { 
     323                        BOX_WARNING("Failed to restore attributes on " << 
     324                                DecodedFilename << ": " << e.what()); 
     325                } 
    318326        } 
    319327        catch(...) 
Note: See TracChangeset for help on using the changeset viewer.