| | |
| | | file and actual domain directories found in file system. Expected domain ids : '%s'. \ |
| | | Actual domain ids found in file system: '%s' |
| | | ERR_CHANGELOG_UNABLE_TO_UPDATE_DOMAIN_STATE_FILE_265=Could not create a new domain \ |
| | | id %s for domain DN %s and save it in domain state file '%s" |
| | | id %s for domain DN %s and save it in domain state file '%s" |
| | | ERR_CHANGELOG_UNABLE_TO_GET_CURSOR_READER_POSITION_LOG_FILE_266=Could not get reader \ |
| | | position for cursor in log file '%s' |
| | | ERR_CHANGELOG_UNABLE_TO_DECODE_KEY_FROM_STRING_267=Could not decode the key from \ |
| | | string [%s] |
| | | ERR_CHANGELOG_CURSOR_OPENED_WHILE_CLEANING_LOG_268=When cleaning log '%s', \ |
| | | found %d cursor(s) still opened on the log |
| | | ERR_CHANGELOG_CURSOR_OPENED_WHILE_CLOSING_LOG_269=When closing log '%s', \ |
| | | found %d cursor(s) still opened on the log |
| | | ERR_CHANGELOG_UNABLE_TO_INITIALIZE_LOG_270=Could not initialize \ |
| | | the log '%s' |
| | | ERR_CHANGELOG_UNABLE_TO_RETRIEVE_KEY_BOUNDS_FROM_FILE_271=Could not \ |
| | | retrieve key bounds from log file '%s' |
| | | ERR_CHANGELOG_UNABLE_TO_RETRIEVE_READ_ONLY_LOG_FILES_LIST_272=Could not \ |
| | | retrieve read-only log files from log '%s' |
| | | ERR_CHANGELOG_UNABLE_TO_DELETE_LOG_FILE_WHILE_PURGING_273=While purging log, could not \ |
| | | delete log file(s): '%s' |
| | | ERR_CHANGELOG_UNREFERENCED_LOG_WHILE_RELEASING_274 =The following log \ |
| | | '%s' must be released but it is not referenced." |
| | | ERR_CHANGELOG_UNABLE_TO_RENAME_HEAD_LOG_FILE_275=Could not rename \ |
| | | head log file from '%s' to '%s' |
| | | INFO_CHANGELOG_LOG_FILE_ROTATION_276=Rotation needed for log file '%s', \ |
| | | size of head log file is %d bytes |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean rotateFile(MultifileTextWriter writer) |
| | | public boolean rotateFile(RotatableLogFile writer) |
| | | { |
| | | Calendar lastRotationTime = writer.getLastRotationTime(); |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.loggers; |
| | | |
| | |
| | | * (a) forwards all its output to a target stream |
| | | * (b) keeps track of how many bytes have been written. |
| | | */ |
| | | class MeteredStream extends OutputStream |
| | | public final class MeteredStream extends OutputStream |
| | | { |
| | | OutputStream out; |
| | | long written; |
| | |
| | | * @param out The target output stream to keep track of. |
| | | * @param written The number of bytes written to the stream. |
| | | */ |
| | | MeteredStream(OutputStream out, long written) |
| | | public MeteredStream(OutputStream out, long written) |
| | | { |
| | | this.out = out; |
| | | this.written = written; |
| | |
| | | { |
| | | out.close(); |
| | | } |
| | | |
| | | /** |
| | | * Returns the number of bytes written in this stream. |
| | | * |
| | | * @return the number of bytes |
| | | */ |
| | | public long getBytesWritten() |
| | | { |
| | | return written; |
| | | } |
| | | } |
| | | |
| | |
| | | * new one named in accordance with a specified FileNamingPolicy. |
| | | */ |
| | | class MultifileTextWriter |
| | | implements ServerShutdownListener, TextWriter, |
| | | implements ServerShutdownListener, TextWriter, RotatableLogFile, |
| | | ConfigurationChangeListener<SizeLimitLogRotationPolicyCfg> |
| | | { |
| | | |
| | |
| | | this.actions = actions; |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the number of bytes written to the current log file. |
| | | * |
| | | * @return The number of bytes written to the current log file. |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long getBytesWritten() |
| | | { |
| | | return outputStream.written; |
| | |
| | | return lastCleanCount; |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the last time a log file was rotated in this instance of |
| | | * Directory Server. If a log rotation never |
| | | * occurred, this value will be the time the server started. |
| | | * |
| | | * @return The last time log rotation occurred. |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Calendar getLastRotationTime() |
| | | { |
| | | return lastRotationTime; |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt |
| | | * or http://forgerock.org/license/CDDLv1.0.html. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at legal-notices/CDDLv1_0.txt. |
| | | * If applicable, add the following below this CDDL HEADER, with the |
| | | * fields enclosed by brackets "[]" replaced with your own identifying |
| | | * information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.loggers; |
| | | |
| | | import java.util.Calendar; |
| | | |
| | | /** |
| | | * Represents a file that can be rotated based on size or on time. |
| | | */ |
| | | public interface RotatableLogFile |
| | | { |
| | | |
| | | /** |
| | | * Retrieves the number of bytes written to the file. |
| | | * |
| | | * @return The number of bytes written to the file. |
| | | */ |
| | | long getBytesWritten(); |
| | | |
| | | /** |
| | | * Retrieves the last time the file was rotated. If a file rotation never |
| | | * occurred, this value will be the time the server started. |
| | | * |
| | | * @return The last time file rotation occurred. |
| | | */ |
| | | Calendar getLastRotationTime(); |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * This method indicates if the log file should be |
| | | * rotated or not. |
| | | * This method indicates if the log file should be rotated or not. |
| | | * |
| | | * @param writer The multi file writer writing the file to be |
| | | * checked. |
| | | * @param writer |
| | | * the file writer to be checked. |
| | | * @return true if the log file should be rotated, false otherwise. |
| | | */ |
| | | public boolean rotateFile(MultifileTextWriter writer); |
| | | public boolean rotateFile(RotatableLogFile writer); |
| | | |
| | | |
| | | } |
| | |
| | | * @param writer The multi file text writer writing the log file. |
| | | * @return true if the file needs to be rotated, false otherwise. |
| | | */ |
| | | public boolean rotateFile(MultifileTextWriter writer) |
| | | public boolean rotateFile(RotatableLogFile writer) |
| | | { |
| | | long fileSize = writer.getBytesWritten(); |
| | | |
| | |
| | | * @param writer The mutli file text writer written the log file. |
| | | * @return true if the file should be rotated, false otherwise. |
| | | */ |
| | | public boolean rotateFile(MultifileTextWriter writer) |
| | | public boolean rotateFile(RotatableLogFile writer) |
| | | { |
| | | long currInterval = TimeThread.getTime() - |
| | | writer.getLastRotationTime().getTimeInMillis(); |
| | |
| | | */ |
| | | public static final int STRING_ENCODING_LENGTH = 28; |
| | | |
| | | /** The maximum possible value for a CSN. */ |
| | | public static final CSN MAX_CSN_VALUE = new CSN(Long.MAX_VALUE, Integer.MAX_VALUE, Short.MAX_VALUE); |
| | | |
| | | private static final long serialVersionUID = -8802722277749190740L; |
| | | private final long timeStamp; |
| | | /** |
| | |
| | | return new File(testResourceDir, filename); |
| | | } |
| | | |
| | | public static File getUnitTestRootPath() |
| | | { |
| | | final String buildRoot = System.getProperty(PROPERTY_BUILD_ROOT); |
| | | final String path = System.getProperty(PROPERTY_BUILD_DIR, buildRoot + File.separator + "build"); |
| | | return new File(path, "unit-tests"); |
| | | } |
| | | |
| | | /** |
| | | * Prevent instantiation. |
| | | */ |
| | |
| | | + "cn: Replication Server\n" |
| | | + "ds-cfg-replication-port: " + replServerPort + "\n" |
| | | + "ds-cfg-replication-db-directory: ChangeNumberControlDbTest\n" |
| | | + "ds-cfg-replication-db-implementation: " + replicationDbImplementation + "\n" |
| | | + "ds-cfg-replication-server-id: 103\n"; |
| | | |
| | | // suffix synchronized |
| | |
| | | + "cn: Replication Server\n" |
| | | + "ds-cfg-replication-port:" + replServerPort + "\n" |
| | | + "ds-cfg-replication-db-directory: ReSyncTest\n" |
| | | + "ds-cfg-replication-db-implementation: " + replicationDbImplementation + "\n" |
| | | + "ds-cfg-replication-server-id: 104\n"; |
| | | |
| | | // suffix synchronized |
| | |
| | | + "cn: replication Server\n" |
| | | + "ds-cfg-replication-port: " + replServerPort + "\n" |
| | | + "ds-cfg-replication-db-directory: HistoricalTest\n" |
| | | + "ds-cfg-replication-db-implementation: " + replicationDbImplementation + "\n" |
| | | + "ds-cfg-replication-server-id: 102\n"; |
| | | |
| | | // The suffix to be synchronized. |