MANIFEST

MANIFEST handles the organization of VersionSet and VersionEdit into files. It is stored with names like MANIFEST-000000.

The MANIFEST filename changes during LevelDB operations. The CURRENT file contains the name of the MANIFEST file that LevelDB will use in the current session.

VersionSet and VersionEdit

Both VersionSet and VersionEdit manage version-related information.

VersionSet and VersionEdit are friend classes to each other.

Each class has one specific function for writing to and using the MANIFEST file:

image

image

During DB Creation

image

When initially creating the DB, the MANIFEST file is generated through the above process. Initially, a VersionEdit is created with the following values and written to the MANIFEST-000001 file:

These contents are then recorded through the log::Writer function.

During DB Shutdown

image

When LevelDB shuts down, ~DBImpl is called. This deletes the existing VersionSet and writes the data about the current version to the MANIFEST file. This written MANIFEST file allows LevelDB to recover the previous version when it starts up next time.