Uploaded image for project: 'Data Model'
  1. Data Model
  2. DAMD-94

Fix discrepancy between createHash and datamodel.txt

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Done (View Workflow)
    • Priority: Normal
    • Resolution: Done
    • Labels:
      None
    • Story Points:
      1
    • Sprint:
      2DDRP-2021 A

      Description

      Currently the datamodel.txt defines a hash as a 63-bit unsigned int, fitted into 64 bit signed integers:

      https://github.com/Subaru-PFS/datamodel/blob/7af03e7b2adba3b5e190995b54296d70683e6d17/datamodel.txt#L28

      In various places I refer to a SHA-1, which is a strong 160-bit hash, as used by e.g. git
      (https://en.wikipedia.org/wiki/SHA-1). We truncate these hashes to 63bits (so as to fit
      in standard 64-bit signed integers). Sixty-three bits would produce up to 2^63 ~ 9e18 values.

      This is currently inconsistent with the datamodel.utils.createHash() function, where a 64-bit hash is generated:

      https://github.com/Subaru-PFS/datamodel/blob/fa98c08c8ac839956f0d4e8489523e4898894a8b/python/pfs/datamodel/utils.py#L51

      Fix this discrepancy following the proposal by Sogo Mineo and Craig Loomis in the datamodel channel 2020-11-06, by updating the datamodel.txt text mentioned above, such that a 64-bit hash is generated, in line with createHash, and that this hash can be fitted into a standard 64-bit signed integer.

      This will allow identifiers such as the pfsDesignId, which use that hash, to be stored in the opDB Postgres database, using a standard bigint or int8 data type, without need for additional conversion routines, as discussed in INSTRM-1096.

       

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hassan hassan
                Reporter:
                hassan hassan
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: