From: Petr Jelinek Date: Mon, 15 Sep 2014 15:56:14 +0000 (+0200) Subject: bdr: WAL log bdr sequences correcly X-Git-Tag: bdr-plugin/dynconf-before-global-add~127 X-Git-Url: http://git.postgresql.org/gitweb/static/session/%7B%7Bsession.id%7D%7D-%7B%7Bsession.title%7Cslugify%7D%7D?a=commitdiff_plain;h=b19b7ad0df2fce576cf8b28c3920d638536104f8;p=2ndquadrant_bdr.git bdr: WAL log bdr sequences correcly --- diff --git a/bdr_seq.c b/bdr_seq.c index 57c6bbb3f6..90860e79ec 100644 --- a/bdr_seq.c +++ b/bdr_seq.c @@ -1204,6 +1204,8 @@ bdr_sequence_alloc(PG_FUNCTION_ARGS) if (wakeup) bdr_sequencer_wakeup(); + next = result + log - 1; + elm->last = result; elm->cached = result; elm->last_valid = true; @@ -1239,7 +1241,7 @@ bdr_sequence_alloc(PG_FUNCTION_ARGS) /* Now update sequence tuple to the intended final state */ seq->last_value = elm->last; /* last fetched number */ seq->is_called = true; - seq->log_cnt = log; /* how much is logged */ + seq->log_cnt = log-1; /* how much is logged */ result = elm->last;