mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Nicolas Capponi
22.06.2014 a73324289d9ff413e1935adc124227c9528442e7
OPENDJ-1472 : File based changelog : optimize random seek in each log file
CR-3727

[Note: real merge of all changelog.file package content to be done in one shot in
a future commit]

Implements read and write with blocks, to enable binary search.

* New BlockLogReader class: read records sequentially or using
binary search provided a key

* New BlockLogWriter class: write records by blocks

* New BlockLogReaderWriterTest class : tests read/write with blocks

* Update LogFile : delegate responsibility for read/write to BlockLogXXX

* Add method ByteStringBuilder#append(DataInput, int) to avoid
byte array copy

* Minor changes in other files
2 files modified
15 ■■■■■ changed files
opendj3-server-dev/src/messages/messages/replication.properties 1 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/util/StaticUtils.java 14 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/src/messages/messages/replication.properties
@@ -617,3 +617,4 @@
 replica offline state file '%s' for domain %s
ERR_CHANGELOG_UNABLE_TO_DELETE_REPLICA_OFFLINE_STATE_FILE_281=Could not delete replica \
 offline state file '%s' for domain %s and server id %d
ERR_CHANGELOG_UNABLE_TO_RETRIEVE_FILE_LENGTH_282=Could not retrieve file length of file '%s'
opendj3-server-dev/src/server/org/opends/server/util/StaticUtils.java
@@ -3339,14 +3339,16 @@
   * then any files or subdirectories that it contains will be recursively
   * deleted as well.
   *
   * @param  file  The file or directory to be removed.
   *
   * @return  <CODE>true</CODE> if the specified file and any subordinates are
   *          all successfully removed, or <CODE>false</CODE> if at least one
   *          element in the subtree could not be removed.
   * @param file
   *          The file or directory to be removed.
   * @return {@code true} if the specified file and any subordinates are all
   *         successfully removed, or {@code false} if at least one element in
   *         the subtree could not be removed or file does not exists.
   */
  public static boolean recursiveDelete(File file)
  {
    if (file.exists())
    {
    boolean successful = true;
    if (file.isDirectory())
    {
@@ -3362,6 +3364,8 @@
    return (successful & file.delete());
  }
    return false;
  }