Commit afd00b80 authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Set finished state to false in writer process.

* This prevents accidentally closing the file early.
* Also: Replace cryptic reference notation.
* A newly opened file finish state is set to false by default.
** The write process must wait to receive a close command from each collector
   to prevent file truncation.
parent c400d582
......@@ -147,7 +147,7 @@ static bFiledataPA *initBFiledataPA ( char *filename,
bfd->nfinished = xmalloc ( nc * sizeof ( bfd->nfinished[0] ));
for ( i = 0; i < nc; i++ )
*( bfd->nfinished + i ) = true;
bfd->nfinished[i] = false;
xdebug ( "filename=%s, opened file, return", bfd->name );
......@@ -427,8 +427,6 @@ void pwPOSIXASYNCH ( void )
if (strcmp(filename, bfd->name) != 0)
xabort("filename is not consistent, fileID=%d", rtag->id);
*( bfd->nfinished + source ) = false;
bfd->currOpIndex = bfd->nextOpIndex;
bfd->nextOpIndex = ( bfd->nextOpIndex + 1 ) % nPrefStreams;
......@@ -480,7 +478,7 @@ void pwPOSIXASYNCH ( void )
writePA ( bfd, amount );
bfd->nfinished[source] = true;
bfd->nfinished[source] = true;
bfd->finished = true;
for ( i = 0; i < nProcsCollNode; i++ )
......
......@@ -115,8 +115,7 @@ static bFiledataP * initBFiledataP ( char *filename,
bfp->nfinished = xmalloc ( nc * sizeof ( bfp->nfinished[0] ));
for ( i = 0; i < nc; i++ )
*( bfp->nfinished + i ) = true;
bfp->nfinished[i] = false;
xdebug ( "filename=%s, opened file, return", bfp->name );
......@@ -327,8 +326,6 @@ void pwPOSIXNONB ( void )
if (strcmp(filename, bfd->name) != 0)
xabort("filename is not consistent, fileID=%d", rtag->id);
*( bfd->nfinished + source ) = false;
memcpy(bfd->fb->buffer, pMB, amount);
writeP(bfd, amount);
......@@ -374,12 +371,12 @@ void pwPOSIXNONB ( void )
writeP ( bfd, amount );
*( bfd->nfinished + source ) = true;
bfd->nfinished[source] = true;
bfd->finished = true;
for ( i = 0; i < nProcsCollNode; i++ )
{
if ( *( bfd->nfinished + i ) == false )
if ( bfd->nfinished[i] == false )
{
bfd->finished = false;
break;
......
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