database - Is it possible to automatically release a lock in PostgreSQL? -


I am testing the fault tolerance of an ActiveMQ system configured as JDBC Master / Slave. This setup has a postgrabbase database and two brokers - a master broker, the other is a slave broker. The way this system works, Master DB puts an exclusive lock on a table. The slave also tries to do this and waits till the lock becomes available. If the master dies, then the lock should be issued and the slave will take over. However, if the master loses network connectivity from the database, the lock is never released, resulting in a deadlock situation. What is needed is a way for postgres to issue lock on themselves, if not renewed within a specific period. This pattern of design pattern is called the POSA 3 book, which is a lease pattern. Is it possible to get postgate to do this? If not, do other database vendors support it?

This is not a deadlock, this connection problem has been lost.

A deadlock occurs when two transaction resources first try to lock from one another. PostgreSQL detects these conditions.

In your case, Master locks a resource, slave , and master User waits for input which is never received because the connection is lost.

Whenever PostgreSQL detects a lost connection, then

  • to control the loss of the connection, you must use the following PostgreSQL You can use:

    tcp_keepalives_idle (integer) / code>

    system that can be used for the TCP_KEEPIDLE socket option , But otherwise specifies the number of seconds between send guards on passive connections. The value of zero uses the system default. If TCP_KEEPIDLE is not supported, then this parameter should be zero. This parameter is ignored for connections made through the Unix-domain socket.

    tcp_keepalives_interval (integer)

    The systems that support the TCP_KEEPINTVL socket option, specify how much time, In seconds, the value of zero uses the system default to answer a sedan before recombinant to wait. If TCP_KEEPINTVL is not supported, then this parameter must be zero. This parameter is ignored for connections made through the Unix-domain socket.

    tcp_keepalives_count (integer)

    Systems that support the TCP_KEEPCNT socket option, specifies how many before Legends can be lost, the connection is considered dead, the value of zero uses the system default. If TCP_KEEPCNT is not supported, then this parameter should be zero. This parameter is ignored for connections made through the Unix-domain socket.


  • Comments

    Popular posts from this blog

    c# - ListView onScroll event -

    PHP - get image from byte array -

    Linux Terminal Problem with Non-Canonical Terminal I/O app -