diff options
author | Nirbhay Choubey <nirbhay@mariadb.com> | 2015-07-14 16:58:38 -0400 |
---|---|---|
committer | Nirbhay Choubey <nirbhay@mariadb.com> | 2015-07-14 16:58:38 -0400 |
commit | dd4d81ddfd36e35b2eac96e07a931276a13db949 (patch) | |
tree | 3c0c89d2094d8c654433ae705e8743de154f98ee /sql/wsrep_binlog.cc | |
parent | dced5146bdfc46e200ba35a86c3c55fb60972e33 (diff) | |
download | mariadb-git-dd4d81ddfd36e35b2eac96e07a931276a13db949.tar.gz |
Update read_pos after reading from the cache.
Diffstat (limited to 'sql/wsrep_binlog.cc')
-rw-r--r-- | sql/wsrep_binlog.cc | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/sql/wsrep_binlog.cc b/sql/wsrep_binlog.cc index 3788a6c9074..0bc04ebb066 100644 --- a/sql/wsrep_binlog.cc +++ b/sql/wsrep_binlog.cc @@ -71,7 +71,13 @@ int wsrep_write_cache_buf(IO_CACHE *cache, uchar **buf, size_t *buf_len) memcpy(*buf + *buf_len, cache->read_pos, length); *buf_len = total_length; - } while ((cache->file >= 0) && (length = my_b_fill(cache))); + + if (cache->file < 0) + { + cache->read_pos= cache->read_end; + break; + } + } while ((length = my_b_fill(cache))); if (reinit_io_cache(cache, WRITE_CACHE, saved_pos, 0, 0)) { @@ -199,7 +205,12 @@ static int wsrep_write_cache_once(wsrep_t* const wsrep, memcpy(buf + used, cache->read_pos, length); used = total_length; - } while ((cache->file >= 0) && (length = my_b_fill(cache))); + if (cache->file < 0) + { + cache->read_pos= cache->read_end; + break; + } + } while ((length = my_b_fill(cache))); if (used > 0) err = wsrep_append_data(wsrep, &thd->wsrep_ws_handle, buf, used); @@ -268,7 +279,12 @@ static int wsrep_write_cache_inc(wsrep_t* const wsrep, cache->read_pos, length))) goto cleanup; - } while ((cache->file >= 0) && (length = my_b_fill(cache))); + if (cache->file < 0) + { + cache->read_pos= cache->read_end; + break; + } + } while ((length = my_b_fill(cache))); if (WSREP_OK == err) *len = total_length; @@ -394,7 +410,13 @@ void wsrep_dump_rbr_direct(THD* thd, IO_CACHE* cache) WSREP_ERROR("Failed to write file '%s'", filename); goto cleanup; } - } while ((cache->file >= 0) && (bytes_in_cache= my_b_fill(cache))); + + if (cache->file < 0) + { + cache->read_pos= cache->read_end; + break; + } + } while ((bytes_in_cache= my_b_fill(cache))); if(cache->error == -1) { WSREP_ERROR("RBR inconsistent"); |