1() PMDK Programmer's Manual ()
2
3
4
6 pmempool_sync(), pmempool_transform() - pool set synchronization and
7 transformation
8
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
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 NOTE: The pmempool_sync() cannot do anything useful if there are no
32 replicas in the pool set. In such case, it fails with an error.
33
34 NOTE: At the moment, replication is only supported for libpmemobj(7)
35 pools, so pmempool_sync() cannot be used with other pool types (libp‐
36 memlog(7), libpmemblk(7)).
37
38 The following flags are available:
39
40 • PMEMPOOL_SYNC_DRY_RUN - do not apply changes, only check for viabili‐
41 ty of synchronization.
42
43 pmempool_sync() checks that the metadata of all replicas in a pool set
44 is consistent, i.e. all parts are healthy, and if any of them is not,
45 the corrupted or missing parts are recreated and filled with data from
46 one of the healthy replicas.
47
48 If a pool set has the option SINGLEHDR (see poolset(5)), the internal
49 metadata of each replica is limited to the beginning of the first part
50 in the replica. If the option NOHDRS is used, replicas contain no in‐
51 ternal metadata. In both cases, only the missing parts or the ones
52 which cannot be opened are recreated with the pmempool_sync() function.
53
54 pmempool_transform() modifies the internal structure of a pool set. It
55 supports the following operations:
56
57 • adding one or more replicas,
58
59 • removing one or more replicas ,
60
61 • adding or removing pool set options.
62
63 Only one of the above operations can be performed at a time.
64
65 pmempool_transform() accepts three arguments:
66
67 • poolset_file_src - pathname of the pool set file for the source pool
68 set to be changed,
69
70 • poolset_file_dst - pathname of the pool set file that defines the new
71 structure of the pool set,
72
73 • flags - a combination of flags (ORed) which modify how synchroniza‐
74 tion is performed.
75
76 The following flags are available:
77
78 • PMEMPOOL_TRANSFORM_DRY_RUN - do not apply changes, only check for vi‐
79 ability of transformation.
80
81 NOTE: At the moment, transform operation is only supported for libp‐
82 memobj(7) pools, so pmempool_transform() cannot be used with other
83 pool types (libpmemlog(7), libpmemblk(7)).
84
86 pmempool_sync() and pmempool_transform() return 0 on success. Other‐
87 wise, they return -1 and set errno appropriately.
88
90 EINVAL Invalid format of the input/output pool set file.
91
92 EINVAL Unsupported flags value.
93
94 EINVAL There is only master replica defined in the input pool set
95 passed to pmempool_sync().
96
97 EINVAL The source pool set passed to pmempool_transform() is not a
98 libpmemobj pool.
99
100 EINVAL The input and output pool sets passed to pmempool_transform()
101 are identical.
102
103 EINVAL Attempt to perform more than one transform operation at a time.
104
106 The pmempool_sync() API is experimental and it may change in future
107 versions of the library.
108
109 The pmempool_transform() API is experimental and it may change in fu‐
110 ture versions of the library.
111
113 libpmemlog(7), libpmemobj(7) and <https://pmem.io>
114
115
116
117PMDK - 2023-06-05 ()