This is an automated email from the ASF dual-hosted git repository. dlmarion pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push: new d3c015adb8 Update LogCloser javadoc, add warnings to NoOpLogCloser (#2868) d3c015adb8 is described below commit d3c015adb8a9a0aa43b67792e4a67341098b4df4 Author: Dave Marion <dlmar...@apache.org> AuthorDate: Thu Aug 11 07:04:54 2022 -0400 Update LogCloser javadoc, add warnings to NoOpLogCloser (#2868) --- .../accumulo/server/manager/recovery/LogCloser.java | 20 ++++++++++++++++++++ .../server/manager/recovery/NoOpLogCloser.java | 13 +++++++++++++ 2 files changed, 33 insertions(+) diff --git a/server/base/src/main/java/org/apache/accumulo/server/manager/recovery/LogCloser.java b/server/base/src/main/java/org/apache/accumulo/server/manager/recovery/LogCloser.java index 7bdac8b84c..57390e22b8 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/manager/recovery/LogCloser.java +++ b/server/base/src/main/java/org/apache/accumulo/server/manager/recovery/LogCloser.java @@ -25,7 +25,27 @@ import org.apache.accumulo.server.fs.VolumeManager; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; +/** + * Object that is used by the RecoveryManager to properly close WALogs that were being written to + * and were not properly closed (TabletServer died, for example). + */ public interface LogCloser { + + /** + * Attempts to properly close a WALog + * + * @param conf + * AccumuloConfiguration + * @param hadoopConf + * Hadoop configuration + * @param fs + * VolumeManager + * @param path + * WALog file path + * @return amount of time to wait before retrying, 0 if succeeded + * @throws IOException + * exception closing walog + */ long close(AccumuloConfiguration conf, Configuration hadoopConf, VolumeManager fs, Path path) throws IOException; } diff --git a/server/base/src/main/java/org/apache/accumulo/server/manager/recovery/NoOpLogCloser.java b/server/base/src/main/java/org/apache/accumulo/server/manager/recovery/NoOpLogCloser.java index e60c847c1d..d566590002 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/manager/recovery/NoOpLogCloser.java +++ b/server/base/src/main/java/org/apache/accumulo/server/manager/recovery/NoOpLogCloser.java @@ -25,6 +25,8 @@ import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.server.fs.VolumeManager; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * {@link HadoopLogCloser} recovers leases in DistributedFileSystem implementations and does nothing @@ -33,11 +35,22 @@ import org.apache.hadoop.fs.Path; * implementations that do not support lease recovery and we should not throw an exception in this * case. This LogCloser implementation supports that case. * + * WARNING: USE AT YOUR OWN RISK! When using this class as the LogCloser, it's possible that WALog + * recovery will not work if the file system implementation needs some type of recovery to occur for + * files that were being written to, but not properly closed. + * * To use this class, set the Property {@link Property#MANAGER_WAL_CLOSER_IMPLEMENTATION} to the * full name of this class. */ public class NoOpLogCloser implements LogCloser { + private static final Logger LOG = LoggerFactory.getLogger(NoOpLogCloser.class); + + public NoOpLogCloser() { + LOG.warn("This log closer makes no attempt at recovering write ahead logs so that they can be " + + "properly closed. WALog recovery is not guaranteed to work when using this class."); + } + @Override public long close(AccumuloConfiguration conf, Configuration hadoopConf, VolumeManager fs, Path path) throws IOException {