Articles in this section

Client delete metrics when using bin convergence and durable deletes

Detail

Why is it then when issuing a client durable delete that the client_delete_success metric is not ticking up.
// Using default write policy
client.delete(null, key);
System.out.println("Record Deleted");

sh-3.2$  /usr/bin/env /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -cp /var/folders/_p/vjx6xvfs475fqzdyj95n2vn80000gq/T/cp_bhjwvn3njdel324vup4cc6ak3.jar com.example.test.app.App 
**** Initialized the client and connected to the cluster ****
**** Populating data ****
Record written, Press Enter key to continue...

Record Updated, Press Enter key to continue...

Record Deleted
**** Data manipulation Finished ****
 
~~~ stat like client_delete_success ~~~
~~~test Namespace Statistics (2024-06-26 18:39:11 UTC)~~~~
Node                     |10.88.0.3:3102|testsrc-1:3101
client_delete_success    |0             |0
xdr_client_delete_success|0             |0
Number of rows: 3

 

Answer

If bin convergence is turned on and a durable delete is performed, then the metric that actually gets incremented is deleted_last_bin :-
 
~~~ stat like last_bin ~~~
~test Namespace Statistics (2024-06-26 18:39:11 UTC)~
Node            |10.88.0.3:3102|testsrc-1:3101
deleted_last_bin|0             |1
Number of rows: 2

 

Notes

Although these tests were carried out on a Strong Consistency namespace, the same is true for non SC namespaces. The key is having bin convergence turned on and performing a durable delete.

Java test code :-
package com.example.test.app;

import com.aerospike.client.AerospikeClient;
import com.aerospike.client.AerospikeException;
import com.aerospike.client.Bin;
import com.aerospike.client.Key;
import com.aerospike.client.policy.ClientPolicy;
import com.aerospike.client.policy.RecordExistsAction;
import com.aerospike.client.policy.WritePolicy;

public final class App {

    public static void main(String[] args) {
        try {
            App test = new App();
            test.runTest();
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }

    // some globals
    AerospikeClient client;
    final String Namespace1 = "test";
    final String OperationSet = "set1";
    final String keyToWrite = "key1";
    final String hostname = "127.0.0.1";
    final int port = 3101;

    // main test app
    public void runTest() throws AerospikeException, Exception {
        ClientPolicy cpolicy = new ClientPolicy();
        cpolicy.useServicesAlternate = true;
// Set durable delete in default write policy
        cpolicy.writePolicyDefault.durableDelete = false;
        client = new AerospikeClient(cpolicy, hostname, port);
        System.out.println("**** Initialized the client and connected to the cluster ****");
        doPut();
        System.out.println("**** Data manipulation Finished ****");
        client.close();
    }

    void doPut() {
        System.out.println("**** Populating data ****");
        WritePolicy wpolicy = new WritePolicy();
        wpolicy.sendKey = true;        
        wpolicy.recordExistsAction = RecordExistsAction.UPDATE;
 //       wpolicy.durableDelete = true;
        Key key = new Key(Namespace1, OperationSet, keyToWrite);
        Bin bin = new Bin(new String("bin1"), 100);
        Bin bin2 = new Bin(new String("bin2"), 200);
        Bin bin3 = new Bin(new String("bin2"), 300);
        Bin bin4 = new Bin(new String("bin3"), 400);
      
        client.put(wpolicy, key, bin,bin2);
        System.out.println("Record written, Press Enter key to continue...");
        try
        {
            System.in.read();
        }  
        catch(Exception e)
        {}  
        client.put(wpolicy, key, bin3);
        client.put(wpolicy, key, bin4);
        System.out.println("Record Updated, Press Enter key to continue...");
        try
        {
            System.in.read();
        }  
        catch(Exception e)
        {}
// Using default write policy
        client.delete(null, key);
        System.out.println("Record Deleted");  
    }
}

Aerospike configuration :-
service {
    cluster-name testsrc
    proto-fd-max 15000
}
logging {
    file /var/log/aerospike.log {
        context any info
    }
}
network {
    service {
        access-address 10.88.0.2
        address any
        alternate-access-address 127.0.0.1
        port 3101
    }
    heartbeat {
        interval 150
        mesh-seed-address-port 10.88.0.2 3002
        mesh-seed-address-port 10.88.0.3 3002
        mode mesh
        port 3002
        timeout 10
    }
    fabric {
        port 3001
    }
    info {
        port 3003
    }
}
namespace test {
    conflict-resolve-writes true
    memory-size 4G
    replication-factor 2
    storage-engine memory
    strong-consistency true
}
xdr {
    dc testdest {
        namespace test {
            bin-policy changed-or-specified
            enable-compression true
            ship-bin-luts true
            ship-nsup-deletes false
        }
        node-address-port 10.88.0.9 3104
        node-address-port 10.88.0.8 3103
    }
    src-id 1
}

 
Was this article helpful?
0 out of 0 found this helpful