Resolve AerospikeException: Error 22

I am facing the same issue while performing write operation to aerspike. com.aerospike.client.AerospikeException: Error 22,1,30000,0,0,BB98EADF34CDF02 10.30.3.82 3000: Operation not allowed at this time at com.aerospike.client.command.WriteCommand.parseResult(WriteCommand.java:75) at com.aerospike.client.command.SyncCommand.execute(SyncCommand.java:103)

public <T> boolean writeToAerospike(String key, List<T> data) {
        int expiration = 2;
        try {
            Key aerospikeKey = new Key(namespace, setName, key);
            WritePolicy writePolicy = new WritePolicy();
            writePolicy.expiration = expiration;
            Bin bin = new Bin(bins, l2rData);
            aerospikeClient.put(writePolicy, aerospikeKey, bin);
        } catch (Exception e) {
            LOGGER.error("Error while writing data to aerospike", e);
            return false;
        }
        return true;
    }

Can anyone pls help in resolving this ?

Please share your namespace configuration and your aerospike server version. You are trying to insert a record with finite time to live (expiration). Your namespace may be configured to accept only live-for-ever records.

Hi, I have configured default-ttl to 0, yet I am getting the same error mentioned above when trying to put a record with expiry as mentioned above. Can you please guide me?

namespace mission {
        replication-factor 1
        memory-size 4G
        default-ttl 0
        storage-engine device {   
        device /dev/sdb    

        write-block-size 128K  
    }
}

The server does not allow setting a record with expiry when default-ttl (default 0), nsup-period (default 0) are zero and allow-ttl-without-nsup (default false) is false.

How to achieve default-ttl -0 (never expire) and some records from the client with expiry? Thanks in advance.

As Brian hinted, set the nsup-period to non 0.

This article has some info about this as well: Client writes fail with AEROSPIKE_ERR_FAIL_FORBIDDEN

1 Like