Skip to content

Printing values for Get Operation #40

@kineticDrive

Description

@kineticDrive

Hello,
I am failing to print the values that I get from the Get operation for the key value pairs.

  // Get Operation begins here

  OpStatus get_status[num_ops];

  for (i = 0; i < num_ops; i++)
    {
      get_status[i] = (OpStatus)
        {
          .sem = KineticSemaphore_Create(),
          .status = KINETIC_STATUS_INVALID,
        };
    };

  uint8_t tag_data[] = {0x00, 0x01, 0x02, 0x03};
  ByteBuffer tag = ByteBuffer_Create(tag_data, sizeof(tag_data), sizeof(tag_data));

  for ( i = 0; i < num_ops; i++)
    {
      value_data[6] = '0' + i;
      ByteBuffer value = ByteBuffer_MallocAndAppend(value_data, sizeof(value_data));

      ByteBuffer gettag = ByteBuffer_Malloc(tag.bytesUsed);
      ByteBuffer getvalue = ByteBuffer_Malloc(value.bytesUsed);

      key_data[4] = '0' + i;
      ByteBuffer key = ByteBuffer_MallocAndAppend(key_data, sizeof(key_data));

      KineticEntry entry =
        {
          .key = key,
          .tag = gettag,
          .algorithm = KINETIC_ALGORITHM_SHA1,
          .value = getvalue,
          .force = true,
        };

      temp_closures = (KineticCompletionClosure)
        {
          .callback = op_finished,
          .clientData = &get_status[i],
        };

      KineticStatus status_get = KineticClient_Get(session, &entry, &temp_closures);

      if (status_get != KINETIC_STATUS_SUCCESS)
        {
          fprintf(stderr, "Get failed w/status: %s\n", Kinetic_GetStatusDescription(status));
          return 1;
        }
      **// Correct value is not getting printed**
    __ // This line should produce valueX01 and so on for the keys that I am giving__
      printf (" returned key is %" PRIu8 "\n", *(getvalue.array.data));
    }

   num_failures = 0;
   for (i = 0; i < num_ops; i++)
     {
       KineticSemaphore_WaitForSignalAndDestroy(get_status[i].sem);
       if (get_status[i].status != KINETIC_STATUS_SUCCESS)
         {
           fprintf(stderr, "PUT %zu of %zu failed w/status: %s\n",
                   i+1, num_ops, Kinetic_GetStatusDescription(get_status[i].status));
           num_failures++;
         }
     }

What is the error here? Why am I not able to print the values ?
What is the correct method to get the values back for the given keys?

This is the output I am getting
10, 10, 1, 1
========================================
Throughput Test
========================================
Entry Size:  10 bytes
Count:       10 entries
Random_Keys: 1

Logging kinetic-c output to console (stdout) w/ log_level=1
1445712197.158015  kinetic-c version: v0.12.0 (protocol: v3.0.5, commit: e7b9a86b6ecf675d421a8a927f46b9bc83007bd8)
1445712197.162627  Connecting to XXX.XX.XX.XX:8123
1445712197.163360  Successfully connected to XXX.XX.XX.XX:8123 (fd=267)
1445712197.164934  Received connection ID 749851421 for session 0x2191660
 the string value is valueX0
 the string value is valueX1
 the string value is valueX2
 the string value is valueX3
 the string value is valueX4
 the string value is valueX5
 the string value is valueX6
 the string value is valueX7
 the string value is valueX8
 the string value is valueX9
 returned key is 0
 returned key is 0
 returned key is 0
 returned key is 0
 returned key is 0
 returned key is 0
 returned key is 0
 returned key is 0
 returned key is 0
 returned key is 0
1445712197.773922  Closing socket with fd=267

I am trying to attach the .c file with this snippet but the forum is not allowing me to do so. How can I send you the code so that you could run it and check ?

Regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions