Merge remote-tracking branch 'urpc/dev' into dev

This commit is contained in:
Martin 2021-12-22 14:03:59 +01:00
commit ceb51dc4e2
9 changed files with 54 additions and 14 deletions

View File

@ -2114,11 +2114,15 @@ IFsFile* TransactionalKvStore::get_retrieve(const std::string& key, BitmapInfo b
continue;
}
in_submission = true;
bool copy_src = false;
std::shared_ptr<IFsFile> memf_src;
if (max_transid > 0 &&
!it_submission->second->compressed)
{
copy_src = true;
}
//Do not evict non-dirty item after submission
if (it_submission->second->keys.empty())
it_submission->second->keys.push_back(std::string());
in_submission = true;
SMemFile* memf;
{
@ -2130,12 +2134,30 @@ IFsFile* TransactionalKvStore::get_retrieve(const std::string& key, BitmapInfo b
Server->Log("Memfile key wrong. Expected " + hexpath(key) + " got " + hexpath(memf->key), LL_ERROR);
abort();
}
if (copy_src && memf != nullptr)
{
memf_src = memf->file;
}
}
if (copy_src && memf_src)
break;
if (copy_src)
{
keypath2(key, it->first);
}
if (memf != nullptr)
{
submission_queue_memfile_first = submission_queue.end();
}
//Do not evict non-dirty item after submission
if (it_submission->second->keys.empty())
it_submission->second->keys.push_back(std::string());
submission_queue.splice(submission_queue.begin(), submission_queue, it_submission->second);
if (!logged_in_submission)

View File

@ -21,10 +21,21 @@ if grep "setup-snapshot=0" /proc/cmdline; then
exit 0
fi
if [ "x$ROOT" = "x" ]; then
echo "urbackup-setup-snapshot: root device not defined. Not setting up snapshotting." > /dev/kmsg
exit 0
fi
if echo "$ROOT" | grep "root-98d1f8b1f435"; then
panic "urbackup-setup-snapshot: Root device is snapshot (clobbered: $ROOT). Please edit root= boot parameter to be the root device and add 'setup-snapshot=0' to boot parameters to fix boot. Then run 'update-grub' to fix grub config."
exit 0
fi
RBD=$(resolve_device "$ROOT")
if [ "x$RBD" = "x" ]; then
echo "urbackup-setup-snapshot: root device not found. Not setting up snapshotting." > /dev/kmsg
exit 0
fi
echo "urbackup-setup-snapshot: root block device $RBD" > /dev/kmsg

View File

@ -3441,14 +3441,14 @@ void ClientConnector::update_silent(void)
Server->getThreadPool()->execute(new UpdateSilentThread(), "silent client update");
}
bool ClientConnector::calculateFilehashesOnClient(const std::string& clientsubname)
bool ClientConnector::calculateFilehashesOnClient(const std::string& clientsubname, int facet_id)
{
if(internet_conn)
{
std::string settings_fn = "urbackup/data/settings.cfg";
std::string settings_fn = "urbackup/data_" + convert(facet_id) + "/settings.cfg";
if(!clientsubname.empty())
{
settings_fn = "urbackup/data/settings_"+clientsubname+".cfg";
settings_fn = "urbackup/data_" + convert(facet_id) + "/settings_"+clientsubname+".cfg";
}
ISettingsReader *curr_settings=Server->createFileSettingsReader(settings_fn);

View File

@ -278,7 +278,7 @@ private:
void tochannelSendStartbackup(RunningAction backup_type, const std::string& virtual_client);
void ImageErr(const std::string &msg);
void update_silent(void);
bool calculateFilehashesOnClient(const std::string& clientsubname);
bool calculateFilehashesOnClient(const std::string& clientsubname, int facet_id);
void sendStatus();
bool sendChannelPacket(const SChannel& channel, const std::string& msg);
bool versionNeedsUpdate(const std::string& local_version, const std::string& server_version);

View File

@ -389,7 +389,7 @@ void ClientConnector::CMD_START_INCR_FILEBACKUP(const std::string &cmd, const st
flags |= flag_end_to_end_verification;
}
if(calculateFilehashesOnClient(clientsubname))
if(calculateFilehashesOnClient(clientsubname, facet_id))
{
flags |= flag_calc_checksums;
}
@ -582,7 +582,7 @@ void ClientConnector::CMD_START_FULL_FILEBACKUP(const std::string &cmd, const st
flags |= flag_end_to_end_verification;
}
if(calculateFilehashesOnClient(clientsubname))
if(calculateFilehashesOnClient(clientsubname, facet_id))
{
flags |= flag_calc_checksums;
}

View File

@ -1149,6 +1149,7 @@ namespace restore
{
std::string resize_ntfs(int64 new_size, const std::string& disk_fn, std::atomic<int>& pc_complete)
{
#ifndef _WIN32
FILE* in = NULL;
in = popen(("stdbuf -o0 ntfsresize -f -f -s "+std::to_string(new_size)+" \""+disk_fn+"\" 2>&1").c_str(), "re");
if(in==NULL)
@ -1198,6 +1199,8 @@ namespace restore
return "Error runnning resize command. Rc: "+std::to_string(rc)+". Output: "+out;
}
#endif
return std::string();
}
}

View File

@ -309,9 +309,10 @@ SparseFile::SPosMap SparseFile::nextBackingOffset()
SparseFile::SPosMap SparseFile::lastBackingOffset(int64 offset)
{
std::vector<SPosMap>::iterator it = std::lower_bound(sparse_offsets.begin(), sparse_offsets.end(), SPosMap(offset, -1));
if (it != sparse_offsets.end())
std::vector<SPosMap>::iterator it = std::upper_bound(sparse_offsets.begin(), sparse_offsets.end(), SPosMap(offset, -1));
if (it != sparse_offsets.begin())
{
--it;
return *it;
}
else

View File

@ -1424,6 +1424,9 @@ bool FileClient::Reconnect(void)
return ERR_ERROR;
}
if(received>0)
file->Seek(received);
{
IScopedLock lock(mutex);
sparse_bytes += sparse_file->getSparseSize();

View File

@ -453,7 +453,7 @@ namespace backupaccess
}
IQuery *q=db->Prepare("SELECT id, strftime('"+helper.getTimeFormatString()+"', backuptime) AS t_backuptime, incremental, size_bytes, "
"archived, archive_timeout, path, delete_pending, deletion_protection, delete_client_pending FROM backups WHERE complete=1 AND done=1 AND clientid=? ORDER BY backuptime DESC");
"archived, archive_timeout, path, delete_pending, deletion_protected, delete_client_pending FROM backups WHERE complete=1 AND done=1 AND clientid=? ORDER BY backuptime DESC");
q->Bind(t_clientid);
db_results res=q->Read();
JSON::Array backups;
@ -480,7 +480,7 @@ namespace backupaccess
obj.set("backuptime", watoi64(res[i]["t_backuptime"]));
obj.set("incremental", watoi(res[i]["incremental"]));
obj.set("size_bytes", watoi64(res[i]["size_bytes"]));
obj.set("deletion_protection", watoi(res[i]["deletion_protection"]));
obj.set("deletion_protected", watoi(res[i]["deletion_protected"]));
obj.set("delete_client_pending", watoi(res[i]["delete_client_pending"]));
int archived = watoi(res[i]["archived"]);
obj.set("archived", watoi(res[i]["archived"]));