Bug 968361
| Summary: | Improve database plugin design to support connection pooling | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Other] RHQ Project | Reporter: | Thomas Segismont <tsegismo> | ||||
| Component: | Plugins | Assignee: | Thomas Segismont <tsegismo> | ||||
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Mike Foley <mfoley> | ||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | medium | ||||||
| Version: | 4.7 | CC: | genman, hrupp | ||||
| Target Milestone: | --- | ||||||
| Target Release: | RHQ 4.10 | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | |||||||
| : | 1096278 (view as bug list) | Environment: | |||||
| Last Closed: | 2014-04-23 12:31:14 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Bug Depends On: | |||||||
| Bug Blocks: | 1096278 | ||||||
| Attachments: |
|
||||||
|
Description
Thomas Segismont
2013-05-29 14:24:45 UTC
Created attachment 781688 [details]
Patch on master (20f29263bca99)
Uses BoneCP, which is fairly small but requires 'guava' library which is a little large. I don't have a strong opinion about using more memory for RHQ agent.
I've done only minimal testing against PostgreSQL. I've tested more using Oracle and MySQL.
One thing NOT working is loading the database library .jar by path. I don't really understand how the Classpath Extension works (or doesn't.) So maybe this needs to come out.
Thomas, can you work with Elias, who provided a patch? Fixed in master commit 2b810f1c9fa247a9d8ddf08d2b9ba93c9e1cf2a6 Author: Thomas Segismont <tsegismo> Date: Tue Dec 17 21:35:47 2013 +0100 This changeset introduces a new API for database plugins and deprecates the previous one. Compatibility with the previous API will be maintained until next major version of RHQ. The 'rhq-database-plugin' was based on org.rhq.plugins.database.DatabaseComponent interface which encouraged plugin authors to share a single JDBC connection across database components. This was wrong for various reasons (connection leaks, concurrent JDBC calls... etc). The new API introduces three important classes: * org.rhq.plugins.database.PooledConnectionProvider * org.rhq.plugins.database.BasePooledConnectionProvider * org.rhq.plugins.database.ConnectionPoolingSupport BasePooledConnectionProvider is a base implementation of a PooledConnectionProvider. Plugin authors should create a concrete implementation of BasePooledConnectionProvider which overrides the #getDriverClass() method. This is important if a database plugin embeds a JDBC driver: the database-specific driver class must be loaded by the child plugin classloader. ConnectionPoolingSupport helps to manage the compatibility with the old API. It's a contract that all new database resource components should obey to. It declares the following methods: * #supportsConnectionPooling() * #getPooledConnectionProvider() Results of calls to #supportsConnectionPooling() #getPooledConnectionProvider() must be consistent. In practice, a top level server database component should be able to create a PooledConnectionProvider instance, and child servers and services should indicate they support connection pooling only if their parent component does. The 'rhq-database-plugin' embeds the BoneCP library (JDBC connection pooling) and its dependencies (Google's Guava). Child plugins will have all the classes accessible as soon as they have this node in their plugin descriptor: === <depends plugin="Database" useClasses="true"/> === This changeset includes the necessary changes to support connection pooling in the Oracle, Postgres and MySQL plugins. Bulk closing of 4.10 issues. If an issue is not solved for you, please open a new BZ (or clone the existing one) with a version designator of 4.10. Additional commit in master (back in December) commit 1eb8c728c0c1939115fe90bd1c91fbf5ecf0a036 Author: Thomas Segismont <tsegismo> Date: Tue Dec 17 21:35:47 2013 +0100 |