Search code examples
aerospike

Getting error Error Code -1: java.io.IOException: Unknown unpack type: 196


I am trying to fetch data from aerospike using scanCallback() method. After running for some time without scanning the aerospike completely I am getting the error

    "Error Code -1: java.io.IOException: Unknown unpack type: 196"

I don't have any idea of what this error means and there is no online documentation for this error online too. I am struggling with this error for sometime now:( Any help would be much appreciated. Thanks a lot in advance


Solution

  • This error means one of bins in the record is a list or map and one of the list/map elements can't be parsed. A temporary workaround is to set includeBinData to false, scan keys and use key to read each record individually.

    public void runScan()
    {
        ScanPolicy policy = new ScanPolicy();
        policy.concurrentNodes = false;
        policy.includeBinData = false;
    
        client.scanAll(policy, namespace, set, this);
    }
    
    @Override
    public void scanCallback(Key key, Record record) {
        try {
            Record rec = client.get(null, key);
        }
        catch (Exception e) {
            // Now we know the key with the corrupt record.
            System.out.println("Error reading " + key);
        }
    }
    

    Once the key has been identified, try reading specific bins to see which bin in the record is causing the problem. That bin may have to be re-written.