Propagate random modified time through incremental backups

This commit is contained in:
Martin 2013-11-04 19:35:36 +01:00
parent ba49661e78
commit 9de4cdcdfc
3 changed files with 15 additions and 2 deletions

View File

@ -952,6 +952,9 @@ std::vector<SFile> IndexThread::getFilesProxy(const std::wstring &orig_path, con
if(use_db)
{
std::vector<SFile> db_files;
bool has_files=cd->getFiles(path_lower, db_files);
std::vector<std::wstring> changed_files=cd->getChangedFiles((*it_dir).id);
std::sort(changed_files.begin(), changed_files.end());
@ -961,15 +964,21 @@ std::vector<SFile> IndexThread::getFilesProxy(const std::wstring &orig_path, con
{
if(!tmp[i].isdir)
{
if( std::binary_search(changed_files.begin(), changed_files.end(), tmp[i].name ) )
std::vector<SFile>::const_iterator it_db_file=std::lower_bound(db_files.begin(), db_files.end(), tmp[i]);
if( std::binary_search(changed_files.begin(), changed_files.end(), tmp[i].name ) ||
( it_db_file!=db_files.end() && (*it_db_file).name==tmp[i].name && (*it_db_file).last_modified<0 ) )
{
tmp[i].last_modified*=Server->getRandomNumber();
if(tmp[i].last_modified>0)
tmp[i].last_modified*=-1;
else if(tmp[i].last_modified==0)
tmp[i].last_modified=-1;
}
}
}
}
if(cd->hasFiles(path_lower) )
if( has_files)
{
++index_c_db_update;
modifyFilesInt(path_lower, tmp);

View File

@ -102,6 +102,7 @@ std::vector<SFile> getFiles(const std::wstring &path, bool *has_error)
continue;
}
f.last_modified=f_info.st_mtime;
if(f.last_modified<0) f.last_modified*=-1;
f.size=f_info.st_size;
}
#ifndef sun
@ -109,6 +110,7 @@ std::vector<SFile> getFiles(const std::wstring &path, bool *has_error)
else
{
f.last_modified=f_info.st_mtime;
if(f.last_modified<0) f.last_modified*=-1;
f.size=f_info.st_size;
}
#endif

View File

@ -101,6 +101,8 @@ std::vector<SFile> getFiles(const std::wstring &path, bool *has_error)
size.HighPart=wfd.nFileSizeHigh;
size.LowPart=wfd.nFileSizeLow;
f.size=size.QuadPart;
if(f.last_modified<0) f.last_modified*=-1;
tmp.push_back(f);
}
}