1 /* 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 */ 19 package org.apache.hadoop.hbase.regionserver.wal; 20 21 import java.io.IOException; 22 23 import org.apache.hadoop.hbase.classification.InterfaceAudience; 24 import org.apache.hadoop.fs.Path; 25 import org.apache.hadoop.hbase.HRegionInfo; 26 import org.apache.hadoop.hbase.HTableDescriptor; 27 28 /** 29 * Get notification of {@link FSHLog}/WAL log events. The invocations are inline 30 * so make sure your implementation is fast else you'll slow hbase. 31 */ 32 @InterfaceAudience.Private 33 public interface WALActionsListener { 34 35 /** 36 * The WAL is going to be rolled. The oldPath can be null if this is 37 * the first log file from the regionserver. 38 * @param oldPath the path to the old hlog 39 * @param newPath the path to the new hlog 40 */ 41 void preLogRoll(Path oldPath, Path newPath) throws IOException; 42 43 /** 44 * The WAL has been rolled. The oldPath can be null if this is 45 * the first log file from the regionserver. 46 * @param oldPath the path to the old hlog 47 * @param newPath the path to the new hlog 48 */ 49 void postLogRoll(Path oldPath, Path newPath) throws IOException; 50 51 /** 52 * The WAL is going to be archived. 53 * @param oldPath the path to the old hlog 54 * @param newPath the path to the new hlog 55 */ 56 void preLogArchive(Path oldPath, Path newPath) throws IOException; 57 58 /** 59 * The WAL has been archived. 60 * @param oldPath the path to the old hlog 61 * @param newPath the path to the new hlog 62 */ 63 void postLogArchive(Path oldPath, Path newPath) throws IOException; 64 65 /** 66 * A request was made that the WAL be rolled. 67 * @param tooFewReplicas roll requested because of too few replicas if true 68 */ 69 void logRollRequested(boolean tooFewReplicas); 70 71 /** 72 * The WAL is about to close. 73 */ 74 void logCloseRequested(); 75 76 /** 77 * Called before each write. 78 * @param info 79 * @param logKey 80 * @param logEdit 81 */ 82 void visitLogEntryBeforeWrite( 83 HRegionInfo info, HLogKey logKey, WALEdit logEdit 84 ); 85 86 /** 87 * 88 * @param htd 89 * @param logKey 90 * @param logEdit 91 */ 92 void visitLogEntryBeforeWrite( 93 HTableDescriptor htd, HLogKey logKey, WALEdit logEdit 94 ); 95 }