1PMEMPOOL_SYNC(3)           PMDK Programmer's Manual           PMEMPOOL_SYNC(3)
2
3
4

NAME

6       pmempool_sync(),  pmempool_transform()  -- pool set synchronization and
7       transformation
8

SYNOPSIS

10              #include <libpmempool.h>
11
12              int pmempool_sync(const char *poolset_file,
13                  unsigned flags); (EXPERIMENTAL)
14              int pmempool_transform(const char *poolset_file_src,
15                  const char *poolset_file_dst, unsigned flags); (EXPERIMENTAL)
16

DESCRIPTION

18       The pmempool_sync() function synchronizes data between replicas  within
19       a pool set.
20
21       pmempool_sync() accepts two arguments:
22
23       · poolset_file - a path to a pool set file,
24
25       · flags  -  a combination of flags (ORed) which modify how synchroniza‐
26         tion is performed.
27
28         NOTE: Only the pool set file used to create the pool should  be  used
29         for syncing the pool.
30
31       The following flags are available:
32
33       · PMEMPOOL_DRY_RUN  - do not apply changes, only check for viability of
34         synchronization.
35
36       pmempool_sync() checks that the metadata of all replicas in a pool  set
37       is  consistent, i.e.  all parts are healthy, and if any of them is not,
38       the corrupted or missing parts are recreated and filled with data  from
39       one of the healthy replicas.
40
41       If  a  pool set has the option SINGLEHDR (see poolset(5)), the internal
42       metadata of each replica is limited to the beginning of the first  part
43       in  the replica.  If the option NOHDRS is used, replicas contain no in‐
44       ternal metadata.  In both cases, only the missing  parts  or  the  ones
45       which cannot be opened are recreated with the pmempool_sync() function.
46
47       pmempool_transform() modifies the internal structure of a pool set.  It
48       supports the following operations:
49
50       · adding one or more replicas,
51
52       · removing one or more replicas_WINUX(.,,
53
54       · adding or removing pool set options.)
55
56       Only one of the above operations can be performed at a time.
57
58       pmempool_transform() accepts three arguments:
59
60       · poolset_file_src - pathname of the pool set file for the source  pool
61         set to be changed,
62
63       · poolset_file_dst - pathname of the pool set file that defines the new
64         structure of the pool set,
65
66       · flags - a combination of flags (ORed) which modify  how  synchroniza‐
67         tion is performed.
68
69       The following flags are available:
70
71       · PMEMPOOL_DRY_RUN  - do not apply changes, only check for viability of
72         transformation.
73
74       When adding or deleting replicas, the two pool set files can differ on‐
75       ly  in  the  definitions  of replicas which are to be added or deleted.
76       When adding or removing pool set options (see poolset(5)), the rest  of
77       both pool set files have to be of the same structure.  The operation of
78       adding/removing a pool set option can be performed on a pool  set  with
79       local  replicas  only.   To add/remove a pool set option to/from a pool
80       set with remote replicas, one has to remove the remote replicas  first,
81       then  add/remove  the  option, and finally recreate the remote replicas
82       having added/removed the pool set option to/from the  remote  replicas'
83       poolset files.  To add a replica it is necessary for its effective size
84       to match or exceed the pool size.  Otherwise the whole operation  fails
85       and  no  changes are applied.  If none of the pool set options is used,
86       the effective size of a replica is the sum of sizes  of  all  its  part
87       files  decreased  by  4096 bytes per each part file.  The 4096 bytes of
88       each part file is utilized for storing internal metadata  of  the  pool
89       part  files.   If the option SINGLEHDR is used, the effective size of a
90       replica is the sum of sizes of all its part  files  decreased  once  by
91       4096 bytes.  In this case only the first part contains internal metada‐
92       ta.  If the option NOHDRS is used, the effective size of a  replica  is
93       the sum of sizes of all its part files.  In this case none of the parts
94       contains internal metadata.
95

RETURN VALUE

97       pmempool_sync() and pmempool_transform() return 0 on  success.   Other‐
98       wise, they return -1 and set errno appropriately.
99

NOTES

101       The  pmempool_sync()  API  is  experimental and it may change in future
102       versions of the library.
103
104       The pmempool_transform() API is experimental and it may change  in  fu‐
105       ture versions of the library.
106

SEE ALSO

108       libpmemlog(7), libpmemobj(7) and <http://pmem.io>
109
110
111
112PMDK - pmempool API version 1.3   2018-03-13                  PMEMPOOL_SYNC(3)
Impressum