[Openais] openais trunk - modify ckpt-wr to work properly

Steven Dake sdake at redhat.com
Mon Mar 29 08:01:30 PDT 2010


On Mon, 2010-03-29 at 09:58 -0500, Ryan O'Hara wrote:
> On Thu, Mar 25, 2010 at 11:52:25AM -0700, Steven Dake wrote:
> > Ryan,
> > 
> > This test case doesn't work properly when it is built.
> > 
> > See attached patch.
> > 

The test case uses a default section, however, it specifies 5 as max
sections.  This triggers ckpt to reject the creation because dfault
sections may not be used with a max section greater then 1.

This test case uses non-static function declarations for global
variables in the main c file.  This is not proper.

The write element does not set the id for the default section properly
disallowing writing to any write element.

In essence the test case is completely broken and works as intended (to
write a byte of data to a checkpoint section) and after patch that works
properly.

Regards
-steve

> > Regards
> > -steve
> 
> Can you be more descriptive? Thanks.
> 
> 
> 
> > Index: test/ckpt-wr.c
> > ===================================================================
> > --- test/ckpt-wr.c	(revision 2124)
> > +++ test/ckpt-wr.c	(working copy)
> > @@ -50,54 +50,23 @@
> >  
> >  #define SECONDS_TO_EXPIRE 500
> >  
> > -int ckptinv;
> > -void printSaNameT (SaNameT *name)
> > -{
> > -	int i;
> > +static SaVersionT version = { 'B', 1, 1 };
> >  
> > -	for (i = 0; i < name->length; i++) {
> > -		printf ("%c", name->value[i]);
> > -	}
> > -}
> > +static SaNameT checkpointName = { 16, "checkpoint-sync\0" };
> >  
> > -SaVersionT version = { 'B', 1, 1 };
> > -
> > -SaNameT checkpointName = { 16, "checkpoint-sync\0" };
> > -
> > -SaCkptCheckpointCreationAttributesT checkpointCreationAttributes = {
> > +static SaCkptCheckpointCreationAttributesT checkpointCreationAttributes = {
> >  	.creationFlags =        SA_CKPT_WR_ALL_REPLICAS,
> >  	.checkpointSize =       250000,
> >  	.retentionDuration =    SA_TIME_ONE_SECOND * 60,
> > -	.maxSections =          5,
> > +	.maxSections =          1,
> >  	.maxSectionSize =       250000,
> >  	.maxSectionIdSize =     10
> >  };
> >  
> > -char readBuffer1[1025];
> > -
> > -SaCkptIOVectorElementT ReadVectorElements[] = {
> > -	{
> > -		SA_CKPT_DEFAULT_SECTION_ID,
> > -		readBuffer1,
> > -		sizeof (readBuffer1),
> > -		0,
> > -		0
> > -	}
> > -};
> > -
> >  #define DATASIZE 127000
> >  char data[DATASIZE];
> > -SaCkptIOVectorElementT WriteVectorElements[] = {
> > -	{
> > -		SA_CKPT_DEFAULT_SECTION_ID,
> > -		data, /*"written data #1, this should extend past end of old section data", */
> > -		DATASIZE, /*sizeof ("data #1, this should extend past end of old section data") + 1, */
> > -		0, //5,
> > -		0
> > -	}
> > -};
> >  
> > -SaCkptCallbacksT callbacks = {
> > +static SaCkptCallbacksT callbacks = {
> >   	0,
> >  	0
> >  };
> > @@ -108,7 +77,6 @@
> >  	SaCkptHandleT ckptHandle;
> >  	SaCkptCheckpointHandleT checkpointHandle;
> >  	SaAisErrorT error;
> > -	char data[MAX_DATA_SIZE];
> >  	struct timespec delay;
> >  	struct timespec delay2;
> >  	SaCkptIOVectorElementT writeElement;
> > @@ -121,55 +89,39 @@
> >  	error = saCkptInitialize (&ckptHandle, &callbacks, &version);
> >  
> >  	error = saCkptCheckpointOpen (ckptHandle,
> > -			&checkpointName,
> > -			&checkpointCreationAttributes,
> > -			SA_CKPT_CHECKPOINT_CREATE|SA_CKPT_CHECKPOINT_READ|SA_CKPT_CHECKPOINT_WRITE,
> > -			0,
> > -			&checkpointHandle);
> > +		&checkpointName,
> > +		&checkpointCreationAttributes,
> > +		SA_CKPT_CHECKPOINT_CREATE|SA_CKPT_CHECKPOINT_READ|SA_CKPT_CHECKPOINT_WRITE,
> > +		0,
> > +		&checkpointHandle);
> > +
> >  	printf ("%s: initial open of checkpoint\n",
> >  		get_test_output (error, SA_AIS_OK));
> >  
> >  
> > -    do{
> > -			error = saCkptCheckpointRead (checkpointHandle,
> > -				ReadVectorElements,
> > -				1,
> > -				&erroroneousVectorIndex);
> > -			if (error != SA_AIS_OK) {
> > -				if (error == SA_AIS_ERR_TRY_AGAIN) {
> > -					continue;
> > -				}
> > -printf ("error is %d\n", error);
> > -				return (0);
> > -			}
> > +	for (;;) {
> > +		count++;
> > +		sprintf((char*)&data, "%d",(int)count);
> > +		writeElement.sectionId.idLen = 0;
> > +		writeElement.sectionId.id = 0;
> > +		writeElement.dataBuffer = data;
> > +		writeElement.dataSize = strlen (data) + 1;
> > +		writeElement.dataOffset = 0;
> > +		writeElement.readSize = 0;
> >  
> > -			if (ReadVectorElements->dataBuffer == 0) {
> > -				printf ("Default Checkpoint has no data\n");
> > -			} else {
> > -				count = atol((char *)ReadVectorElements->dataBuffer);
> > -			}
> > +		do {
> > +			error = saCkptCheckpointWrite (checkpointHandle,
> > +			&writeElement,
> > +			1,
> > +			&erroroneousVectorIndex);
> >  
> > -			count++;
> > -			sprintf((char*)&data, "%d",(int)count);
> > -			writeElement.sectionId = (SaCkptSectionIdT)SA_CKPT_DEFAULT_SECTION_ID;
> > -			writeElement.dataBuffer = data;
> > -			writeElement.dataSize = strlen (data) + 1;
> > -			writeElement.dataOffset = 0;
> > -			writeElement.readSize = 0;
> > +			printf ("%s: checkpoint write with data %s\n",
> > +			get_test_output (error, SA_AIS_OK), (char*)data);
> > +		} while (error == SA_AIS_ERR_TRY_AGAIN);
> >  
> > -			do {
> > -				error = saCkptCheckpointWrite (checkpointHandle,
> > -					&writeElement,
> > -					1,
> > -					&erroroneousVectorIndex);
> > +		nanosleep(&delay,&delay2);
> > +	}
> >  
> > -				printf ("%s: checkpoint write with data %s\n",
> > -							get_test_output (error, SA_AIS_OK), (char*)data);
> > -			}while (error == SA_AIS_ERR_TRY_AGAIN);
> > -
> > -			nanosleep(&delay,&delay2);
> > -	}while (1);
> > -
> >  	return (0);
> >  
> >  }
> 
> > _______________________________________________
> > Openais mailing list
> > Openais at lists.linux-foundation.org
> > https://lists.linux-foundation.org/mailman/listinfo/openais



More information about the Openais mailing list