Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f5wYP-0008EV-GI for pgsql-general@arkaria.postgresql.org; Tue, 10 Apr 2018 16:55:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f5wYO-0000xF-6J for pgsql-general@arkaria.postgresql.org; Tue, 10 Apr 2018 16:55:32 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f5wYJ-0000IU-HD for pgsql-general@lists.postgresql.org; Tue, 10 Apr 2018 16:55:27 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f5wYC-0004rU-2b for pgsql-general@postgresql.org; Tue, 10 Apr 2018 16:55:25 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 3D36420DDB; Tue, 10 Apr 2018 12:55:19 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 10 Apr 2018 12:55:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=mWKVETDthVqYw6lo7uRCHBrRz9S6X 96e5Ey+PGnxe64=; b=g1wbnNncAjHRxkLQB8qnzGl3TTwdnCk00UFXiC9Gru3E9 aXLbjxDOTaSP6nDwu6wXjQO7CwGItjk8OI/LOwhjoU2uNsDOfj0/NNejce4xjfCm NN7mwuc6v9sVdVuICCGiuHHBw0YpuaVgK923HzTuqS/y0u0eRmA3sYyEMvFl8OGa HwTf5X0vqfQ2kZRE8w2OJCHlJMTRosMPMFVEitR6LW+0U0u9wVEGDLPzeJv5WF7m w89TUT/YWM/KwpdJqILlS8HPsNvEnY9fmBcIYC2RQUPD9w7Zz0l5pOx6RBhovPY8 ABIdaPSzWNnn3e61LvatIH2SEyDrOjIfWdJdLE94w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=mWKVET DthVqYw6lo7uRCHBrRz9S6X96e5Ey+PGnxe64=; b=CJbBv7YYGj7kIQvwr/3Ydf 2tijfd1NlMoCzO9XWdxAD5WGDe06V84ZcyspKy6DoUPMUCgsn4jHHBEkIHZnrQ4V YVmZEWdkYjzJDn8iYk06KnHZATAfnHala5wT/mZmcrykwCxLXOhU5VQLSLwU/cx2 V1h+dB6q4XKIqnTYPIskV0H4xcTucVfVFhic7OZwJK+T0f7hVMswHTE9v70Vh8Lf woxVU7Cihg+u0QnX5xIK0es5X5HCRNz2Cnt79j/TVhTLtpMKQg1jbXs7oMDreH8c fOX3na/SZ92DQJiCbx1OygJHqT9RkJfDMBop5AT1eWHvPdFMVHQn2X36gaHBFPpg == X-ME-Sender: Received: from ranger.suse (50-197-80-2-static.hfc.comcastbusiness.net [50.197.80.2]) by mail.messagingengine.com (Postfix) with ESMTPA id 82863E4483; Tue, 10 Apr 2018 12:55:18 -0400 (EDT) Subject: Re: Postgresql Split Brain: Which one is latest To: Vikas Sharma Cc: pgsql-general@postgresql.org References: <20ab2308-f781-ef04-3a99-7197dc83315b@aklaver.com> From: Adrian Klaver Message-ID: <2ed1cf8f-4266-6d6c-bc65-7a79a4e7f241@aklaver.com> Date: Tue, 10 Apr 2018 09:55:17 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 04/10/2018 09:47 AM, Vikas Sharma wrote: > Thanks Adrian and Edison, I also think so. At the moment I have 2 > masters, as soon as slave is promoted to master it starts its own > timeline and application might have added data to either of them or > both, only way to find out correct master now is the instance with max > count of data in tables which could incur data loss as well. Correct me > if wrong please? Not sure max count is necessarily a valid indicator: 1) What if there was a legitimate large delete process? 2) The application/end users where looking at two different views of the data at different points in time. Just because the count is higher does not mean the data is actually valid. > > Thanks and Regards > Vikas > > On Tue, Apr 10, 2018, 17:29 Adrian Klaver > wrote: > > On 04/10/2018 08:04 AM, Vikas Sharma wrote: > > Hi Adrian, > > > > This can be a good example: Application server e.g. tomcat having two > > entries to connect to databases, one for master and 2nd for Slave > > (ideally used when slave becomes master). If application is not > able to > > connect to first, it will try to connect to 2nd. > > So the application server had a way of seeing the new master(old slave), > in spite of the network glitch, that the original master database > did not? > > If so and it was distributing data between the two masters on an unknown > schedule, then as Edison pointed out in another post, you really have a > split brain issue. Each master would have it's own view of the data and > latest update would really only be relevant for that master. > > > > > Regards > > Vikas > > > > On 10 April 2018 at 15:26, Adrian Klaver > > > >> wrote: > > > >     On 04/10/2018 06:50 AM, Vikas Sharma wrote: > > > >         Hi, > > > >         We have postgresql 9.5 with streaming > replication(Master-slave) > >         and automatic failover. Due to network glitch we are in > >         master-master situation for quite some time. Please, > could you > >         advise best way to confirm which node is latest in terms of > >         updates to the postgres databases. > > > > > >     It might help to know how the two masters received data when they > >     where operating independently. > > > > > >         Regards > >         Vikas Sharma > > > > > > > >     -- > >     Adrian Klaver > > adrian.klaver@aklaver.com > > > > > > > > > -- > Adrian Klaver > adrian.klaver@aklaver.com > -- Adrian Klaver adrian.klaver@aklaver.com