Consistency of materialize view refreshing result between two jdbc connections

China☆狼群 提交于 2020-01-07 03:10:51

问题


Good day to all. I'm trying to write functional tests for some Spring endpoints (Spring is not a key here) which use my REST application as a black box and try to connect to it via http.

Algorithm is as follows:

  1. The application starts with empty test database
  2. Test starts, in @Before method it fills the database with needed data
  3. Test performs a http request to application and receives the answer
  4. Test compares given response with the expected one.
    Almost all of the tests work good but in one case application uses a materialized view and when test tries to receive data from endpoint, returned data is almost empty. It also happens when I in @Before method make a REFRESH MATERIALIZED VIEW SQL. But when I do it in pgadmin (in the same connection) everything works well.

I think, this happens because of the application connects via jdbc first (when database and view are empty) and when the test's second connection refreshes the materialized view, it couldn't see the changes in it.

Am I right?

And my question is: what algorithm should I use (I can't change the application query and add refresh command there) to solve this problem? Thanks


回答1:


Sorry, it was due to bug in post-filter advice in my code



来源:https://stackoverflow.com/questions/34178190/consistency-of-materialize-view-refreshing-result-between-two-jdbc-connections

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!