Truncate set and cold restart

  • Why do we need to cold-restart of the node followed by set truncate?
  • Cold restart is mandatory for every truncate?
  • What happens if we don’t cold restart but do fast restart (default, i guess)?

Where does it say you need a cold restart?

  • You don’t.
  • No.
  • Truncate is completely independent of any restarts.
1 Like

Your intent is ambiguous. If you are just planning to delete all the records in a set, then truncate will do that. In Community Edition (CE), truncate applies at runtime only. CE always coldstarts, no option to warm restart. If after truncating a set, you were to restart a CE node (i.e. coldstart), potentially all truncated records may come back. In EE, truncate is persistent - so whether you warm-restart EE (default) or specifically coldstart it, truncated records will not come back.

Now there the other ambiguity in your question. Are you trying to delete the set name also? In Aerospike, you can have max 1023 set names. Once you use that quota, you cannot use additional set names and you may be wanting to delete records in a set and then purge that set name. When doing that, in EE, there is a procedure that involves using truncate followed by coldstart. So, perhaps that is what you are referring to.

Finally, there is a third angle - in EE - lets say you issue a truncate by mistake and want to immediately reverse it. In that case, there is a truncate-undo command available which should be followed by a coldstart to retrieve back as many records as possible before they get overwritten on the storage medium by new incoming writes. But it has its gotchas - will work acceptably as long as you always used durable deletes in EE.

Thanks Piyush for a great explanation and details.

We are looking for a set deletion and there are blogs talking about cold restart followed by a truncate (you have mentioned the same in your reply too, highlighted in italic below) hence confused. We are on enterprise edition.

When doing that, in EE, there is a procedure that involves using truncate followed by coldstart. So, perhaps that is what you are referring to.

Thanks Ronen

If you want to truncate records, simply use the truncate command (or truncate-namespace). No need for cold restart.

If you want to get rid of the metadata of the set itself (recover an entry in the limited 1023 total set limit), you would then need to truncate a set and then cold restart (and potentially remove user permissions associated to the set, sindex associated to set or anything else that could cause the metadata for the set to stick around).

© 2021 Copyright Aerospike, Inc. | All rights reserved. Creators of the Aerospike Database.