Search Parameter Hash Deduplication¶
Search Parameter Hash Deduplication is a mechanism used to prevent the creation of duplicate report generation tasks within a short time window.^[001-TODO__code.md]
Mechanism¶
The system generates a unique hash signature for each report request by calculating the MD5 digest of the search parameters.^[001-TODO__code.md] This hash is stored in the report_download_record table alongside the user's ID and the creation timestamp.^[001-TODO__code.md]
When a new request is received, the ReportDownloadRecordService performs a duplicateQry check.^[001-TODO__code.md] This query determines whether a record with the same searchParamHash and creatorId already exists within a configurable time window (defined by REPORT_CACHE_MINUTE).^[001-TODO__code.md]
Logic and Error Handling¶
If the check identifies an existing record with a status of RUNNING or SUCCESS created within the allowed time frame, the system throws a BusinessException with the error code DATA_IS_CREATED, effectively blocking the duplicate request.^[001-TODO__code.md]
This logic relies on the database index index_c_s, which is defined on the columns (creator_id, search_param_hash) to optimize the lookup performance.^[001-TODO__code.md]
Related Concepts¶
- [[Async reporting]] (implied by context)
- [[MD5]] (Hash algorithm)
- [[Database indexing]]
Sources¶
001-TODO__code.md