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

correctly resolve saved searches when importing dashboards #316

Open
wants to merge 1 commit into
base: stable
Choose a base branch
from

Conversation

gkleen
Copy link

@gkleen gkleen commented Oct 26, 2021

When resolving saved searches while creating dashboards from initialdata the same sql-query-object was reused.
Therefore the resulting sql query accumulated limits (composed with OR), returning false positives to …->First.

Consider the following excerpt from our logs:

2021-10-25 14:48:32.645 UTC [4658] rt@rt5 LOG:  statement: SELECT main.* FROM Attributes main  WHERE (main.Description = '[_1] highest priority tickets I own') AND (main.ObjectId = 1) AND (main.ObjectType = 'RT::System')  ORDER BY main.id ASC 
2021-10-25 14:48:32.647 UTC [4658] rt@rt5 LOG:  statement: SELECT main.* FROM Attributes main  WHERE (main.Description = '[_1] highest priority tickets I own' OR main.Description = '[_1] newest unowned tickets') AND (main.ObjectId = 1) AND (main.ObjectType = 'RT::System')  ORDER BY main.id ASC 
2021-10-25 14:48:32.648 UTC [4658] rt@rt5 LOG:  statement: SELECT main.* FROM Attributes main  WHERE (main.Description = '[_1] highest priority tickets I own' OR main.Description = '[_1] newest unowned tickets' OR main.Description = 'Bookmarked Tickets') AND (main.ObjectId = 1) AND (main.ObjectType = 'RT::System')  ORDER BY main.id ASC 

The generated queries are obviously wrong.

The Problem lies with sub Attributes { in lib/RT/Record.pm memoizing the returned query object, causing the same object to be reused in every pass through the for-loop, accumulating limits as described above.
This PR Clone()s the query object in every pass through the for-loop, preventing this accumulation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant