BUG #13910: synchronous replication not sync data occasionally
От | wangzilong@yeezon.com |
---|---|
Тема | BUG #13910: synchronous replication not sync data occasionally |
Дата | |
Msg-id | 20160204004511.2780.1045@wrigleys.postgresql.org обсуждение исходный текст |
Ответы |
Re: BUG #13910: synchronous replication not sync data occasionally
|
Список | pgsql-bugs |
The following bug has been logged on the website: Bug reference: 13910 Logged by: chris Email address: wangzilong@yeezon.com PostgreSQL version: 9.5.0 Operating system: CentOS 6 Description: I am suffering this problem since postgresql v9.3. Most of the time, synchronous replication works great, occasionally, the standby is not synchronous. Demo Code: env: ruby 2.2.2, centos 6, postgresql95-devel require 'sequel' require 'pg' Sequel::Model.plugin(:schema) Sequel::Model.plugin(:validation_helpers) Sequel::Model.raise_on_save_failure = true Sequel::Model.db = DB = Sequel.postgres(:host => '192.168.2.126', :user => 'test', :password => '123456', :database => 'test', :pool_timeout => 30, :servers=>{:read_only=>{:host=>'192.168.2.113'}}) / * CREATE TABLE public.test_data ( id integer NOT NULL DEFAULT nextval('test_data_id_seq'::regclass), field_one text, field_two text, field_three text, field_four text, field_five text, CONSTRAINT test_data_pkey PRIMARY KEY (id) ) WITH ( OIDS=FALSE ); ALTER TABLE public.test_data OWNER TO test; * / class TestData < Sequel::Model(:test_data) end (1..10000).each do |a| id = '' #DB.transaction do n = TestData.new(:field_one => 'hello') n.save id = n.id #end d = TestData.first(:id => id) if d.nil? puts "#{id} first nil catch" (1..100).each do |i| t = TestData.first(:id => id) if t.nil? puts "#{id} time:#{i.to_s} nil catch" else break end end end end puts 'done' If write transaction is synchronous to standby, as the document shows, the program should output 'done'. But, there always 1 or 2 record, are not synchronous. Retry them several times could get correct data. There is no error in program or postgresql. The program shows, master does not confirm the write transaction synchronous to standby, and returns the result. It's not correct according to the document.
В списке pgsql-bugs по дате отправления: