I am currently using Aerospike 3.7.3. LSTACK being largely used and want to migrate to LLIST. Please clarify my below queries.
How to migrate data from LSTACK to LLIST without affecting the keys. OR in other ways without affecting the clients using it.
How to implement the function of LSTACK using LLIST. I am currently using python client 2.x
Aerospike's LLIST API is now deprecated and there's a native
list
data type available.
Migrating data:
LLIST has a different API and control structures so you will need to migrate your data for each record. The fastest would be a simple Lua script that runs on the server and just reads all the stack items and copies them into a list using the logic below.
Implementing stack:
The LLIST API is actually implemented as Lua functions on the server already so you can write your own Lua code to wrap these functions and implement stack logic on top of LLIST. Then just call those Lua functions from the client driver. This will be just as fast and maintains the write-lock on records so the operations are atomic.
The basic logic is to use the LLIST as the holder for the stack items and use another bin on the record to hold a index number that maintains the position (or count) of the number of items in the list.
PUSH - Add the item to the list. Increment the index number.
POP - Lookup the index number. Decrement this number. Return the item at the lookup value position of the list.
Here's more info and code examples on building a stack, queue or map on top of a LLIST from an Aerospike engineering team member: