Commit f53e2a9e authored by Cedric CAFFY's avatar Cedric CAFFY
Browse files

In DriveState::addDiskSpaceReservation and substractDiskSpaceReservation, use...

In DriveState::addDiskSpaceReservation and substractDiskSpaceReservation, use a reference to the mutable_disk_space_reservations item
parent e0c5e6ef
......@@ -293,7 +293,7 @@ std::map<std::string, uint64_t> DriveState::getDiskSpaceReservations() {
//------------------------------------------------------------------------------
void DriveState::addDiskSpaceReservation(const std::string& diskSystemName, uint64_t bytes) {
checkPayloadWritable();
for (auto dsr: *m_payload.mutable_disk_space_reservations()) {
for (auto &dsr: *m_payload.mutable_disk_space_reservations()) {
if (dsr.disk_system_name() == diskSystemName) {
dsr.set_reserved_bytes(dsr.reserved_bytes() + bytes);
return;
......@@ -310,7 +310,7 @@ void DriveState::addDiskSpaceReservation(const std::string& diskSystemName, uint
void DriveState::substractDiskSpaceReservation(const std::string& diskSystemName, uint64_t bytes) {
checkPayloadWritable();
size_t index=0;
for (auto dsr: *m_payload.mutable_disk_space_reservations()) {
for (auto &dsr: *m_payload.mutable_disk_space_reservations()) {
if (dsr.disk_system_name() == diskSystemName) {
if (bytes > dsr.reserved_bytes())
throw NegativeDiskSpaceReservationReached(
......
......@@ -3901,6 +3901,7 @@ void OStoreDB::RetrieveMount::reserveDiskSpace(const DiskSpaceReservationRequest
.add("objectName", ds.getAddressIfSet());
lc.log(log::DEBUG, "In RetrieveMount::reserveDiskSpace(): state after reservation.");
}
//TODO BUG HERE, see mountId=\"10\" in downloads/tpsrv0*
ds.commit();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment