| .. Licensed to the Apache Software Foundation (ASF) under one | |
| .. or more contributor license agreements. See the NOTICE file | |
| .. distributed with this work for additional information | |
| .. regarding copyright ownership. The ASF licenses this file | |
| .. to you under the Apache License, Version 2.0 (the | |
| .. "License"); you may not use this file except in compliance | |
| .. with the License. You may obtain a copy of the License at | |
| .. http://www.apache.org/licenses/LICENSE-2.0 | |
| .. Unless required by applicable law or agreed to in writing, | |
| .. software distributed under the License is distributed on an | |
| .. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
| .. KIND, either express or implied. See the License for the | |
| .. specific language governing permissions and limitations | |
| .. under the License. | |
| .. Ported from the Paimon documentation: | |
| .. https://github.com/apache/paimon/blob/master/docs/content/concepts/spec/snapshot.md | |
| Snapshot | |
| ======== | |
| Direct file-system commits publish snapshot files with consecutive snapshot ids | |
| starting from 1. The layout and hint files below describe those published files. | |
| ``EARLIEST`` and ``LATEST`` are hint files at the beginning and end of the snapshot list, and they can be inaccurate. | |
| When hint files are inaccurate, the reader will scan all snapshot files to determine the beginning and end. | |
| A catalog that manages table versions can hold the latest snapshot without a | |
| snapshot file under the table path. Publication then depends on catalog | |
| acceptance. ``UseRESTCatalogCommit(true)`` only prepares the request for the | |
| caller to send; it does not publish a snapshot. See :doc:`commit` and | |
| :doc:`catalog` for these modes and their historical metadata requirements. | |
| Directory Layout | |
| ---------------- | |
| .. code-block:: shell | |
| warehouse | |
| └── default.db | |
| └── my_table | |
| ├── snapshot | |
| ├── EARLIEST | |
| ├── LATEST | |
| ├── snapshot-1 | |
| ├── snapshot-2 | |
| └── snapshot-3 | |
| A direct file-system commit attempts to publish the next snapshot id. Once the | |
| snapshot file is successfully published, the commit becomes visible. | |
| Snapshot File | |
| ------------- | |
| Snapshot file is JSON and includes: | |
| 1. ``version``: Snapshot file version, current is 3. | |
| 2. ``uuid``: Uuid of this snapshot, generated on the client when the snapshot is created and absent only for a snapshot written before uuid was introduced. A commit names the uuid of the snapshot it is based on, so that a catalog can refuse a commit which raced another. | |
| 3. ``id``: Snapshot id, same as the file name. | |
| 4. ``schemaId``: The corresponding schema version for this commit. | |
| 5. ``baseManifestList``: A manifest list recording all changes from the previous snapshots. | |
| 6. ``baseManifestListSize``: Size in bytes of the base manifest list; optional. | |
| 7. ``deltaManifestList``: A manifest list recording all new changes occurred in this snapshot. | |
| 8. ``deltaManifestListSize``: Size in bytes of the delta manifest list; optional. | |
| 9. ``changelogManifestList``: A manifest list recording all changelog produced in this snapshot; omitted by C++ serialization if unset. | |
| 10. ``changelogManifestListSize``: Size in bytes of the changelog manifest list; optional. | |
| 11. ``indexManifest``: A manifest recording all index files of this table; omitted by C++ serialization if unset. | |
| 12. ``commitUser``: Usually generated by UUID; used for recovery of streaming writes—one stream write job with one user. | |
| 13. ``commitIdentifier``: Transaction id corresponding to streaming write; each transaction may result in multiple commits for different ``commitKind`` values. | |
| 14. ``commitKind``: Type of changes in this snapshot, including ``append``, ``compact``, ``overwrite`` and ``analyze``. | |
| 15. ``timeMillis``: Commit time in milliseconds. | |
| 16. ``totalRecordCount``: Record count of all changes occurred in this snapshot. | |
| 17. ``deltaRecordCount``: Record count of all new changes occurred in this snapshot. | |
| 18. ``changelogRecordCount``: Record count of all changelog produced in this snapshot; optional. | |
| 19. ``watermark``: Watermark for input records. When unset, C++ serialization omits this field. | |
| A commit carries forward the previous snapshot's watermark if no new watermark is supplied. | |
| 20. ``statistics``: Stats file name for statistics of this table; optional. | |
| 21. ``properties``: Optional string-to-string map of snapshot properties, including real-time progress metadata when enabled. | |
| 22. ``nextRowId``: Next row id for row tracking; optional. | |
| The C++ snapshot serializer does not emit ``logOffsets``. |