fleet/server/datastore/mysql/common_mysql
Jordan Montgomery 8b3a3cc2f3
Add Read-only Transaction to fetch profiles to install and remove all at once (#32737)
Speculative fix for #30915 

For why this is needed, see
https://github.com/fleetdm/fleet/issues/30915#issuecomment-3259641371

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

- [x] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files)
for more information.

- [x] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [x] If paths of existing endpoints are modified without backwards
compatibility, checked the frontend/CLI for any necessary changes

## Testing

- [x] Added/updated automated tests
- [x] Where appropriate, [automated tests simulate multiple hosts and
test for host
isolation](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/reference/patterns-backend.md#unit-testing)
(updates to one hosts's records do not affect another)

- [x] QA'd all new/changed functionality manually

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Improved reliability of Apple device profile installation and removal
by performing coordinated, read-only transactional reads. Reduces race
conditions and intermittent discrepancies during profile syncs, leading
to more consistent outcomes across fleets.

* **Tests**
* Added tests to verify the combined install/remove results remain
consistent with the individual lists, ensuring accurate and stable
behavior under various state changes.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-09-10 09:29:04 -04:00
..
testing_utils API endpoints for Linux setup experience (#32493) 2025-09-04 12:58:47 -03:00
aws_iam_auth.go Feat 1817 add iam auth to mysql and redis (#32488) 2025-09-04 10:08:47 -05:00
batch.go Fixing issue where deleted profiles were being sent to devices. (#25095) 2025-01-06 13:16:34 -06:00
batch_test.go Fixing issue where deleted profiles were being sent to devices. (#25095) 2025-01-06 13:16:34 -06:00
common.go Add Read-only Transaction to fetch profiles to install and remove all at once (#32737) 2025-09-10 09:29:04 -04:00
errors.go Refactoring common mysql (#26367) 2025-02-18 15:28:54 -06:00
retry.go Add Read-only Transaction to fetch profiles to install and remove all at once (#32737) 2025-09-10 09:29:04 -04:00