|
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 allocates pace using some fixed quantum. For example if compressed page size is 932 bytes, then we will |
111 |
| - allocate 1024 block for it in the file. |
| 110 | + It means that we allocates place using some fixed quantum. For example if compressed page size is 932 bytes, then we will |
| 111 | + allocate 1024 bytes 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 page an be moved, we can not any more access page directly by its address and need |
132 |
| - to use extra level of indirection to map logical address of the page to it physical location in the disk. |
133 |
| - It is done using memory-mapped files. In most cases this 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 page can be moved, we can not anymore access 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 location on the disk. |
| 133 | + It is done using mapping files. In most cases the 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 maintain this extra files: flush them during checkpoint, remove when table is dropped, include them in backup and |
| 135 | + But we need to maintain these 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 stores in tablespace information about used compression algorithm and produce error if PostgreSQL is build with different |
| 155 | + CFS stores information about the compression algorithm used in a tablespace and produces error if PostgreSQL is built 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 compress existed tablespace |
172 |
| - or visa versa - decompress compressed tablespace. |
| 171 | + It is not currently possible to alter tablespace compression option, i.e. it is not possible to compress existing tablespace |
| 172 | + or vice versa - decompress compressed tablespace. |
173 | 173 | </para>
|
174 | 174 |
|
175 | 175 | <para>
|
176 |
| - So to use compression/encryption you need to create table space with <varname>compression=true</varname> option. |
177 |
| - You can make this table space default tablespace - in this case all tables will be implicitly created in this database: |
| 176 | + So to use compression/encryption you need to create a tablespace with <varname>compression=true</varname> option. |
| 177 | + You can make this tablespace 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, then them split work based on hash of file inode. |
| 285 | + If there are more than one GC workers, then they split work based on hash of file inode. |
286 | 286 | </para>
|
287 | 287 |
|
288 | 288 | <para>
|
|
0 commit comments