Metadata journal for a storage system
An example includes receiving a read request specifying a target range and a target checkpoint, and executing a first query to retrieve a first entry of a metadata table. The first entry is a most recent entry of those entries that are older than the target checkpoint and record write ranges overlapping the target range. The example also includes, if the write range in the first entry does not cover all of the target range, determining a remaining portion of the target range that excludes the write range in the first entry. The example also includes executing a second query to retrieve a second entry of the metadata table, where the second entry is a most recent record in a second subset of entries that are older that the target checkpoint and record write ranges overlapping the remaining portion of the target location range.
1 . A computing system comprising:
a processor; and
a machine-readable storage medium comprising instructions, the instructions executable by the processor to:
receive a read request for journal data, wherein the read request specifies a target location range and a target checkpoint;
in response to a receipt of the read request, perform a first query to retrieve a first entry of a metadata table comprising a plurality of entries, wherein the first entry is a most recent entry in a first subset of entries, and wherein each of the first subset of entries is older than the target checkpoint and records a write range that overlaps at least some of the target location range;
determine whether a write range recorded in the first entry covers an entirety of the target location range;
in response to a determination that the write range recorded in the first entry does not cover the entirety of the target location range, determine a remaining portion of the target location range that excludes the write range recorded in the first entry; and
perform a second query to retrieve a second entry of the metadata table, wherein the second entry is a most recent record in a second subset of entries, and wherein each of the second subset of entries is older that the target checkpoint and records a write range that overlaps at least some of the remaining portion of the target location range.
2 . The computing system of claim 1 , including instructions executable by the processor to:
determine whether a write range recorded in the second entry covers an entirety of the remaining portion of the target location range;
in response to a determination that the write range recorded in the second entry covers the entirety of the remaining portion of the target location range, generate an output using combined results of the first query and the second query.
3 . The computing system of claim 2 , including instructions executable by the processor to:
restore, using the output, the target location range to a state that existed at a time of the target checkpoint.
4 . The computing system of claim 1 , including instructions executable by the processor to:
detect a write of a data unit to a storage volume;
in response to a detection of the write:
store a copy of the data unit in a data journal;
generate a new entry of the metadata table; and
populate the new entry with a reference to the copy of the data unit stored in the data journal.
5 . The computing system of claim 4 , including instructions executable by the processor to, in response to the detection of the write:
populate the new entry with a location of the data unit stored in the storage volume; and
populate the new entry with an identifier of a checkpoint that was most recently performed prior to the detection of the write.
6 . The computing system of claim 4 , wherein each entry of the metadata table comprises metadata for a different write to the storage volume.
7 . The computing system of claim 1 , including instructions executable by the processor to:
sort the first subset of entries in a descending order of creation in the metadata table;
select, from the sorted first subset of entries, a single entry that is sorted first in the descending order, wherein the selected single entry is the first entry retrieved by the first query.
8 . The computing system of claim 7 , including instructions executable by the processor to:
sort the first subset of entries using a database index, wherein the database index is a stored data structure that indicates, for each storage location of a plurality of storage locations, the entries for writes to that storage location in order of entry creation.
9 . The computing system of claim 1 , wherein:
in each entry of the metadata table, a write range is recorded as a starting offset (SO) and an ending offset (EO);
in the first query, the target location range is specified as a starting target location (T) and a target length (L);
each write recorded in the metadata table has a maximum write length (M); and
the first query specifies that, for each entry of the first subset of entries:
SO<(T+L),
SO>(T−M), and
EO>T.
10 . A non-transitory machine-readable storage medium comprising instructions executable by a processor to:
receive a read request for journal data, wherein the read request specifies a target location range and a target checkpoint;
in response to a receipt of the read request, perform a first query to retrieve a first entry of a metadata table comprising a plurality of entries, wherein the first entry is a most recent entry in a first subset of entries, and wherein each of the first subset of entries is older than the target checkpoint and records a write range that overlaps at least some of the target location range;
determine whether a write range recorded in the first entry covers an entirety of the target location range;
in response to a determination that the write range recorded in the first entry does not cover the entirety of the target location range, determine a remaining portion of the target location range that excludes the write range recorded in the first entry; and
perform a second query to retrieve a second entry of the metadata table, wherein the second entry is a most recent record in a second subset of entries, and wherein each of the second subset of entries is older that the target checkpoint and records a write range that overlaps at least some of the remaining portion of the target location range.
11 . The non-transitory machine-readable medium of claim 10 , including instructions executable by the processor to:
determine whether a write range recorded in the second entry covers an entirety of the remaining portion of the target location range;
in response to a determination that the write range recorded in the second entry covers the entirety of the remaining portion of the target location range, generate an output using combined results of the first query and the second query.
12 . The non-transitory machine-readable medium of claim 11 , including instructions executable by the processor to:
restore, using the output, the target location range to a state that existed at a time of the target checkpoint.
13 . The non-transitory machine-readable medium of claim 10 , including instructions executable by the processor to:
detect a write of a data unit to a storage volume;
in response to a detection of the write:
store a copy of the data unit in a data journal;
generate a new entry of the metadata table; and
populate the new entry with a reference to the copy of the data unit stored in the data journal.
14 . The non-transitory machine-readable medium of claim 13 , including instructions executable by the processor to, in response to the detection of the write:
populate the new entry with a location of the data unit stored in the storage volume; and
populate the new entry with an identifier of a checkpoint that was most recently performed prior to the detection of the write.
15 . A method comprising:
receiving, by a controller, a read request for journal data, wherein the read request specifies a target location range and a target checkpoint;
in response to a receipt of the read request, executing, by the controller, a first query to retrieve a first entry of a metadata table comprising a plurality of entries, wherein the first entry is a most recent entry in a first subset of entries, and wherein each of the first subset of entries is older than the target checkpoint and records a write range that overlaps at least some of the target location range;
determining, by the controller, whether a write range recorded in the first entry covers an entirety of the target location range;
in response to a determination that the write range recorded in the first entry does not cover the entirety of the target location range, determining, by the controller, a remaining portion of the target location range that excludes the write range recorded in the first entry; and
executing, by the controller, a second query to retrieve a second entry of the metadata table, wherein the second entry is a most recent record in a second subset of entries that are older that the target checkpoint and record write ranges that overlap at least some of the remaining portion of the target location range.
16 . The method of claim 15 , comprising:
determining whether a write range recorded in the second entry covers an entirety of the remaining portion of the target location range;
in response to a determination that the write range recorded in the second entry covers the entirety of the remaining portion of the target location range, generating an output using combined results of the first query and the second query.
17 . The method of claim 16 , comprising:
restoring, using the output, the target location range to a state that existed at a time of the target checkpoint.
18 . The method of claim 15 , comprising:
detecting a write of a data unit to a storage volume;
in response to a detection of the write:
storing a copy of the data unit in a data journal;
generating a new entry of the metadata table; and
populating the new entry with a reference to the copy of the data unit stored in the data journal.
19 . The method of claim 18 , comprising, in response to the detection of the write:
populating the new entry with a location of the data unit stored in the storage volume; and
populating the new entry with an identifier of a checkpoint that was most recently performed prior to the detection of the write.
20 . The method of claim 18 , wherein each entry of the metadata table comprises metadata for a different write to the storage volume.