database
database copied to clipboard
GroupedSelection: Rows are refetched when cache is invalid [Closes #15]
See #15
Currently we use something like this patch in projects and it seems fine.
GroupedSelection::execute refetches data only when isset($this->refCacheCurrent['data']) === TRUE but sometimes this cache is empty and $this->rows === NULL
-> I get errors described in #15
With this patch, it's OK.
I consider this code only as temporary fix. I don't know NDB too much.
Tests are failing…
I think that problem #15 is implementation of Selection::execute & GroupedSelection::execute which fails when cache is invalid.
But I still cannot find the reason why sometimes cache is not valid. Problem occurs SOMETIMES after deployment & cache clean-up & $this->rows === NULL. See #15.
I've made the simpliest change now in GroupedSelection::execute. But previous tests mocked insufficient cache and it made more database queries than expected before the change.
I can't write tests for invalid cache. When I fixed the problem, previous tests with storage mock failed. It's more complex problem than I can resolve atm (my knowledges of internals of NDTB are poor).
My knowledge in poor too, I'll try to understand it, but it will not be soon…
Can someone with the same problem (#15) check this solution on real projects? Solves it bugs with cache?
@nechutny @mishak87