Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Fix storage connection disposal #1727

Merged
merged 2 commits into from
Sep 24, 2018
Merged

Conversation

lebdron
Copy link
Contributor

@lebdron lebdron commented Sep 17, 2018

Description of the Change

Add freeConnections method, which disposes all currently used connections. Due to storage shared pointer not being released in irohad destructor, method has to be manually called in irohad destructor.

Benefits

No more leftover databases after tests, since they drop without issues now.

Possible Drawbacks

Storage shared pointer is still used by some components. It should be verified that all components are destroyed when irohad destructor is called.

std::unique_ptr<soci::session> sql,
std::shared_ptr<shared_model::interface::CommonObjectsFactory> factory)
: psql_(std::move(sql)),
sql_(*psql_),
Copy link
Contributor

Choose a reason for hiding this comment

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

Please leave a todo about plans to change the way of soci::session storing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lebdron lebdron changed the base branch from fix/sim-sync-storage-lifetime to dev September 18, 2018 08:02
Signed-off-by: Andrei Lebedev <lebdron@gmail.com>
@lebdron lebdron force-pushed the fix/storage-connection-disposal branch from 7ad6271 to 1b16c10 Compare September 18, 2018 08:05
@l4l l4l added the ametsuchi label Sep 24, 2018
Signed-off-by: Andrei Lebedev <lebdron@gmail.com>
@sorabot
Copy link

sorabot commented Sep 24, 2018

SonarQube analysis reported 3 issues

  1. MINOR postgres_block_query.hpp#L74: Unused private function: 'PostgresBlockQuery::getBlockIds' rule
  2. MINOR postgres_block_query.hpp#L82: Unused private function: 'PostgresBlockQuery::getBlockId' rule
  3. MINOR postgres_block_query.hpp#L92: Unused private function: 'PostgresBlockQuery::callback' rule

@lebdron lebdron merged commit 81fbd79 into dev Sep 24, 2018
@lebdron lebdron deleted the fix/storage-connection-disposal branch September 24, 2018 13:42
bakhtin pushed a commit that referenced this pull request Nov 2, 2018
* Remove session shared_ptrs; add freeConnections method

* Add todo for soci::session fields

Signed-off-by: Andrei Lebedev <lebdron@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

None yet

5 participants