uselagoon/lagoon

API uses `Int` for backup restore sizes which can be larger than `Int` size

rocketeerbkw opened this issue · 2 comments

Describe the bug

The GraphQL type for the restoreSize field is set as Int which only allows signed 32-bit integers. Since the size is recorded in bytes, this can be larger than the Int type. In this case the api will error with: Int cannot represent non 32-bit signed integer value

To Reproduce

Steps to reproduce the behavior:

  1. Restore a backup larger than 2.2GB
  2. Attempt to retrieve restore info from the api (or view the backups page in the UI)

Expected behavior

The api stores and retrieves restore size without errors.

Additional context

Introduced in #3599.

Is Float the better one to use, since we use it for storage bytes?
https://github.com/uselagoon/lagoon/blob/main/services/api/src/typeDefs.js#L947

Is Float the better one to use, since we use it for storage bytes? https://github.com/uselagoon/lagoon/blob/main/services/api/src/typeDefs.js#L947

I checked the graphql spec and it doesn't specify what the max size of a float is. There's a random comment on a SO question that says it's 52 or 128 bits.... but no source was provided.

I would expect the storage calculator and restore sizes to be mostly equivalent, so if it works for storage I suppose it should be fine for restores.