Are host ID's in Foreman always unique?

Hi - looking at the audit logs I can see that each host audit even have a unique ID referenced as ‘auditable_id’ which refers to the host ID as far as I can tell. Using the API I can access that host information using the ID like e.g.: http://foreman/hosts/12345

Is this host ID always unique in Foreman? Does Foreman ever re-use these ID’s or will they forever increment?

Foreman and Proxy versions:
We are on Foreman 1.15 in case it matters.

Foreman is a Ruby on Rails app and ActiveRecord (database stack in Rails) uses underlying database mechanisms to generate integers as primary keys. In case of PostgreSQL, these are SEQUENCES.

https://www.postgresql.org/docs/9.5/static/sql-createsequence.html

Default behavior in PostgreSQL is to return integers in sequence until 9223372036854775807 is hit, then you have an error. There is a way to set “cycling” but Rails does not set this flag.

1 Like