Search in sources :

Example 1 with RollWALWriterResponse

use of org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.RollWALWriterResponse in project hbase by apache.

the class HBaseAdmin method rollHLogWriter.

/**
   * Roll the log writer. I.e. when using a file system based write ahead log,
   * start writing log messages to a new file.
   *
   * Note that when talking to a version 1.0+ HBase deployment, the rolling is asynchronous.
   * This method will return as soon as the roll is requested and the return value will
   * always be null. Additionally, the named region server may schedule store flushes at the
   * request of the wal handling the roll request.
   *
   * When talking to a 0.98 or older HBase deployment, the rolling is synchronous and the
   * return value may be either null or a list of encoded region names.
   *
   * @param serverName
   *          The servername of the regionserver. A server name is made of host,
   *          port and startcode. This is mandatory. Here is an example:
   *          <code> host187.example.com,60020,1289493121758</code>
   * @return a set of {@link HRegionInfo#getEncodedName()} that would allow the wal to
   *         clean up some underlying files. null if there's nothing to flush.
   * @throws IOException if a remote or network exception occurs
   * @throws FailedLogCloseException
   * @deprecated use {@link #rollWALWriter(ServerName)}
   */
@Deprecated
public synchronized byte[][] rollHLogWriter(String serverName) throws IOException, FailedLogCloseException {
    ServerName sn = ServerName.valueOf(serverName);
    final RollWALWriterResponse response = rollWALWriterImpl(sn);
    int regionCount = response.getRegionToFlushCount();
    if (0 == regionCount) {
        return null;
    }
    byte[][] regionsToFlush = new byte[regionCount][];
    for (int i = 0; i < regionCount; i++) {
        regionsToFlush[i] = ProtobufUtil.toBytes(response.getRegionToFlush(i));
    }
    return regionsToFlush;
}
Also used : RollWALWriterResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.RollWALWriterResponse) ServerName(org.apache.hadoop.hbase.ServerName)

Example 2 with RollWALWriterResponse

use of org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.RollWALWriterResponse in project hbase by apache.

the class RSRpcServices method rollWALWriter.

/**
 * Roll the WAL writer of the region server.
 * @param controller the RPC controller
 * @param request the request
 * @throws ServiceException
 */
@Override
public RollWALWriterResponse rollWALWriter(final RpcController controller, final RollWALWriterRequest request) throws ServiceException {
    try {
        checkOpen();
        requestCount.increment();
        server.getRegionServerCoprocessorHost().preRollWALWriterRequest();
        server.getWalRoller().requestRollAll();
        server.getRegionServerCoprocessorHost().postRollWALWriterRequest();
        RollWALWriterResponse.Builder builder = RollWALWriterResponse.newBuilder();
        return builder.build();
    } catch (IOException ie) {
        throw new ServiceException(ie);
    }
}
Also used : RollWALWriterResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.RollWALWriterResponse) ServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) HBaseIOException(org.apache.hadoop.hbase.HBaseIOException) UncheckedIOException(java.io.UncheckedIOException)

Aggregations

RollWALWriterResponse (org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.RollWALWriterResponse)2 IOException (java.io.IOException)1 UncheckedIOException (java.io.UncheckedIOException)1 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)1 HBaseIOException (org.apache.hadoop.hbase.HBaseIOException)1 ServerName (org.apache.hadoop.hbase.ServerName)1 ServiceException (org.apache.hbase.thirdparty.com.google.protobuf.ServiceException)1