Skip to content

Commit

Permalink
[XrdEc] StrmWriter: correctly calc written bytes.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmichal committed Dec 16, 2020
1 parent 8e471fc commit 7a7ed40
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/XrdCl/XrdClLocalFileHandler.cc
Expand Up @@ -32,7 +32,6 @@
#include <string>
#include <memory>
#include <stdexcept>
#include <iostream>

#include <fcntl.h>
#include <stdio.h>
Expand Down
14 changes: 4 additions & 10 deletions src/XrdEc/XrdEcStrmWriter.hh
Expand Up @@ -27,7 +27,6 @@
#include <mutex>
#include <iterator>


namespace XrdEc
{
//---------------------------------------------------------------------------
Expand Down Expand Up @@ -324,12 +323,6 @@ namespace XrdEc
catch( const buff_queue::wait_interrupted& ){ }
}

struct spare_files
{
std::mutex mtx;
std::vector<std::shared_ptr<XrdCl::File>> files;
};

void WriteBuff( std::unique_ptr<WrtBuff> buff )
{
//---------------------------------------------------------------------
Expand All @@ -355,13 +348,15 @@ namespace XrdEc
const size_t nbchunks = objcfg.nbchunks;
std::vector<XrdCl::Pipeline> writes;
writes.reserve( nbchunks );
size_t blknb = next_blknb++;
size_t blknb = next_blknb++;
uint64_t blksize = 0;
for( size_t strpnb = 0; strpnb < nbchunks; ++strpnb )
{
std::string fn = objcfg.obj + '.' + std::to_string( blknb ) + '.' + std::to_string( strpnb );
uint32_t crc32c = wrtbuff->GetCrc32c( strpnb );
uint64_t strpsize = wrtbuff->GetStrpSize( strpnb );
char* strpbuff = wrtbuff->GetStrpBuff( strpnb );
if( strpnb < objcfg.nbdata ) blksize += strpsize;

//-------------------------------------------------------------------
// Find a server where we can append the next data chunk
Expand Down Expand Up @@ -421,12 +416,11 @@ namespace XrdEc
{
zip->CloseFile();
wrtbuff.reset();
global_status.report_wrt( st, strpsize );
} );
writes.emplace_back( std::move( p ) );
}

XrdCl::Async( XrdCl::Parallel( writes ) );
XrdCl::Async( XrdCl::Parallel( writes ) >> [=]( XrdCl::XRootDStatus &st ){ global_status.report_wrt( st, blksize ); } );
}

void CloseImpl( XrdCl::ResponseHandler *handler )
Expand Down

0 comments on commit 7a7ed40

Please sign in to comment.