Skip to content

Commit d62ed48

Browse files
committed
vert-x3#108: Updated documentation for connection retries
Signed-off-by: Ernesto J. Perez <[email protected]>
1 parent 15d7d91 commit d62ed48

File tree

6 files changed

+210
-0
lines changed

6 files changed

+210
-0
lines changed

src/main/asciidoc/groovy/index.adoc

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,32 @@ other SQL clients.
198198

199199
You can learn how to use it in the http://vertx.io/docs/vertx-sql-common/groovy/[common sql interface] documentation.
200200

201+
=== Configuring reconnections
202+
203+
This service is able to recover from temporary database outages, such as those which occur during a database restart or
204+
brief loss of network connectivity. You can configure the expected behaviour when acquiring connections via the
205+
following properties:
206+
207+
* `maxConnectionRetries`
208+
* `connectionRetryDelay`
209+
210+
When the internal connection pool attempts to acquire an open connection and fails, it will retry up to
211+
`maxConnectionRetries` times, with a delay of `connectionRetryDelay` milliseconds between each attempt.
212+
If all attempts fail, any clients waiting for connections from the pool will be notified with an Error, indicating that
213+
a Connection could not be acquired. Note that clients will not be notified with an Error until a full round of attempts
214+
fail, which may be some time after the initial connection attempt.
215+
216+
If `maxConnectionRetries` is set to `0`, the internal connection pool will not perform any reconnection (default). If
217+
`maxConnectionRetries` is set to `-1`, the internal connection pool will attempt to acquire new connections indefinitely,
218+
so any call to `link:../../apidocs/io/vertx/ext/sql/SQLClient.html#getConnection-io.vertx.core.Handler-[getConnection]`
219+
may be indefinitely waiting for a successful acquisition.
220+
221+
Once a full round of acquisition attempts fails, the internal connection pool will remain active, and will try
222+
again to acquire connections in response to future requests for connections.
223+
224+
Note that if a database restart occurs, a pool may contain previously acquired but now stale Connections that will only be
225+
detected and purged lazily, when the pool attempts to reuse them.
226+
201227
=== Note about date and timestamps
202228

203229
Whenever you get dates back from the database, this service will implicitly convert them into ISO 8601
@@ -228,7 +254,11 @@ Both the PostgreSql and MySql clients take the same configuration:
228254
"password" : <your-password>,
229255
"database" : <name-of-your-database>,
230256
"charset" : <name-of-the-character-set>,
257+
"connectTimeout" : <timeout-in-milliseconds>,
258+
"testTimeout" : <timeout-in-milliseconds>,
231259
"queryTimeout" : <timeout-in-milliseconds>,
260+
"maxConnectionRetries" : <maximum-number-of-connection-retries>,
261+
"connectionRetryDelay" : <delay-in-milliseconds>,
232262
"sslMode" : <"disable"|"prefer"|"require"|"verify-ca"|"verify-full">,
233263
"sslRootCert" : <path to file with certificate>
234264
}
@@ -244,6 +274,11 @@ Both the PostgreSql and MySql clients take the same configuration:
244274
`connectTimeout`:: The timeout to wait for connecting to the database. Defaults to `10000` (= 10 seconds).
245275
`testTimeout`:: The timeout for connection tests performed by pools. Defaults to `10000` (= 10 seconds).
246276
`queryTimeout`:: The timeout to wait for a query in milliseconds. Default is not set.
277+
`maxConnectionRetries`:: Maximum number of connection retries. Defaults to `0` (no retries). +
278+
Special values:
279+
-1 ::: Unlimited number of connection retries
280+
0 ::: No connection retries will be done
281+
`connectionRetryDelay`:: Delay in milliseconds between each retry attempt. Defaults to `5000` (= 5 seconds).
247282
`sslMode` :: If you want to enable SSL support you should enable this parameter.
248283
For example to connect Heroku you will need to use *prefer*.
249284

src/main/asciidoc/java/index.adoc

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,32 @@ other SQL clients.
166166

167167
You can learn how to use it in the http://vertx.io/docs/vertx-sql-common/java/[common sql interface] documentation.
168168

169+
=== Configuring reconnections
170+
171+
This service is able to recover from temporary database outages, such as those which occur during a database restart or
172+
brief loss of network connectivity. You can configure the expected behaviour when acquiring connections via the
173+
following properties:
174+
175+
* `maxConnectionRetries`
176+
* `connectionRetryDelay`
177+
178+
When the internal connection pool attempts to acquire an open connection and fails, it will retry up to
179+
`maxConnectionRetries` times, with a delay of `connectionRetryDelay` milliseconds between each attempt.
180+
If all attempts fail, any clients waiting for connections from the pool will be notified with an Error, indicating that
181+
a Connection could not be acquired. Note that clients will not be notified with an Error until a full round of attempts
182+
fail, which may be some time after the initial connection attempt.
183+
184+
If `maxConnectionRetries` is set to `0`, the internal connection pool will not perform any reconnection (default). If
185+
`maxConnectionRetries` is set to `-1`, the internal connection pool will attempt to acquire new connections indefinitely,
186+
so any call to `link:../../apidocs/io/vertx/ext/sql/SQLClient.html#getConnection-io.vertx.core.Handler-[getConnection]`
187+
may be indefinitely waiting for a successful acquisition.
188+
189+
Once a full round of acquisition attempts fails, the internal connection pool will remain active, and will try
190+
again to acquire connections in response to future requests for connections.
191+
192+
Note that if a database restart occurs, a pool may contain previously acquired but now stale Connections that will only be
193+
detected and purged lazily, when the pool attempts to reuse them.
194+
169195
=== Note about date and timestamps
170196

171197
Whenever you get dates back from the database, this service will implicitly convert them into ISO 8601
@@ -196,7 +222,11 @@ Both the PostgreSql and MySql clients take the same configuration:
196222
"password" : <your-password>,
197223
"database" : <name-of-your-database>,
198224
"charset" : <name-of-the-character-set>,
225+
"connectTimeout" : <timeout-in-milliseconds>,
226+
"testTimeout" : <timeout-in-milliseconds>,
199227
"queryTimeout" : <timeout-in-milliseconds>,
228+
"maxConnectionRetries" : <maximum-number-of-connection-retries>,
229+
"connectionRetryDelay" : <delay-in-milliseconds>,
200230
"sslMode" : <"disable"|"prefer"|"require"|"verify-ca"|"verify-full">,
201231
"sslRootCert" : <path to file with certificate>
202232
}
@@ -212,6 +242,11 @@ Both the PostgreSql and MySql clients take the same configuration:
212242
`connectTimeout`:: The timeout to wait for connecting to the database. Defaults to `10000` (= 10 seconds).
213243
`testTimeout`:: The timeout for connection tests performed by pools. Defaults to `10000` (= 10 seconds).
214244
`queryTimeout`:: The timeout to wait for a query in milliseconds. Default is not set.
245+
`maxConnectionRetries`:: Maximum number of connection retries. Defaults to `0` (no retries). +
246+
Special values:
247+
-1 ::: Unlimited number of connection retries
248+
0 ::: No connection retries will be done
249+
`connectionRetryDelay`:: Delay in milliseconds between each retry attempt. Defaults to `5000` (= 5 seconds).
215250
`sslMode` :: If you want to enable SSL support you should enable this parameter.
216251
For example to connect Heroku you will need to use *prefer*.
217252

src/main/asciidoc/js/index.adoc

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,32 @@ other SQL clients.
204204

205205
You can learn how to use it in the http://vertx.io/docs/vertx-sql-common/js/[common sql interface] documentation.
206206

207+
=== Configuring reconnections
208+
209+
This service is able to recover from temporary database outages, such as those which occur during a database restart or
210+
brief loss of network connectivity. You can configure the expected behaviour when acquiring connections via the
211+
following properties:
212+
213+
* `maxConnectionRetries`
214+
* `connectionRetryDelay`
215+
216+
When the internal connection pool attempts to acquire an open connection and fails, it will retry up to
217+
`maxConnectionRetries` times, with a delay of `connectionRetryDelay` milliseconds between each attempt.
218+
If all attempts fail, any clients waiting for connections from the pool will be notified with an Error, indicating that
219+
a Connection could not be acquired. Note that clients will not be notified with an Error until a full round of attempts
220+
fail, which may be some time after the initial connection attempt.
221+
222+
If `maxConnectionRetries` is set to `0`, the internal connection pool will not perform any reconnection (default). If
223+
`maxConnectionRetries` is set to `-1`, the internal connection pool will attempt to acquire new connections indefinitely,
224+
so any call to `link:../../apidocs/io/vertx/ext/sql/SQLClient.html#getConnection-io.vertx.core.Handler-[getConnection]`
225+
may be indefinitely waiting for a successful acquisition.
226+
227+
Once a full round of acquisition attempts fails, the internal connection pool will remain active, and will try
228+
again to acquire connections in response to future requests for connections.
229+
230+
Note that if a database restart occurs, a pool may contain previously acquired but now stale Connections that will only be
231+
detected and purged lazily, when the pool attempts to reuse them.
232+
207233
=== Note about date and timestamps
208234

209235
Whenever you get dates back from the database, this service will implicitly convert them into ISO 8601
@@ -234,7 +260,11 @@ Both the PostgreSql and MySql clients take the same configuration:
234260
"password" : <your-password>,
235261
"database" : <name-of-your-database>,
236262
"charset" : <name-of-the-character-set>,
263+
"connectTimeout" : <timeout-in-milliseconds>,
264+
"testTimeout" : <timeout-in-milliseconds>,
237265
"queryTimeout" : <timeout-in-milliseconds>,
266+
"maxConnectionRetries" : <maximum-number-of-connection-retries>,
267+
"connectionRetryDelay" : <delay-in-milliseconds>,
238268
"sslMode" : <"disable"|"prefer"|"require"|"verify-ca"|"verify-full">,
239269
"sslRootCert" : <path to file with certificate>
240270
}
@@ -250,6 +280,11 @@ Both the PostgreSql and MySql clients take the same configuration:
250280
`connectTimeout`:: The timeout to wait for connecting to the database. Defaults to `10000` (= 10 seconds).
251281
`testTimeout`:: The timeout for connection tests performed by pools. Defaults to `10000` (= 10 seconds).
252282
`queryTimeout`:: The timeout to wait for a query in milliseconds. Default is not set.
283+
`maxConnectionRetries`:: Maximum number of connection retries. Defaults to `0` (no retries). +
284+
Special values:
285+
-1 ::: Unlimited number of connection retries
286+
0 ::: No connection retries will be done
287+
`connectionRetryDelay`:: Delay in milliseconds between each retry attempt. Defaults to `5000` (= 5 seconds).
253288
`sslMode` :: If you want to enable SSL support you should enable this parameter.
254289
For example to connect Heroku you will need to use *prefer*.
255290

src/main/asciidoc/kotlin/index.adoc

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,32 @@ other SQL clients.
198198

199199
You can learn how to use it in the http://vertx.io/docs/vertx-sql-common/kotlin/[common sql interface] documentation.
200200

201+
=== Configuring reconnections
202+
203+
This service is able to recover from temporary database outages, such as those which occur during a database restart or
204+
brief loss of network connectivity. You can configure the expected behaviour when acquiring connections via the
205+
following properties:
206+
207+
* `maxConnectionRetries`
208+
* `connectionRetryDelay`
209+
210+
When the internal connection pool attempts to acquire an open connection and fails, it will retry up to
211+
`maxConnectionRetries` times, with a delay of `connectionRetryDelay` milliseconds between each attempt.
212+
If all attempts fail, any clients waiting for connections from the pool will be notified with an Error, indicating that
213+
a Connection could not be acquired. Note that clients will not be notified with an Error until a full round of attempts
214+
fail, which may be some time after the initial connection attempt.
215+
216+
If `maxConnectionRetries` is set to `0`, the internal connection pool will not perform any reconnection (default). If
217+
`maxConnectionRetries` is set to `-1`, the internal connection pool will attempt to acquire new connections indefinitely,
218+
so any call to `link:../../apidocs/io/vertx/ext/sql/SQLClient.html#getConnection-io.vertx.core.Handler-[getConnection]`
219+
may be indefinitely waiting for a successful acquisition.
220+
221+
Once a full round of acquisition attempts fails, the internal connection pool will remain active, and will try
222+
again to acquire connections in response to future requests for connections.
223+
224+
Note that if a database restart occurs, a pool may contain previously acquired but now stale Connections that will only be
225+
detected and purged lazily, when the pool attempts to reuse them.
226+
201227
=== Note about date and timestamps
202228

203229
Whenever you get dates back from the database, this service will implicitly convert them into ISO 8601
@@ -228,7 +254,11 @@ Both the PostgreSql and MySql clients take the same configuration:
228254
"password" : <your-password>,
229255
"database" : <name-of-your-database>,
230256
"charset" : <name-of-the-character-set>,
257+
"connectTimeout" : <timeout-in-milliseconds>,
258+
"testTimeout" : <timeout-in-milliseconds>,
231259
"queryTimeout" : <timeout-in-milliseconds>,
260+
"maxConnectionRetries" : <maximum-number-of-connection-retries>,
261+
"connectionRetryDelay" : <delay-in-milliseconds>,
232262
"sslMode" : <"disable"|"prefer"|"require"|"verify-ca"|"verify-full">,
233263
"sslRootCert" : <path to file with certificate>
234264
}
@@ -244,6 +274,11 @@ Both the PostgreSql and MySql clients take the same configuration:
244274
`connectTimeout`:: The timeout to wait for connecting to the database. Defaults to `10000` (= 10 seconds).
245275
`testTimeout`:: The timeout for connection tests performed by pools. Defaults to `10000` (= 10 seconds).
246276
`queryTimeout`:: The timeout to wait for a query in milliseconds. Default is not set.
277+
`maxConnectionRetries`:: Maximum number of connection retries. Defaults to `0` (no retries). +
278+
Special values:
279+
-1 ::: Unlimited number of connection retries
280+
0 ::: No connection retries will be done
281+
`connectionRetryDelay`:: Delay in milliseconds between each retry attempt. Defaults to `5000` (= 5 seconds).
247282
`sslMode` :: If you want to enable SSL support you should enable this parameter.
248283
For example to connect Heroku you will need to use *prefer*.
249284

src/main/asciidoc/ruby/index.adoc

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,32 @@ other SQL clients.
204204

205205
You can learn how to use it in the http://vertx.io/docs/vertx-sql-common/ruby/[common sql interface] documentation.
206206

207+
=== Configuring reconnections
208+
209+
This service is able to recover from temporary database outages, such as those which occur during a database restart or
210+
brief loss of network connectivity. You can configure the expected behaviour when acquiring connections via the
211+
following properties:
212+
213+
* `maxConnectionRetries`
214+
* `connectionRetryDelay`
215+
216+
When the internal connection pool attempts to acquire an open connection and fails, it will retry up to
217+
`maxConnectionRetries` times, with a delay of `connectionRetryDelay` milliseconds between each attempt.
218+
If all attempts fail, any clients waiting for connections from the pool will be notified with an Error, indicating that
219+
a Connection could not be acquired. Note that clients will not be notified with an Error until a full round of attempts
220+
fail, which may be some time after the initial connection attempt.
221+
222+
If `maxConnectionRetries` is set to `0`, the internal connection pool will not perform any reconnection (default). If
223+
`maxConnectionRetries` is set to `-1`, the internal connection pool will attempt to acquire new connections indefinitely,
224+
so any call to `link:../../apidocs/io/vertx/ext/sql/SQLClient.html#getConnection-io.vertx.core.Handler-[getConnection]`
225+
may be indefinitely waiting for a successful acquisition.
226+
227+
Once a full round of acquisition attempts fails, the internal connection pool will remain active, and will try
228+
again to acquire connections in response to future requests for connections.
229+
230+
Note that if a database restart occurs, a pool may contain previously acquired but now stale Connections that will only be
231+
detected and purged lazily, when the pool attempts to reuse them.
232+
207233
=== Note about date and timestamps
208234

209235
Whenever you get dates back from the database, this service will implicitly convert them into ISO 8601
@@ -234,7 +260,11 @@ Both the PostgreSql and MySql clients take the same configuration:
234260
"password" : <your-password>,
235261
"database" : <name-of-your-database>,
236262
"charset" : <name-of-the-character-set>,
263+
"connectTimeout" : <timeout-in-milliseconds>,
264+
"testTimeout" : <timeout-in-milliseconds>,
237265
"queryTimeout" : <timeout-in-milliseconds>,
266+
"maxConnectionRetries" : <maximum-number-of-connection-retries>,
267+
"connectionRetryDelay" : <delay-in-milliseconds>,
238268
"sslMode" : <"disable"|"prefer"|"require"|"verify-ca"|"verify-full">,
239269
"sslRootCert" : <path to file with certificate>
240270
}
@@ -250,6 +280,11 @@ Both the PostgreSql and MySql clients take the same configuration:
250280
`connectTimeout`:: The timeout to wait for connecting to the database. Defaults to `10000` (= 10 seconds).
251281
`testTimeout`:: The timeout for connection tests performed by pools. Defaults to `10000` (= 10 seconds).
252282
`queryTimeout`:: The timeout to wait for a query in milliseconds. Default is not set.
283+
`maxConnectionRetries`:: Maximum number of connection retries. Defaults to `0` (no retries). +
284+
Special values:
285+
-1 ::: Unlimited number of connection retries
286+
0 ::: No connection retries will be done
287+
`connectionRetryDelay`:: Delay in milliseconds between each retry attempt. Defaults to `5000` (= 5 seconds).
253288
`sslMode` :: If you want to enable SSL support you should enable this parameter.
254289
For example to connect Heroku you will need to use *prefer*.
255290

0 commit comments

Comments
 (0)