DB_ENV->rep_set_request()
Prev | Chapter 10. Replication Methods | Next

## DB_ENV->rep_set_request()

    #include <db.h>

    int
    DB_ENV->rep_set_request(DB_ENV *env, u_int32_t min, u_int32_t max);

The `DB_ENV->rep_set_request()` method sets a threshold for the minimum and maximum time that a client waits before requesting retransmission of a missing message. Specifically, if the client detects a gap in the sequence of incoming log records or database pages, Berkeley DB will wait for at least min microseconds before requesting retransmission of the missing record. Berkeley DB will double that amount before requesting the same missing record again, and so on, up to a maximum threshold of max microseconds.

These values are thresholds only. Since Berkeley DB has no thread available in the library as a timer, the threshold is only checked when a thread enters the Berkeley DB library to process an incoming replication message. Any amount of time may have passed since the last message arrived and Berkeley DB only checks whether the amount of time since a request was made is beyond the threshold value or not.

By default the minimum is 40000 and the maximum is 1280000 (1.28 seconds). These defaults are fairly arbitrary and the application likely needs to adjust these. The values should be based on expected load and performance characteristics of the master and client host platforms and transport infrastructure as well as round-trip message time.

The database environment's replication subsystem may also be configured using the environment's DB_CONFIG file. The syntax of the entry in that file is a single line with the string "rep_set_request", one or more whitespace characters, and the request times specified in two parts: the min and the max. For example, "rep_set_request 40000 1280000". Because the DB_CONFIG file is read when the database environment is opened, it will silently overrule configuration done before that time.

The `DB_ENV->rep_set_request()` method configures a database environment, not only operations performed using the specified DB_ENV handle.

The `DB_ENV->rep_set_request()` method may be called at any time during the life of the application.

The `DB_ENV->rep_set_request()` method returns a non-zero error value on failure and 0 on success.

### Parameters

#### max

The maximum number of microseconds a client waits before requesting retransmission.

#### min

The minimum number of microseconds a client waits before requesting retransmission.

### Errors

The `DB_ENV->rep_set_request()` method may fail and return one of the following non-zero errors:

#### EINVAL

An invalid flag value or parameter was specified.

### Class

DB_ENV

### See Also

Replication and Related Methods

Prev | Up | Next
DB_ENV->rep_set_priority() | Home | DB_ENV->rep_set_timeout()