Tabnine Logo
MVStoreTool.compact
Code IndexAdd Tabnine to your IDE (free)

How to use
compact
method
in
org.h2.mvstore.MVStoreTool

Best Java code snippets using org.h2.mvstore.MVStoreTool.compact (Showing top 17 results out of 315)

origin: com.h2database/h2

} else if ("-compact".equals(args[i])) {
  String fileName = args[++i];
  compact(fileName, false);
} else if ("-compress".equals(args[i])) {
  String fileName = args[++i];
  compact(fileName, true);
} else if ("-rollback".equals(args[i])) {
  String fileName = args[++i];
origin: com.h2database/h2

/**
 * 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.
 *
 * @param fileName the file name
 * @param compress whether to compress the data
 */
public static void compact(String fileName, boolean compress) {
  String tempName = fileName + Constants.SUFFIX_MV_STORE_TEMP_FILE;
  FileUtils.delete(tempName);
  compact(fileName, tempName, compress);
  try {
    FileUtils.moveAtomicReplace(tempName, fileName);
  } catch (DbException e) {
    String newName = fileName + Constants.SUFFIX_MV_STORE_NEW_FILE;
    FileUtils.delete(newName);
    FileUtils.move(tempName, newName);
    FileUtils.delete(fileName);
    FileUtils.move(newName, fileName);
  }
}
origin: com.h2database/h2

MVStoreTool.compact(fileName, true);
origin: com.h2database/h2

/**
 * Copy all live pages from the source store to the target store.
 *
 * @param sourceFileName the name of the source store
 * @param targetFileName the name of the target store
 * @param compress whether to compress the data
 */
public static void compact(String sourceFileName, String targetFileName, boolean compress) {
  MVStore source = new MVStore.Builder().
      fileName(sourceFileName).
      readOnly().
      open();
  FileUtils.delete(targetFileName);
  MVStore.Builder b = new MVStore.Builder().
      fileName(targetFileName);
  if (compress) {
    b.compress();
  }
  MVStore target = b.open();
  compact(source, target);
  target.close();
  source.close();
}
origin: com.eventsourcing/h2

} else if ("-compact".equals(args[i])) {
  String fileName = args[++i];
  compact(fileName, false);
} else if ("-compress".equals(args[i])) {
  String fileName = args[++i];
  compact(fileName, true);
origin: com.h2database/h2-mvstore

} else if ("-compact".equals(args[i])) {
  String fileName = args[++i];
  compact(fileName, false);
} else if ("-compress".equals(args[i])) {
  String fileName = args[++i];
  compact(fileName, true);
} else if ("-rollback".equals(args[i])) {
  String fileName = args[++i];
origin: org.wowtools/h2

} else if ("-compact".equals(args[i])) {
  String fileName = args[++i];
  compact(fileName, false);
} else if ("-compress".equals(args[i])) {
  String fileName = args[++i];
  compact(fileName, true);
} else if ("-rollback".equals(args[i])) {
  String fileName = args[++i];
origin: apache/jackrabbit-oak

@Override
synchronized void closeStore() {
  if (store == null) {
    return;
  }
  boolean compact = compactOnClose;
  try {
    if (store.getFileStore().isReadOnly()) {
      compact = false;
    }
    // clear the interrupted flag, if set
    Thread.interrupted();
    store.close();
  } catch (Exception e) {
    exceptionCount++;
    LOG.debug("Could not close the store", e);
    LOG.warn("Could not close the store: " + e);
    store.closeImmediately();
  }
  if (compact) {
    try {
      MVStoreTool.compact(fileName, true);
    } catch (Exception e) {
      exceptionCount++;
      LOG.debug("Could not compact the store", e);
      LOG.warn("Could not compact the store: " + e);
    }
  }
  store = null;
}
origin: org.apache.jackrabbit/oak-store-document

@Override
synchronized void closeStore() {
  if (store == null) {
    return;
  }
  boolean compact = compactOnClose;
  try {
    if (store.getFileStore().isReadOnly()) {
      compact = false;
    }
    // clear the interrupted flag, if set
    Thread.interrupted();
    store.close();
  } catch (Exception e) {
    exceptionCount++;
    LOG.debug("Could not close the store", e);
    LOG.warn("Could not close the store: " + e);
    store.closeImmediately();
  }
  if (compact) {
    try {
      MVStoreTool.compact(fileName, true);
    } catch (Exception e) {
      exceptionCount++;
      LOG.debug("Could not compact the store", e);
      LOG.warn("Could not compact the store: " + e);
    }
  }
  store = null;
}
origin: com.eventsourcing/h2

/**
 * 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.
 *
 * @param fileName the file name
 * @param compress whether to compress the data
 */
public static void compact(String fileName, boolean compress) {
  String tempName = fileName + Constants.SUFFIX_MV_STORE_TEMP_FILE;
  FileUtils.delete(tempName);
  compact(fileName, tempName, compress);
  try {
    FileUtils.moveAtomicReplace(tempName, fileName);
  } catch (DbException e) {
    String newName = fileName + Constants.SUFFIX_MV_STORE_NEW_FILE;
    FileUtils.delete(newName);
    FileUtils.move(tempName, newName);
    FileUtils.delete(fileName);
    FileUtils.move(newName, fileName);
  }
}
origin: com.h2database/h2-mvstore

/**
 * 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.
 *
 * @param fileName the file name
 * @param compress whether to compress the data
 */
public static void compact(String fileName, boolean compress) {
  String tempName = fileName + Constants.SUFFIX_MV_STORE_TEMP_FILE;
  FileUtils.delete(tempName);
  compact(fileName, tempName, compress);
  try {
    FileUtils.moveAtomicReplace(tempName, fileName);
  } catch (DbException e) {
    String newName = fileName + Constants.SUFFIX_MV_STORE_NEW_FILE;
    FileUtils.delete(newName);
    FileUtils.move(tempName, newName);
    FileUtils.delete(fileName);
    FileUtils.move(newName, fileName);
  }
}
origin: org.wowtools/h2

/**
 * 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.
 *
 * @param fileName the file name
 * @param compress whether to compress the data
 */
public static void compact(String fileName, boolean compress) {
  String tempName = fileName + Constants.SUFFIX_MV_STORE_TEMP_FILE;
  FileUtils.delete(tempName);
  compact(fileName, tempName, compress);
  try {
    FileUtils.moveAtomicReplace(tempName, fileName);
  } catch (DbException e) {
    String newName = fileName + Constants.SUFFIX_MV_STORE_NEW_FILE;
    FileUtils.delete(newName);
    FileUtils.move(tempName, newName);
    FileUtils.delete(fileName);
    FileUtils.move(newName, fileName);
  }
}
origin: org.wowtools/h2

MVStoreTool.compact(fileName, true);
origin: com.eventsourcing/h2

MVStoreTool.compact(fileName, true);
origin: com.h2database/h2-mvstore

/**
 * Copy all live pages from the source store to the target store.
 *
 * @param sourceFileName the name of the source store
 * @param targetFileName the name of the target store
 * @param compress whether to compress the data
 */
public static void compact(String sourceFileName, String targetFileName, boolean compress) {
  MVStore source = new MVStore.Builder().
      fileName(sourceFileName).
      readOnly().
      open();
  FileUtils.delete(targetFileName);
  MVStore.Builder b = new MVStore.Builder().
      fileName(targetFileName);
  if (compress) {
    b.compress();
  }
  MVStore target = b.open();
  compact(source, target);
  target.close();
  source.close();
}
origin: org.wowtools/h2

/**
 * Copy all live pages from the source store to the target store.
 *
 * @param sourceFileName the name of the source store
 * @param targetFileName the name of the target store
 * @param compress whether to compress the data
 */
public static void compact(String sourceFileName, String targetFileName, boolean compress) {
  MVStore source = new MVStore.Builder().
      fileName(sourceFileName).
      readOnly().
      open();
  FileUtils.delete(targetFileName);
  MVStore.Builder b = new MVStore.Builder().
      fileName(targetFileName);
  if (compress) {
    b.compress();
  }
  MVStore target = b.open();
  compact(source, target);
  target.close();
  source.close();
}
origin: com.eventsourcing/h2

/**
 * Copy all live pages from the source store to the target store.
 *
 * @param sourceFileName the name of the source store
 * @param targetFileName the name of the target store
 * @param compress whether to compress the data
 */
public static void compact(String sourceFileName, String targetFileName, boolean compress) {
  MVStore source = new MVStore.Builder().
      fileName(sourceFileName).
      readOnly().
      open();
  FileUtils.delete(targetFileName);
  MVStore.Builder b = new MVStore.Builder().
      fileName(targetFileName);
  if (compress) {
    b.compress();
  }
  MVStore target = b.open();
  compact(source, target);
  target.close();
  source.close();
}
org.h2.mvstoreMVStoreToolcompact

Javadoc

Copy all live pages from the source store to the target store.

Popular methods of MVStoreTool

  • dump
    Read the contents of the file and write them to system out.
  • formatTimestamp
  • getCompressor
  • getPercent
  • info
    Read the summary information of the file and write them to system out.
  • compactCleanUp
    Clean up if needed, in a case a compact operation was interrupted due to killing the process or a po
  • repair
    Repair a store by rolling back to the newest good version.
  • rollback
    Roll back to a given revision into a a file called *.temp.

Popular in Java

  • Reactive rest calls using spring rest template
  • runOnUiThread (Activity)
  • setScale (BigDecimal)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • ImageIO (javax.imageio)
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Top 15 Vim Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now