Snapdiff with changelist has been introduced in OneFS 8.2.2.0. It can return what regions of a file have been changed. However this functionality is hidden from WebUI and CLI and I see many customers are very interested in this new feature. This article will walk you through an example.
To create a snapdiff changelist, you have to add the option “–create-diffs” which is disabled by default.
# isi job start changelistcreate --newer-snapid=24 --older-snapid=22 --create-diffs
Note, you will not see this option in the help or description page of the CLI command.
After that you can either use isi_changelist_mod command to view the outcome. To include snapdiff deltas in the output, you have to add the option “–x”
# isi_changelist_mod -a 22_24 --x st_ino=4306829722 st_mode=0100700 st_size=2837 st_atime=1614240223 st_mtime=1614240223 st_ctime=1614240223 st_flags=285212896 cl_flags=ENTRY_MODIFIED path=/ifs/test/test.txt offset:0 size:2837 type: data
You can also leverage PAPI for the same purpose. The corresponding PAPI endpoint is:
platform/10/snapshot/changelists/<CHANGELIST>/diff-regions/<LIN>
Note, it’s only available starting from platform/10. To get a very detailed description of the PAPI you can use the following URL:
platform/10/snapshot/changelists/<CHANGELIST>/diff-regions/<LIN>/?describe
Resource URL: /platform/10/snapshot/changelists/<CHANGELIST>/diff-regions/<LIN>
Overview: This resource represents the collection of snap diff regions.
Methods: GET
********************************************************************************
Method GET: Get snap diff regions of a file.
URL: GET /platform/10/snapshot/changelists/<CHANGELIST>/diff-regions/<LIN>
Query arguments:
resume=<string> Continue returning results from previous call using this token
(token should come from the previous call, resume cannot be
used with other options).
limit=<integer> Return no more than this many results at once (see resume).
offset=<integer>
GET response body schema:
{
"type": [
{
"additionalProperties": false,
"type": "object",
"description": "A list of errors that may be returned.",
"properties": {
"errors": {
"minItems": 1,
"items": {
"additionalProperties": false,
"type": "object",
"description": "An object describing a single error.",
"properties": {
"field": {
"minLength": 1,
"type": "string",
"description": "The field with the error if applicable.",
"maxLength": 8192
},
"message": {
"minLength": 1,
"type": "string",
"description": "The error message.",
"maxLength": 8192
},
"code": {
"minLength": 1,
"type": "string",
"description": "The error code.",
"maxLength": 8192
}
}
},
"type": "array",
"maxItems": 65535
}
}
},
{
"additionalProperties": false,
"type": "object",
"properties": {
"diff_regions": {
"minItems": 0,
"items": {
"type": "object",
"properties": {
"byte_count": {
"required": true,
"minimum": 0,
"type": "integer",
"description": "Byte count of change region.",
"maximum": 18446744073709551615
},
"region_type": {
"required": true,
"description": "Type of change region.",
"minLength": 4,
"enum": [
"sparse",
"data",
"unchanged"
],
"maxLength": 9,
"type": "string"
},
"start_offset": {
"required": true,
"minimum": 0,
"type": "integer",
"description": "Starting byte offset of change region.",
"maximum": 18446744073709551615
}
}
},
"type": "array",
"maxItems": 18446744073709551615
},
"resume": {
"minLength": 0,
"type": [
"string",
"null"
],
"description": "Provide this token as the 'resume' query argument to continue listing results.",
"maxLength": 8192
}
}
}
]
}
Here is the output for the same example:
URL:
https://192.168.116.188:8080/platform/10/snapshot/changelists/22_24/diff-regions/4306829722
Outcome:
{
"diff_regions" :
[
{
"byte_count" : 2837,
"region_type" : "data",
"start_offset" : 0
}
],
"resume" : null
}