|
107 | 107 | <listitem>
|
108 | 108 | <para>
|
109 | 109 | We should implement our own allocator of file space. Usually, to reduce fragmentation, fixed size block allocator is used.
|
110 |
| -it means that we allocatespace using some fixed quantum. For example if compressed page size is 932 bytes, then we will |
111 |
| - allocate 1024block for it in the file. |
| 110 | +It means that we allocatesplace using some fixed quantum. For example if compressed page size is 932 bytes, then we will |
| 111 | + allocate 1024bytes for it in the file. |
112 | 112 | </para>
|
113 | 113 | </listitem>
|
114 | 114 | </varlistentry>
|
|
128 | 128 | </variablelist>
|
129 | 129 |
|
130 | 130 | <para>
|
131 |
| - As far as page location is not fixed and pagean be moved, we can notany moreaccess page directly by its address and need |
132 |
| - to use extra level of indirection to map logical address of the page to it physical locationin the disk. |
133 |
| - It is done usingmemory-mapped files. In most casesthis mapped will be kept in memory (size of the map is 1000 times smaller size |
| 131 | + As far as page location is not fixed and pagecan be moved, we can notanymoreaccess the page directly by its address and need |
| 132 | + to use extra level of indirection to map logical address of the page to it's physical locationon the disk. |
| 133 | + It is done usingmapping files. In most casesthe mapping will be kept in memory (size of the map is 1000 times smaller size |
134 | 134 | of the file) and address translation adds almost no overhead to page access time.
|
135 |
| - But we need to maintainthis extra files: flush them during checkpoint, remove when table is dropped, include them in backup and |
| 135 | + But we need to maintainthese extra files: flush them during checkpoint, remove when table is dropped, include them in backup and |
136 | 136 | so on...
|
137 | 137 | </para>
|
138 | 138 |
|
139 | 139 | <para>
|
140 | 140 | PostgreSQL stores relation in a set of files, size of each file is not exceeding 2Gb. Separate page map is constructed for each file.
|
141 | 141 | Garbage collection in CFS is done by several background workers. Number of this workers and pauses in their work can be
|
142 |
| - configured by database administrator.This workers are splitting work based on inode hash, so them do not conflict with each other. |
| 142 | + configured by database administrator.These workers are splitting work based on inode hash, so them do not conflict with each other. |
143 | 143 | Each file is proceeded separately. The files is blocked for access at the time of garbage collection but complete relation is not
|
144 | 144 | blocked. To ensure data consistency GC creates copies of original data and map files. Once them are flushed to the disk,
|
145 | 145 | new version of data file is atomically renamed to original file name. And then new page map data is copied to memory-mapped file
|
|
152 | 152 | <para>
|
153 | 153 | CFS can be build with several compression libraries: PostgreSQL lz, zlib, lz4, snappy, lzfse...
|
154 | 154 | But this is build time choice: it is not possible now to dynamically choose compression algorithm.
|
155 |
| - CFS storesin tablespaceinformation aboutused compression algorithm andproduce error if PostgreSQL isbuild with different |
| 155 | + CFS stores information aboutthe compression algorithmused in a tablespaceandproduces error if PostgreSQL isbuilt with different |
156 | 156 | library.
|
157 | 157 | </para>
|
158 | 158 |
|
|
168 | 168 |
|
169 | 169 | <para>
|
170 | 170 | Compression can be enabled for particular tablespaces. System relations are not compressed in any case.
|
171 |
| - It is not currently possible to alter tablespace compression option, i.e. it is not possible to compressexisted tablespace |
172 |
| - orvisa versa - decompress compressed tablespace. |
| 171 | + It is not currently possible to alter tablespace compression option, i.e. it is not possible to compressexisting tablespace |
| 172 | + orvice versa - decompress compressed tablespace. |
173 | 173 | </para>
|
174 | 174 |
|
175 | 175 | <para>
|
176 |
| - So to use compression/encryption you need to createtable space with <varname>compression=true</varname> option. |
177 |
| - You can make thistable space default tablespace - in this case all tables will be implicitly created in this database: |
| 176 | + So to use compression/encryption you need to createa tablespace with <varname>compression=true</varname> option. |
| 177 | + You can make thistablespace your default tablespace - in this case all tables will be implicitly created in this database: |
178 | 178 | </para>
|
179 | 179 |
|
180 | 180 | <programlisting>
|
|
282 | 282 | The file is locked at the period of defragmentation, preventing any access to this part of relation.
|
283 | 283 | When defragmentation is completed, garbage collection waits <varname>cfs_gc_delay</varname> milliseconds and continue directory traversal.
|
284 | 284 | After the end of traversal, GC waits <varname>cfs_gc_period</varname> milliseconds and starts new GC iteration.
|
285 |
| - If there are more than one GC workers, thenthem split work based on hash of file inode. |
| 285 | + If there are more than one GC workers, thenthey split work based on hash of file inode. |
286 | 286 | </para>
|
287 | 287 |
|
288 | 288 | <para>
|
|