In the manufacturing of a device each one has to get a unique identifier. So far so good, one can have a file containing the last used ID on a shared drive, or a network-based service managing and assigning IDs so that the uploading of the ID into the device will not be limited to a single workstation.

However, in the case of a total system crash and restoration from backup, one can have a few devices with the same ID, if some devices were manufactured after the backup was made. One could have each workstation save the biggest used ID, and check whether it's not larger than the one they got from the network, but it might happen that the workstation with the last produced device is not turned on after the crash. One might require workers to write down the last used ID after their shifts, but this doesn't sound to be fool-proof either.

Is there a best practice besides having multiple services managing the IDs, with at least one of them off-site?

The IDs are large enough (32 bits) compared to the number of devices to be produced to allow for small gaps, but not large enough to go the true RNG way. This way, one can increase the largest ID by a number significantly larger than the amount being produced per day, but how can one keep this "company practice" enforced for possibly decades?

  • @drxzcl A good idea, actually I though of a USB hardware key, but over decades it can get lost or can malfunction. – vsz Apr 4 '14 at 10:58
  • I suppose you could get a (small, industrial quality) embedded system that just handles the serial numbers. – drxzcl Apr 4 '14 at 11:36

Split your 32 bits. Under normal operation, you count normally using all 32 bit. When a crash actually happens, you use only the most significant, e.g., 8 bits of the backup, increment that part by two and start from there. All you need to make sure now is that you backup often enough. More specifically, often enough to ensure you didn't use up the whole lower significant part (24 bit in this example) in between backups.

| improve this answer | |
  • Nice idea. I can even save a timestamp every time I access the IDs, and if I suddenly find a timestamp which is older, I know that a backup has been restored. The only problem is, that if it's used on a workstation which was never turned on since the backup, it will not be automatically detected. (I wrote a similar case in the question, in "incrementing the ID"). If I cannot fully automate it, it still needs an actively enforced company policy, but I guess there is no other way. – vsz Apr 4 '14 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.