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

ZEN-26894 fix production state sort error #2177

Merged

Conversation

mozart27
Copy link
Contributor

@mozart27 mozart27 commented Mar 14, 2017

In the unit tests for this set of fixes:

  • collector is used as a non-indexed field
  • name is used as an index field

@mozart27 mozart27 changed the title Feature/feature/zen 26894 fix production state sort error ZEN-26894 fix production state sort error Mar 14, 2017
@mozart27 mozart27 force-pushed the feature/feature/ZEN-26894-fix-production-state-sort-error branch 5 times, most recently from 337294d to 444ee78 Compare March 15, 2017 17:04
Copy link
Contributor

@johnlhamilton johnlhamilton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to evaluate the performance impact. This change will make sorting on production state perform the same as sorting on an un-indexed field.

Filtering on productionState may be worse than filtering on an un-indexed field.

The biggest impact is when start and limit are defined, as when a user is scrolling/paging through results. Since we don't store productionState in the catalog, this will require that we unbrain the entire device list everytime we load 1 "page" of results.

# Unbraining these brains makes them no longer brains - so set the SearchResults flag accordingly
areBrains = False

psFilteredBrains = [u for u in catbrains if psManager.getProductionStateFromGUID(u.getUUID()) in prodStates]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we have unbrained them, we can just do u.getProductionState() and eliminate the need for psManager.

else:
sortedBrains = psFilteredbrains
for u in psFilteredBrains:
prodState = psManager.getProductionStateFromGUID(u.getUUID())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, use u.getProductionState()

self.assertEquals(device.getProductionState(), 1000)
self.assertEquals(device.location.getRelatedId(), "test1")

def test_deviceSortByProdStateWithLocationFilterReturnsCorrectDevicesAndSortsCorrectly(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a test where the sort is by an unindexed field and the filter is productionState, as described in ZEN-26901

@mozart27 mozart27 force-pushed the feature/feature/ZEN-26894-fix-production-state-sort-error branch 2 times, most recently from 05441fa to 800a2c3 Compare March 15, 2017 19:29
@mozart27
Copy link
Contributor Author

I have updated this PR with the latest discussed changes - which are much simpler.

@mozart27 mozart27 force-pushed the feature/feature/ZEN-26894-fix-production-state-sort-error branch from edd5602 to 5d2e55f Compare March 16, 2017 21:19
@mozart27 mozart27 force-pushed the feature/feature/ZEN-26894-fix-production-state-sort-error branch from 35a37bb to e2d0f67 Compare March 20, 2017 18:47
@mozart27
Copy link
Contributor Author

mozart27 commented Mar 20, 2017

retest this please

@mozart27
Copy link
Contributor Author

jenkins please test this

@mozart27 mozart27 merged commit 7dd69a3 into develop Mar 21, 2017
@mozart27 mozart27 deleted the feature/feature/ZEN-26894-fix-production-state-sort-error branch May 4, 2017 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants