MVStoreTool

Utility methods used in combination with the MVStore.

Methods
static void compact(String fileName, boolean compress)
Compress the store by creating a new file and copying the live pages there.
static void compact(String fileName, boolean compress)
Compress the store by creating a new file and copying the live pages there. Temporarily, a file with the suffix ".tempFile" is created. This file is then renamed, replacing the original file, if possible. If not, the new file is renamed to ".newFile", then the old file is removed, and the new file is renamed. This might be interrupted, so it's better to compactCleanUp before opening a store, in case this method was used.
Parameters:
fileName - the file name
compress - whether to compress the data
static void compact(String sourceFileName, String targetFileName, boolean compress)
Copy all live pages from the source store to the target store.
static void compact(String sourceFileName, String targetFileName, boolean compress)
Copy all live pages from the source store to the target store.
Parameters:
sourceFileName - the name of the source store
targetFileName - the name of the target store
compress - whether to compress the data
static void compact(MVStore source, MVStore target)
Copy all live pages from the source store to the target store.
static void compact(MVStore source, MVStore target)
Copy all live pages from the source store to the target store.
Parameters:
source - the source store
target - the target store
static void compactCleanUp(String fileName)
Clean up if needed, in a case a compact operation was interrupted due to killing the process or a power failure.
static void compactCleanUp(String fileName)
Clean up if needed, in a case a compact operation was interrupted due to killing the process or a power failure. This will delete temporary files (if any), and in case atomic file replacements were not used, rename the new file.
Parameters:
fileName - the file name
static void dump(String fileName, boolean details)
Read the contents of the file and write them to system out.
static void dump(String fileName, boolean details)
Read the contents of the file and write them to system out.
Parameters:
fileName - the name of the file
details - whether to print details
static void dump(String fileName, Writer writer, boolean details)
Read the contents of the file and display them in a human-readable format.
static void dump(String fileName, Writer writer, boolean details)
Read the contents of the file and display them in a human-readable format.
Parameters:
fileName - the name of the file
writer - the print writer
details - print the page details
static void info(String fileName)
Read the summary information of the file and write them to system out.
static void info(String fileName)
Read the summary information of the file and write them to system out.
Parameters:
fileName - the name of the file
static String info(String fileName, Writer writer)
Read the summary information of the file and write them to system out.
static String info(String fileName, Writer writer)
Read the summary information of the file and write them to system out.
Parameters:
fileName - the name of the file
writer - the print writer
Returns:
null if successful (if there was no error), otherwise the error message
static void main(String... args)
Runs this tool.
static void main(String... args)
Runs this tool. Options are case sensitive. Supported options are:
[-dump <fileName>] Dump the contends of the file
[-info <fileName>] Get summary information about a file
[-compact <fileName>] Compact a store
[-compress <fileName>] Compact a store with compression enabled
Parameters:
args - the command line arguments
static void repair(String fileName)
Repair a store by rolling back to the newest good version.
static void repair(String fileName)
Repair a store by rolling back to the newest good version.
Parameters:
fileName - the file name
static long rollback(String fileName, long targetVersion, Writer writer)
Roll back to a given revision into a a file called *.temp.
static long rollback(String fileName, long targetVersion, Writer writer)
Roll back to a given revision into a a file called *.temp.
Parameters:
fileName - the file name
targetVersion - the version to roll back to (Long.MAX_VALUE for the latest version)
writer - the log writer
Returns:
the version rolled back to (-1 if no version)