Hi Alex,

I have created 10K sections ( please find the attached test application `Alex_test_node_A_app.c` & `Alex_test_node_B_app.c ` ) with your specified scenario & configuration and I haven't observed any issue with sections on another node.

Try to reproduce the problem on your setup & let me know the result .

One more importent point how much did you configured `sectionCreationAttributes.expirationTime ` ?
I configured  SA_TIME_ONE_DAY.

Steps to rung the application :

===================================================================================================================

Compile :

NODE-A# gcc Alex_test_node_A_app.c -o checkpoint_A -lSaCkpt
NODE-A# gcc Alex_test_node_B_app.c -o checkpoint_B -lSaCkpt


Run :

1) saCkptCheckpointOpen On node A

NODE-A# ./checkpoint_A

CPSV:CPA:ONsaCkptSectionCreate Waiting to Create Sections safCkpt=test_checkpoint_name1,safApp=safCkptService....
saCkptSectionCreate Press <Enter> key to continue...

.
2) saCkptCheckpointOpen() same ckpt On node B

NODE-B# ./checkpoint_B

CPSV:CPA:ONsaCkptSectionIterationInitialize Waiting to read Sections safCkpt=test_checkpoint_name1,safApp=safCkptService.... saCkptActiveReplicaSet saCkptSectionIterationInitialize Press <Enter> key to continue...


3) saCkptSectionCreate() On node A  and read saCkptCheckpointStatusGet()

NODE-A#
 checkpointStatus.numberOfSections : 10000
 checkpointStatus.memoryUsed :756000
  checkpointCreationAttributes.creationFlags;10
 checkpointCreationAttributes.checkpointSize;10240000
 checkpointCreationAttributes.retentionDuration;60000000000
 checkpointCreationAttributes.maxSections;10000
 checkpointCreationAttributes.maxSectionSize;1024
 checkpointCreationAttributes.maxSectionIdSize;64
 ================================
saCkptCheckpointUnlink / saCkptCheckpointClose / saCkptFinalize Press <Enter> key to continue...
saCkptCheckpoint Press <Enter> key to continue...


4) saCkptActiveReplicaSet() & On node B  and saCkptCheckpointStatusGet()

NODE-B#
 checkpointStatus.numberOfSections : 10000
 checkpointStatus.memoryUsed :756000
  checkpointCreationAttributes.creationFlags;10
 checkpointCreationAttributes.checkpointSize;10240000
 checkpointCreationAttributes.retentionDuration;60000000000
 checkpointCreationAttributes.maxSections;10000
 checkpointCreationAttributes.maxSectionSize;1024
 checkpointCreationAttributes.maxSectionIdSize;64

saCkptCheckpointUnlink / saCkptCheckpointClose / saCkptFinalize Press <Enter> key to continue...
 saCkptCheckpoint Press <Enter> key to continue..

================================================================================================================================

-AVM


On 1/6/2014 12:32 PM, A V Mahesh wrote:
Hi Alex,

We never tested the 7500 sections , will test & and let you know , can you please share your test application ,
 that allow us to respond quick.

-AVM

On 1/3/2014 8:23 PM, Alex Jones wrote:
Hello All,

I'm experimenting with the checkpoint service, and some things don't appear to work.

The saCkptActiveReplicaSet and saCkptCheckpointSynchronize[Async] don't appear to work when the checkpoint has section numbers greater than around 5500.

I've created a checkpoint with 7500 sections, each section being 1024 bytes. The checkpoint is co-located and the "active replica" bit is set.

I can create and write all the sections. And from another node I run saCkptCheckpointStatusGet, and the information all looks good. Everything is there. I see no errors from any CKPT API calls.

The problem comes when I call saCkptActiveReplicaSet from this other node. After I do this, saCkptCheckpointStatusGet now returns all the same information except the number of sections is no longer 7500 but 0. If I do this test with 50,000 sections only about 3,000 entries get synced. And iterating through the sections shows that there are only 3,000 sections.

Calling saCkptCheckpointSynchronize[Async] in this situation has no effect, either.

After looking through the code I see a comment in cpnd_evt_proc_ckpt_arep_set that says "/* ###TBD sync up is missing with old active if now this fellow is becoming active. */" So, it doesn't appear that syncing is being done in the saCkptActiveReplicaSet, which it should be.

     Can someone comment?

I'm going to fix this and post a patch unless someone else is already working on it, but I didn't see a bug for it.

Alex



------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


#include <saCkpt.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>

SaCkptHandleT ckptHandle;
#define DEMO_CKPT_NAME "safCkpt=test_checkpoint_name1,safApp=safCkptService"
int is_active = 1;

void AppCkptOpenCallback(SaInvocationT invocation, SaCkptCheckpointHandleT 
checkpointHandle, SaAisErrorT error);
void AppCkptSyncCallback(SaInvocationT invocation, SaAisErrorT error);

void AppCkptOpenCallback(SaInvocationT invocation, SaCkptCheckpointHandleT 
checkpointHandle, SaAisErrorT error)
{
        if (error != SA_AIS_OK) {
                printf("Checkpoint Open Async callback unsuccessful\n");
                return;
        }
        else{
                printf("Checkpoint Open Async callback success and ckpt_hdl 
%llu \n",checkpointHandle);
                return;
        }
}
void AppCkptSyncCallback(SaInvocationT invocation, SaAisErrorT error)
{
        if (error != SA_AIS_OK) {
                printf("Checkpoint Sync Callback unsuccessful\n");
                return;
        }
        else    {
                printf("Checkpoint Sync Callback success\n");
                return;
        }
}


SaVersionT    version = {'B', 2, 2};

void checkpoint_loop(unsigned int thread_number) {
        SaAisErrorT result;
        unsigned char read_buff[10001][100];

        SaCkptCheckpointDescriptorT checkpointStatus;
        memset(&checkpointStatus, '\0', sizeof(SaCkptCheckpointDescriptorT));

        SaUint32T erroneousVectorIndex;
        SaCkptIOVectorElementT writeVector[10001], readVector[10001];
        char init_data1[] = 
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
        char init_data2[] = 
"BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB";
        char init_data3[] = 
"CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC";
        char init_data4[] = 
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD";
        char init_data5[] = 
"EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE";
        char wdata[]      = "POLARIS WIRELESS INC POLARIS WIRELESS INC POLARIS 
WIRELESS INC POLARIS WIRELESS INCPOLARIS WIRELESS";
        SaNameT checkpointName = {0, ""};
        SaCkptCheckpointOpenFlagsT checkpointOpenFlags;

        const SaTimeT timeout = 1000000000;
        SaCkptCheckpointHandleT checkpointHandle;
        int asynchronous = 0 ;

        SaCkptSectionCreationAttributesT sectionCreationAttributes;

        SaUint32T dummy;
        checkpointName.length = snprintf((char*)checkpointName.value,
                        sizeof(checkpointName.value),
                        DEMO_CKPT_NAME);

        if(checkpointName.length >= sizeof(checkpointName.value)) {
                checkpointName.length = sizeof(checkpointName.value) - 1;
        }

        /*UN-comment below if asynchronous is configured */
        asynchronous = 1;       

        const SaCkptCheckpointCreationAttributesT checkpointCreationAttributes 
= {
                //.creationFlags     = SA_CKPT_WR_ALL_REPLICAS,  // 
Non-collocated synchronous
                //.creationFlags     = SA_CKPT_CHECKPOINT_COLLOCATED | 
SA_CKPT_WR_ALL_REPLICAS,  //collocated synchronous
                .creationFlags     = SA_CKPT_CHECKPOINT_COLLOCATED | 
SA_CKPT_WR_ACTIVE_REPLICA, //collocated Asynchronous
                .checkpointSize    = 1024 * 10000,
                .retentionDuration = SA_TIME_ONE_MINUTE,
                .maxSections       = 10000,
                .maxSectionSize    = 1024,                      
                .maxSectionIdSize  = 64
        };

        checkpointOpenFlags = SA_CKPT_CHECKPOINT_CREATE | 
SA_CKPT_CHECKPOINT_WRITE  | SA_CKPT_CHECKPOINT_READ;
        result = saCkptCheckpointOpen(ckptHandle,
                        &checkpointName,
                        &checkpointCreationAttributes,
                        checkpointOpenFlags,
                        timeout,
                        &checkpointHandle);

        if(result != SA_AIS_OK) {
                if (result == SA_AIS_ERR_EXIST )
                {
                        checkpointOpenFlags =  SA_CKPT_CHECKPOINT_WRITE  | 
SA_CKPT_CHECKPOINT_READ;
                        result = saCkptCheckpointOpen(ckptHandle,
                                        &checkpointName,
                                        &checkpointCreationAttributes,
                                        checkpointOpenFlags,
                                        timeout,
                                        &checkpointHandle);
                        if(result != SA_AIS_OK) {
                                fprintf(stderr,"saCkptCheckpointOpen  returned 
%d.\n", result);
                                exit(0);
                        }
                } else {
                        fprintf(stderr," Create saCkptCheckpointOpen  returned 
%d.\n", result);
                        exit(0);
                }
        }
#if 1
        /* Do this only when u get a active csi assignment and the checkpoint 
is async collocated */
        if (asynchronous == 1 && is_active == 1 ) {
                result = saCkptActiveReplicaSet(checkpointHandle);
                if(result != SA_AIS_OK) {
                        fprintf(stderr,"saCkptActiveReplicaSet  returned 
%d.\n", result);
                        exit(0);
                }
        }
#endif

        printf("saCkptSectionCreate  Waiting to Create Sections  
%s....\n",DEMO_CKPT_NAME);
        printf("saCkptSectionCreate Press <Enter> key to continue...\n");
        getchar();
        char section_id_str[25];
        sectionCreationAttributes.sectionId = (SaCkptSectionIdT*) 
malloc(sizeof(SaCkptSectionIdT));

        int i = 0;
        for ( i = 0 ; i <2000 ; i++) 
        {
                sprintf((unsigned 
char*)section_id_str,"test_section_keyname1_%d",i);
                sectionCreationAttributes.sectionId->id = (unsigned char 
*)section_id_str;
                sectionCreationAttributes.sectionId->idLen = 
strlen(sectionCreationAttributes.sectionId->id);

                printf("saCkptSectionCreated : %s idLen: %d 
\n",sectionCreationAttributes.sectionId->id,sectionCreationAttributes.sectionId->idLen);

                sectionCreationAttributes.expirationTime = SA_TIME_ONE_DAY;

                result  = saCkptSectionCreate( checkpointHandle,
                                
&sectionCreationAttributes,init_data1,strlen(init_data1));
                if(result != SA_AIS_OK && result != SA_AIS_ERR_EXIST ) {
                        fprintf(stderr, " saCkptSectionCreate 1  returned 
%d.\n", result);
                        exit(0);
                }
                usleep(1000);

                sprintf((unsigned 
char*)section_id_str,"test_section_keyname2_%d",i);
                sectionCreationAttributes.sectionId->id = (unsigned char 
*)section_id_str;
                sectionCreationAttributes.sectionId->idLen = 
strlen(sectionCreationAttributes.sectionId->id);           
                printf("saCkptSectionCreated : %s idLen: %d 
\n",sectionCreationAttributes.sectionId->id,sectionCreationAttributes.sectionId->idLen);
            
                result  = saCkptSectionCreate( checkpointHandle,
                                
&sectionCreationAttributes,init_data2,strlen(init_data2));
                if(result != SA_AIS_OK && result != SA_AIS_ERR_EXIST ) {
                        fprintf(stderr, " saCkptSectionCreate 2  returned 
%d.\n", result);
                        exit(0);
                }
                usleep(1000);

                sprintf((unsigned 
char*)section_id_str,"test_section_keyname3_%d",i);    
                sectionCreationAttributes.sectionId->id = (unsigned char 
*)section_id_str;
                sectionCreationAttributes.sectionId->idLen = 
strlen(sectionCreationAttributes.sectionId->id);
                printf("saCkptSectionCreated : %s idLen: %d 
\n",sectionCreationAttributes.sectionId->id,sectionCreationAttributes.sectionId->idLen);

                result  = saCkptSectionCreate( checkpointHandle,
                                
&sectionCreationAttributes,init_data3,strlen(init_data3));
                if(result != SA_AIS_OK && result != SA_AIS_ERR_EXIST ) {
                        fprintf(stderr, " saCkptSectionCreate 3  returned 
%d.\n", result);
                        exit(0);
                }
                usleep(1000);

                sprintf((unsigned 
char*)section_id_str,"test_section_keyname4_%d",i);                          
                sectionCreationAttributes.sectionId->id = (unsigned char 
*)section_id_str;
                sectionCreationAttributes.sectionId->idLen = 
strlen(sectionCreationAttributes.sectionId->id);
                printf("saCkptSectionCreated : %s idLen: %d 
\n",sectionCreationAttributes.sectionId->id,sectionCreationAttributes.sectionId->idLen);


                result  = saCkptSectionCreate( checkpointHandle,
                                
&sectionCreationAttributes,init_data4,strlen(init_data4));
                if(result != SA_AIS_OK  &&  result != SA_AIS_ERR_EXIST ) {
                        fprintf(stderr, " saCkptSectionCreate 4  returned 
%d.\n", result);
                        exit(0);
                }
                usleep(1000);

                sprintf((unsigned 
char*)section_id_str,"test_section_keyname5_%d",i);       
                sectionCreationAttributes.sectionId->id = (unsigned char 
*)section_id_str;
                sectionCreationAttributes.sectionId->idLen = 
strlen(sectionCreationAttributes.sectionId->id);
                printf("saCkptSectionCreated : %s idLen: %d 
\n",sectionCreationAttributes.sectionId->id,sectionCreationAttributes.sectionId->idLen);

                result  = saCkptSectionCreate( checkpointHandle,
                                
&sectionCreationAttributes,init_data5,strlen(init_data5));
                if(result != SA_AIS_OK && result != SA_AIS_ERR_EXIST ) {
                        fprintf(stderr, " saCkptSectionCreate 5  returned 
%d.\n", result);
                        exit(0);

                }
                usleep(1000);
        }

        fprintf(stderr, "\nsaCkptSectionCreate  completed Sucessfull.\n"); 
        SaCkptSectionIterationHandleT sectionIterationHandle;
        SaCkptSectionsChosenT sectionsChosen = SA_CKPT_SECTIONS_ANY;
        SaCkptSectionDescriptorT sectionDescriptor;
        int iter_flag = 1;
        char secid[10001][128] = {'\0'};
        char secidw[10001][128] = {'\0'};
        int total = 0;

        /* Iteration Sequence not really required TBD*/
        result = saCkptSectionIterationInitialize(checkpointHandle,
                        sectionsChosen,
                        0,
                        &sectionIterationHandle);
        if(result != SA_AIS_OK) {
                fprintf(stderr, "saCkptSectionIterationInitialize returned 
%lld.\n",(long long int)result);
        } else {
                fprintf(stderr, "saCkptSectionIterationInitialize returned 
%lld.\n",(long long int)result);

                memset(&sectionDescriptor, 0, sizeof(SaCkptSectionDescriptorT));
                while(iter_flag) {
                        result = 
saCkptSectionIterationNext(sectionIterationHandle,
                                        &sectionDescriptor);
                        if(result != SA_AIS_OK) {
                                if(result == SA_AIS_ERR_NO_SECTIONS) {
                                        iter_flag = 0;
                                        fprintf(stderr, 
"saCkptSectionIterationNext completed Sucessfull.\n");
                                } else {
                                        fprintf(stderr, 
"saCkptSectionIterationNext returned %lld.\n", (long long int)result);
                                }
                        } else {

                                fprintf(stderr,"saCkptSectionIterationNext 
TOTAL %d returned %lld.\n",total ,(long long int)result);
                                usleep(1000);
                                total ++;
                        }
                }

                fprintf(stderr,"saCkptSectionIterationNext TOTAL-sections: %d 
\n",total);  
                result = saCkptSectionIterationFinalize(sectionIterationHandle);
                if(result != SA_AIS_OK) {
                        fprintf(stderr, "saCkptSectionIterationFinalize 
returned %lld.\n",
                                        (long long int)result);
                }
        }


        memset(&checkpointStatus, '\0', sizeof(SaCkptCheckpointDescriptorT));
        result  = saCkptCheckpointStatusGet( checkpointHandle,
                        &checkpointStatus);


        if(result != SA_AIS_OK) {
                fprintf(stderr,
                                " saCkptCheckpointStatusGet  returned %d.\n", 
result);
                exit(0);

        }
        else {

                fprintf(stderr," checkpointStatus.numberOfSections : %lu\n 
checkpointStatus.memoryUsed :%lu\n ", 
checkpointStatus.numberOfSections,checkpointStatus.memoryUsed);

                fprintf(stderr," 
checkpointCreationAttributes.creationFlags;%lu\n 
checkpointCreationAttributes.checkpointSize;%llu\n 
checkpointCreationAttributes.retentionDuration;%llu\n 
checkpointCreationAttributes.maxSections;%lu \n 
checkpointCreationAttributes.maxSectionSize;%llu \n 
checkpointCreationAttributes.maxSectionIdSize;%llu \n 
================================\n", 
checkpointCreationAttributes.creationFlags, 
checkpointCreationAttributes.checkpointSize, 
checkpointCreationAttributes.retentionDuration,checkpointCreationAttributes.maxSections,
 
checkpointCreationAttributes.maxSectionSize,checkpointCreationAttributes.maxSectionIdSize);
        }

        printf("saCkptCheckpointUnlink / saCkptCheckpointClose / saCkptFinalize 
Press <Enter> key to continue...\n");
        printf("saCkptCheckpoint Press <Enter> key to continue...\n");
        getchar();

#if 0
        if (is_active == 1 ) {
                result  = saCkptCheckpointUnlink(ckptHandle,&checkpointName);
                if(result != SA_AIS_OK) {
                        fprintf(stderr, "saCkptCheckpointUnlink returned 
%d.\n", (long long int)result);
                }       
        }
#endif

        result = saCkptCheckpointClose(checkpointHandle);
        if(result != SA_AIS_OK) {
                fprintf(stderr, "saCkptCheckpointClose returned %d.\n", (long 
long int)result);
        }

        result = saCkptFinalize(ckptHandle);
        if(result != SA_AIS_OK) {
                fprintf(stderr, "saCkptFinalize  returned %d.\n",(long long 
int)result);
                exit(0);
        }
        printf("PASSED \n");
        exit(0);

}




int main(int argc, char** argv) {
        int           result;
        pthread_t     thread;

        SaCkptCallbacksT callbk;

        callbk.saCkptCheckpointOpenCallback = AppCkptOpenCallback;
        callbk.saCkptCheckpointSynchronizeCallback = AppCkptSyncCallback;
        result = saCkptInitialize(&ckptHandle, &callbk, &version);
        if(result != SA_AIS_OK) {
                fprintf(stderr, "saCkptInitialize failed with code %d.\n", 
result);
        } else {
                checkpoint_loop(1);
        }
        return result;
}



#include <saCkpt.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>

SaCkptHandleT ckptHandle;
#define DEMO_CKPT_NAME "safCkpt=test_checkpoint_name1,safApp=safCkptService"
int is_active = 0;

void AppCkptOpenCallback(SaInvocationT invocation, SaCkptCheckpointHandleT 
checkpointHandle, SaAisErrorT error);
void AppCkptSyncCallback(SaInvocationT invocation, SaAisErrorT error);

void AppCkptOpenCallback(SaInvocationT invocation, SaCkptCheckpointHandleT 
checkpointHandle, SaAisErrorT error)
{
        if (error != SA_AIS_OK) {
                printf("Checkpoint Open Async callback unsuccessful\n");
                return;
        }
        else{
                printf("Checkpoint Open Async callback success and ckpt_hdl 
%llu \n",checkpointHandle);
                return;
        }
}
void AppCkptSyncCallback(SaInvocationT invocation, SaAisErrorT error)
{
        if (error != SA_AIS_OK) {
                printf("Checkpoint Sync Callback unsuccessful\n");
                return;
        }
        else    {
                printf("Checkpoint Sync Callback success\n");
                return;
        }
}


SaVersionT    version = {'B', 2, 2};

void checkpoint_loop(unsigned int thread_number) {
        SaAisErrorT result;
        unsigned char read_buff[10001][100];

        SaCkptCheckpointDescriptorT checkpointStatus;
        memset(&checkpointStatus, '\0', sizeof(SaCkptCheckpointDescriptorT));

        SaUint32T erroneousVectorIndex;
        SaCkptIOVectorElementT writeVector[10001], readVector[10001];
        char init_data1[] = 
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
        char init_data2[] = 
"BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB";
        char init_data3[] = 
"CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC";
        char init_data4[] = 
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD";
        char init_data5[] = 
"EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE";
        char wdata[]      = "POLARIS WIRELESS INC POLARIS WIRELESS INC POLARIS 
WIRELESS INC POLARIS WIRELESS INCPOLARIS WIRELESS";
        SaNameT checkpointName = {0, ""};
        SaCkptCheckpointOpenFlagsT checkpointOpenFlags;

        const SaTimeT timeout = 1000000000;
        SaCkptCheckpointHandleT checkpointHandle;
        int asynchronous = 0 ;

        SaCkptSectionCreationAttributesT sectionCreationAttributes;

        SaUint32T dummy;
        checkpointName.length = snprintf((char*)checkpointName.value,
                        sizeof(checkpointName.value),
                        DEMO_CKPT_NAME);

        if(checkpointName.length >= sizeof(checkpointName.value)) {
                checkpointName.length = sizeof(checkpointName.value) - 1;
        }

        /*UN-comment below if asynchronous is configured */
        asynchronous = 1;       

        const SaCkptCheckpointCreationAttributesT checkpointCreationAttributes 
= {
                //.creationFlags     = SA_CKPT_WR_ALL_REPLICAS,  // 
Non-collocated synchronous
                //.creationFlags     = SA_CKPT_CHECKPOINT_COLLOCATED | 
SA_CKPT_WR_ALL_REPLICAS,  //collocated synchronous
                .creationFlags     = SA_CKPT_CHECKPOINT_COLLOCATED | 
SA_CKPT_WR_ACTIVE_REPLICA, //collocated Asynchronous
                .checkpointSize    = 1024 * 10000,
                .retentionDuration = SA_TIME_ONE_MINUTE,
                .maxSections       = 10000,
                .maxSectionSize    = 1024,                      
                .maxSectionIdSize  = 64
        };

        checkpointOpenFlags =  SA_CKPT_CHECKPOINT_WRITE  | 
SA_CKPT_CHECKPOINT_READ;
        result = saCkptCheckpointOpen(ckptHandle,
                        &checkpointName,
                        &checkpointCreationAttributes,
                        checkpointOpenFlags,
                        timeout,
                        &checkpointHandle);

        if(result != SA_AIS_OK) {
                if (result == SA_AIS_ERR_EXIST )
                {
                        checkpointOpenFlags =  SA_CKPT_CHECKPOINT_WRITE  | 
SA_CKPT_CHECKPOINT_READ;
                        result = saCkptCheckpointOpen(ckptHandle,
                                        &checkpointName,
                                        &checkpointCreationAttributes,
                                        checkpointOpenFlags,
                                        timeout,
                                        &checkpointHandle);
                        if(result != SA_AIS_OK) {
                                fprintf(stderr,"saCkptCheckpointOpen  returned 
%d.\n", result);
                                exit(0);
                        }
                } else {
                        fprintf(stderr," Create saCkptCheckpointOpen  returned 
%d.\n", result);
                        exit(0);
                }
        }
        
        
        printf("saCkptSectionIterationInitialize  Waiting to read Sections  
%s....\n",DEMO_CKPT_NAME);
        printf("saCkptActiveReplicaSet saCkptSectionIterationInitialize Press 
<Enter> key to continue...\n");
        getchar();


        /* Do this only when u get a active csi assignment and the checkpoint 
is async collocated */
        if (asynchronous == 1 ) {
                result = saCkptActiveReplicaSet(checkpointHandle);
                if(result != SA_AIS_OK) {
                        fprintf(stderr,"saCkptActiveReplicaSet  returned 
%d.\n", result);
                        exit(0);
                }
        }

        char section_id_str[25];
        sectionCreationAttributes.sectionId = (SaCkptSectionIdT*) 
malloc(sizeof(SaCkptSectionIdT));

        SaCkptSectionIterationHandleT sectionIterationHandle;
        SaCkptSectionsChosenT sectionsChosen = SA_CKPT_SECTIONS_ANY;
        SaCkptSectionDescriptorT sectionDescriptor;
        int iter_flag = 1;
        char secid[10001][128] = {'\0'};
        char secidw[10001][128] = {'\0'};
        int total = 0;

        /* Iteration Sequence not really required TBD*/
        result = saCkptSectionIterationInitialize(checkpointHandle,
                        sectionsChosen,
                        0,
                        &sectionIterationHandle);
        if(result != SA_AIS_OK) {
                fprintf(stderr, "saCkptSectionIterationInitialize returned 
%lld.\n",(long long int)result);
        } else {
                fprintf(stderr, "saCkptSectionIterationInitialize returned 
%lld.\n",(long long int)result);

                memset(&sectionDescriptor, 0, sizeof(SaCkptSectionDescriptorT));
                while(iter_flag) {
                        result = 
saCkptSectionIterationNext(sectionIterationHandle,
                                        &sectionDescriptor);
                        if(result != SA_AIS_OK) {
                                if(result == SA_AIS_ERR_NO_SECTIONS) {
                                        iter_flag = 0;
                                        fprintf(stderr, 
"saCkptSectionIterationNext completed Sucessfull.\n");
                                } else {
                                        fprintf(stderr, 
"saCkptSectionIterationNext returned %lld.\n", (long long int)result);
                                }
                        } else {

                                fprintf(stderr,"saCkptSectionIterationNext 
TOTAL %d returned %lld.\n",total ,(long long int)result);
                                usleep(1000);
                                total ++;
                        }
                }

                fprintf(stderr,"saCkptSectionIterationNext TOTAL-sections: %d 
\n",total);  
                result = saCkptSectionIterationFinalize(sectionIterationHandle);
                if(result != SA_AIS_OK) {
                        fprintf(stderr, "saCkptSectionIterationFinalize 
returned %lld.\n",
                                        (long long int)result);
                }
        }


        memset(&checkpointStatus, '\0', sizeof(SaCkptCheckpointDescriptorT));
        result  = saCkptCheckpointStatusGet( checkpointHandle,
                        &checkpointStatus);


        if(result != SA_AIS_OK) {
                fprintf(stderr,
                                " saCkptCheckpointStatusGet  returned %d.\n", 
result);
                exit(0);

        }
        else {

                fprintf(stderr," checkpointStatus.numberOfSections : %lu\n 
checkpointStatus.memoryUsed :%lu\n ", 
checkpointStatus.numberOfSections,checkpointStatus.memoryUsed);

                fprintf(stderr," 
checkpointCreationAttributes.creationFlags;%lu\n 
checkpointCreationAttributes.checkpointSize;%llu\n 
checkpointCreationAttributes.retentionDuration;%llu\n 
checkpointCreationAttributes.maxSections;%lu \n 
checkpointCreationAttributes.maxSectionSize;%llu \n 
checkpointCreationAttributes.maxSectionIdSize;%llu \n 
================================\n", 
checkpointCreationAttributes.creationFlags, 
checkpointCreationAttributes.checkpointSize, 
checkpointCreationAttributes.retentionDuration,checkpointCreationAttributes.maxSections,
 
checkpointCreationAttributes.maxSectionSize,checkpointCreationAttributes.maxSectionIdSize);
        }

        printf("saCkptCheckpointUnlink / saCkptCheckpointClose / saCkptFinalize 
Press <Enter> key to continue...\n");
        printf("saCkptCheckpoint Press <Enter> key to continue...\n");
        getchar();

#if 0
        if (is_active == 1 ) {
                result  = saCkptCheckpointUnlink(ckptHandle,&checkpointName);
                if(result != SA_AIS_OK) {
                        fprintf(stderr, "saCkptCheckpointUnlink returned 
%d.\n", (long long int)result);
                }       
        }
#endif
        result = saCkptCheckpointClose(checkpointHandle);
        if(result != SA_AIS_OK) {
                fprintf(stderr, "saCkptCheckpointClose returned %d.\n", (long 
long int)result);
        }

        result = saCkptFinalize(ckptHandle);
        if(result != SA_AIS_OK) {
                fprintf(stderr, "saCkptFinalize  returned %d.\n",(long long 
int)result);
                exit(0);
        }
        printf("PASSED \n");
        exit(0);

}




int main(int argc, char** argv) {
        int           result;
        pthread_t     thread;

        SaCkptCallbacksT callbk;

        callbk.saCkptCheckpointOpenCallback = AppCkptOpenCallback;
        callbk.saCkptCheckpointSynchronizeCallback = AppCkptSyncCallback;
        result = saCkptInitialize(&ckptHandle, &callbk, &version);
        if(result != SA_AIS_OK) {
                fprintf(stderr, "saCkptInitialize failed with code %d.\n", 
result);
        } else {
                checkpoint_loop(1);
        }
        return result;
}



------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to