How does the Scan Policy in C Client SDK work?


I use the modified example from SDK:

    indent preformatted text by 4 spacesbool scan_cb(const as_val* p_val, void* udata)
   if (! p_val) {
      LOG("scan callback returned null - scan is complete");
      return true;
   as_record* p_rec = as_record_fromval(p_val);
   if (! p_rec) {
      LOG("scan callback returned non-as_record object");
      return true;
   return true;

void walk_interests () {
   as_scan scan;
   as_error err;
   as_scan_init(&scan, "dmp", "userdata");

//initialise scan policy:
   as_policy_scan policy;

   LOG("starting scan all ...");

   if (aerospike_scan_foreach(&as, &err, &policy, &scan, scan_cb, NULL) !=
         AEROSPIKE_OK) {
      LOG("aerospike_scan_foreach() returned %d - %s", err.code, err.message);
   LOG("scan finished");

The program generates the following output, regardless of the value of the fail_on_cluster_change field:

starting scan all ...
aerospike_scan_foreach() returned 504 - AEROSPIKE_ERR_CLUSTER_CHANGE