.\" Automatically generated by Pandoc 1.16.0.2
.\"
.TH "PMEMPOOL_SYNC" "3" "2017-12-22" "PMDK - pmempool API version 1.1" "PMDK Programmer's Manual"
.hy
.\" Copyright 2014-2017, Intel Corporation
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\"
.\" * Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\"
.\" * Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\"
.\" * Neither the name of the copyright holder nor the names of its
.\" contributors may be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
.\" OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.SH NAME
.PP
\f[B]pmempool_sync\f[](), \f[B]pmempool_transform\f[]() \-\- pool set
synchronization and transformation
.SH SYNOPSIS
.IP
.nf
\f[C]
#include\ <libpmempool.h>
int\ pmempool_sync(const\ char\ *poolset_file,\
\ \ \ \ unsigned\ flags);\ (EXPERIMENTAL)
int\ pmempool_transform(const\ char\ *poolset_file_src,
\ \ \ \ const\ char\ *poolset_file_dst,\ unsigned\ flags);\ (EXPERIMENTAL)
\f[]
.fi
.SH DESCRIPTION
.PP
The \f[B]pmempool_sync\f[]() function synchronizes data between replicas
within a pool set.
.PP
\f[B]pmempool_sync\f[]() accepts two arguments:
.IP \[bu] 2
\f[I]poolset_file\f[] \- a path to a pool set file,
.IP \[bu] 2
\f[I]flags\f[] \- a combination of flags (ORed) which modify how
synchronization is performed.
.RS
.PP
NOTE: Only the pool set file used to create the pool should be used for
syncing the pool.
.RE
.PP
The following flags are available:
.IP \[bu] 2
\f[B]PMEMPOOL_DRY_RUN\f[] \- do not apply changes, only check for
viability of synchronization.
.PP
\f[B]pmempool_sync\f[]() checks that the metadata of all replicas in a
pool set is consistent, i.e.
all parts are healthy, and if any of them is not, the corrupted or
missing parts are recreated and filled with data from one of the healthy
replicas.
.PP
If a pool set has the option \f[I]NOHDRS\f[] (see \f[B]poolset\f[](5)),
the internal metadata of each replica is limited to the beginning of the
first part in the replica.
In that case, only missing parts or the ones which cannot be opened are
recreated with the \f[B]pmempool_sync\f[]() function.
.PP
\f[B]pmempool_transform\f[]() modifies the internal structure of a pool
set.
It supports the following operations:
.IP \[bu] 2
adding one or more replicas,
.IP \[bu] 2
removing one or more replicas_WINUX(.,,
.IP \[bu] 2
adding or removing pool set options.)
.PP
Only one of the above operations can be performed at a time.
.PP
\f[B]pmempool_transform\f[]() accepts three arguments:
.IP \[bu] 2
\f[I]poolset_file_src\f[] \- pathname of the pool \f[I]set\f[] file for
the source pool set to be changed,
.IP \[bu] 2
\f[I]poolset_file_dst\f[] \- pathname of the pool \f[I]set\f[] file that
defines the new structure of the pool set,
.IP \[bu] 2
\f[I]flags\f[] \- a combination of flags (ORed) which modify how
synchronization is performed.
.PP
The following flags are available:
.IP \[bu] 2
\f[B]PMEMPOOL_DRY_RUN\f[] \- do not apply changes, only check for
viability of transformation.
.PP
When adding or deleting replicas, the two pool set files can differ only
in the definitions of replicas which are to be added or deleted.
When adding or removing the \f[I]NOHDRS\f[] option (see
\f[B]poolset\f[](5)), the rest of both pool set files have to be of the
same structure.
The operation of adding/removing the \f[I]NOHDRS\f[] option can be
performed on a poolset with local replicas only.
To add/remove the \f[I]NOHDRS\f[] option to/from a poolset with remote
replicas, one has to remove the remote replicas first, then add/remove
the option, and finally recreate the remote replicas having
added/removed the \f[I]NOHDRS\f[] option to/from the remote
replicas\[aq] poolset files.
To add a replica it is necessary for its effective size to match or
exceed the pool size.
Otherwise the whole operation fails and no changes are applied.
If the option \f[I]NOHDRS\f[] is not used, the effective size of a
replica is the sum of sizes of all its part files decreased by 4096
bytes per each part file.
The 4096 bytes of each part file is utilized for storing internal
metadata of the pool part files.
If the option \f[I]NOHDRS\f[] is used, the effective size of a replica
is the sum of sizes of all its part files decreased once by 4096 bytes.
In this case only the first part contains internal metadata.
.SH RETURN VALUE
.PP
\f[B]pmempool_sync\f[]() and \f[B]pmempool_transform\f[]() return 0 on
success.
Otherwise, they return \-1 and set \f[I]errno\f[] appropriately.
.SH NOTES
.PP
The \f[B]pmempool_sync\f[]() API is experimental and it may change in
future versions of the library.
.PP
The \f[B]pmempool_transform\f[]() API is experimental and it may change
in future versions of the library.
.SH SEE ALSO
.PP
\f[B]libpmemlog\f[](7), \f[B]libpmemobj\f[](7) and
\f[B]<http://pmem.io>\f[]