Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Device mappings may overlap #13

Open
dajtxx opened this issue Oct 14, 2022 · 0 comments
Open

Device mappings may overlap #13

dajtxx opened this issue Oct 14, 2022 · 0 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@dajtxx
Copy link
Collaborator

dajtxx commented Oct 14, 2022

If a new device mapping is created for a currently mapped logical device, the current and new device mapping rows may overlap.

A mapping object with a start time is provided to the insert_mapping function. The start time will likely be some small fraction of a second in the past because it was set by the caller.

insert_mapping calls _end_mapping for the logical device, and _end_mapping sets the end time of the current mapping to now(). This is likely slightly after the start time for the new mapping given to insert_mapping.

So when insert_mapping is finished, the previous mapping may have an end time slightly later than the start time of the current mapping.

_end_mapping (and end_mapping) should take an optional datetime object to use for the end time, and insert_mapping could pass the start time of the new mapping in.

This might also be useful for unit tests, allowing them to end mappings at specific times.

It probably isn't a bad bug as long as we usually use the start times of mappings in queries. The end time is more like a flag value to say a row is not a current mapping. Also, the chance of getting a message or some other signal that causes a query that happens right on a mapping change boundary is slim.

@dajtxx dajtxx added bug Something isn't working enhancement New feature or request labels Oct 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant