Start a Conversation

Unsolved

This post is more than 5 years old

2537

May 10th, 2010 07:00

XAM Job Query is incorrectly returning zero results

Hello all.

My latest task in integrating XAM into our software is to achieve some form of disaster recovery tool using Job commits and queries. I have mastered the XAMQL syntax used to submit queries and overcome all my error codes, however my issue is that the results count will always be zero, even for trivially generalised queries made using wildcards which should be yielding an enormous number of items. Example code below.

**********************************************************************************************************************************************************

int SearchForContent()
{
    xam_status vStatus = -1;
    xam_string vXRI = "snia-xam://centera_vim!128.221.200.60?C:\\emc\\us2_profile1_rqecw.pea";
    xsystem_handle vXSystem;
    xset_handle vXSet = 0;

     const char QUERY[] = "SELECT \".xset.xuid\"";

     // Connect
    printf("Connect to: %s...\n", vXRI);
    vStatus = XAMLibrary_Connect(vXRI, &vXSystem);
    if (vStatus != 0) return vStatus;
    printf("Connected %i\n", vStatus);

     // Check valid tasks available
    xam_boolean vCap;
    vStatus = XAM_GetBoolean(vXSystem, XAM_XSYSTEM_JOB_COMMIT_SUPPORTED, &vCap);
    printf("Supports commit? %s\n", vCap ? "YES" : "NO");
    vStatus = XAM_GetBoolean(vXSystem, XAM_XSYSTEM_JOB_QUERY_CONTINUANCE_SUPPORTED, &vCap);
    printf("Supports continuance? %s\n", vCap ? "YES" : "NO");
    vStatus = XAM_GetBoolean(vXSystem, XAM_XSYSTEM_JOB_QUERY_LEVEL1_SUPPORTED, &vCap);
    printf("Supports level 1 query? %s\n", vCap ? "YES" : "NO");
    vStatus = XAM_GetBoolean(vXSystem, XAM_XSYSTEM_JOB_QUERY_LEVEL2_SUPPORTED, &vCap);
    printf("Supports level 2 query? %s\n", vCap ? "YES" : "NO");

     // Create XSet
    vStatus = XSystem_CreateXSet(vXSystem, XSET_MODE_MODIFY , &vXSet);

     // Add job command to XSet
    vStatus = XAM_CreateString(vXSet, XAM_JOB_COMMAND, true, XAM_JOB_QUERY);
    if (vStatus != 0) return vStatus;

     // Add query to XSet (stream)
    xstream_handle vQueryStream = 0;
    vStatus = XAM_CreateXStream(vXSet, XAM_JOB_QUERY_COMMAND, true, XAM_TEXT_PLAIN_MIME_TYPE, &vQueryStream);
    xam_int vWritten;
    vStatus = XStream_Write(vQueryStream, QUERY, strlen(QUERY), &vWritten);
    vStatus = XStream_Close(vQueryStream);

     // Submit the job
    vStatus = XSet_SubmitJob(vXSet);
    if (vStatus != 0) return vStatus;

     //Check the job health
    xam_string vHealth;
    vStatus = XAM_GetString(vXSet, XAM_JOB_ERRORHEALTH, &vHealth);
    printf("Query job health = %s\n", vHealth);

     xam_boolean vResultsFieldExists;
    vStatus = XAM_ContainsField(vXSet, XAM_JOB_QUERY_RESULTS_COUNT, &vResultsFieldExists);
    printf("Results field exists = %s\n", (vResultsFieldExists == 1) ? "YES" : "NO");


    xam_int vResultsCount;
    vStatus = XAM_GetInt(vXSet, XAM_JOB_QUERY_RESULTS_COUNT, &vResultsCount);
    printf("Results count = %i\n", vResultsCount);

    return vStatus;

}

This code typically yields the following output for checking the job status:

Supports commit? NO

Supports continuance? NO

Supports level 1 query? YES
Supports level 2 query? NO

(..job is then processed..)

Query job health = OK

Results field exists = YES

Results count = 0

**********************************************************************************************************************************************************

This feedback makes me wonder if it is not the permissions on the cluster that are the cause. However the filename for the pea file indicates querying is permitted, yet according to feedback from the cluster itself, commit is not. I'm at a loss to see how a query job can be performed without a job commit. Does anyone feel that this is the issue and have any alternative cluster suggestions, or is there something else I am missing? All documentation I have access to has drawn a blank.

Regards,

Jamie

11 Posts

May 10th, 2010 07:00

Additional: I previously use another function to perform a basic write, so I know that there is a xuid on the cluster I myself have put there.

417 Posts

May 11th, 2010 07:00

Jamie - there are sometimes timing issues around the results becoming available after the status is updated.

I would suggest you add a short sleep or loop around until the results count shows non-zero.

Regards, Graham L. Stuart

Centera SDK Architect

11 Posts

May 12th, 2010 05:00

Hi Graham. Currently I'm looping around a XAM_GetInt on the results count, with a 1000 millisecond sleep after each return of zero. I've run it to about 6000 iterations of the loop without a halt so something is still amiss. Should I be inserting my loop earlier? I assumed that, after submitting the job, it would not matter which element I checked since the cluster would update all the XSet when it got round to it, so I selected the results count as the element that I would check and loop around.

Otherwise, anyone think it could be a permissions issue?

11 Posts

May 13th, 2010 04:00

Anyone?

417 Posts

May 13th, 2010 08:00

Jamie - I am at EMC World and will into your issue in more detail on my return to the office next week.

Regards, Graham L. Stuart

Centera SDK Architect

11 Posts

May 14th, 2010 08:00

Aha, that would be very helpful Stuart, thank you.

417 Posts

May 19th, 2010 06:00

Jamie - the code for the Query sample isworking just fine, I suggest that you compare it with your code. I have attached it for your convenience.

Note that you will need to modify the connection string for your requirements - the sample uses the Centera PEA file mechanism for authentication.

1 Attachment

No Events found!

Top