/** * Roll the log writer. That is, start writing log messages to a new file. * * @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 If lots of logs, flush the returned regions so next time through * we can clean logs. Returns null if nothing to flush. Names are actual * region names as returned by {@link HRegionInfo#getEncodedName()} * @throws IOException if a remote or network exception occurs * @throws FailedLogCloseException */ public synchronized byte[][] rollHLogWriter(String serverName) throws IOException, FailedLogCloseException { ServerName sn = ServerName.valueOf(serverName); AdminService.BlockingInterface admin = this.connection.getAdmin(sn); RollWALWriterRequest request = RequestConverter.buildRollWALWriterRequest(); try { RollWALWriterResponse response = admin.rollWALWriter(null, request); int regionCount = response.getRegionToFlushCount(); byte[][] regionsToFlush = new byte[regionCount][]; for (int i = 0; i < regionCount; i++) { ByteString region = response.getRegionToFlush(i); regionsToFlush[i] = region.toByteArray(); } return regionsToFlush; } catch (ServiceException se) { throw ProtobufUtil.getRemoteException(se); } }
/** * Roll the log writer. That is, start writing log messages to a new file. * * @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 If lots of logs, flush the returned regions so next time through * we can clean logs. Returns null if nothing to flush. Names are actual * region names as returned by {@link HRegionInfo#getEncodedName()} * @throws IOException if a remote or network exception occurs * @throws FailedLogCloseException */ public synchronized byte[][] rollHLogWriter(String serverName) throws IOException, FailedLogCloseException { ServerName sn = new ServerName(serverName); AdminProtocol admin = this.connection.getAdmin( sn.getHostname(), sn.getPort()); RollWALWriterRequest request = RequestConverter.buildRollWALWriterRequest();; try { RollWALWriterResponse response = admin.rollWALWriter(null, request); int regionCount = response.getRegionToFlushCount(); byte[][] regionsToFlush = new byte[regionCount][]; for (int i = 0; i < regionCount; i++) { ByteString region = response.getRegionToFlush(i); regionsToFlush[i] = region.toByteArray(); } return regionsToFlush; } catch (ServiceException se) { throw ProtobufUtil.getRemoteException(se); } }
private RollWALWriterResponse rollWALWriterImpl(final ServerName sn) throws IOException, FailedLogCloseException { AdminService.BlockingInterface admin = this.connection.getAdmin(sn); RollWALWriterRequest request = RequestConverter.buildRollWALWriterRequest(); PayloadCarryingRpcController controller = rpcControllerFactory.newController(); try { // TODO: this does not do retries, it should. Set priority and timeout in controller return admin.rollWALWriter(controller, request); } catch (ServiceException se) { throw ProtobufUtil.getRemoteException(se); } }
@Before public void setup() throws FailedLogCloseException, IOException { ReplicationEndpointForTest.contructedCount.set(0); ReplicationEndpointForTest.startedCount.set(0); ReplicationEndpointForTest.replicateCount.set(0); ReplicationEndpointReturningFalse.replicated.set(false); ReplicationEndpointForTest.lastEntries = null; for (RegionServerThread rs : utility1.getMiniHBaseCluster().getRegionServerThreads()) { utility1.getHBaseAdmin().rollWALWriter(rs.getRegionServer().getServerName()); } }
private RollWALWriterResponse rollWALWriterImpl(final ServerName sn) throws IOException, FailedLogCloseException { AdminService.BlockingInterface admin = this.connection.getAdmin(sn); RollWALWriterRequest request = RequestConverter.buildRollWALWriterRequest(); try { return admin.rollWALWriter(null, request); } catch (ServiceException se) { throw ProtobufUtil.getRemoteException(se); } }
private RollWALWriterResponse rollWALWriterImpl(final ServerName sn) throws IOException, FailedLogCloseException { final AdminService.BlockingInterface admin = this.connection.getAdmin(sn); RollWALWriterRequest request = RequestConverter.buildRollWALWriterRequest(); // TODO: There is no timeout on this controller. Set one! HBaseRpcController controller = rpcControllerFactory.newController(); try { return admin.rollWALWriter(controller, request); } catch (ServiceException e) { throw ProtobufUtil.handleRemoteException(e); } }
/** * 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++) { ByteString region = response.getRegionToFlush(i); regionsToFlush[i] = region.toByteArray(); } return regionsToFlush; }
@Override public synchronized void rollWALWriter(ServerName serverName) throws IOException, FailedLogCloseException { rollWALWriterImpl(serverName); }
@Override public void rollWALWriter(ServerName sn) throws IOException, FailedLogCloseException { wrappedHbaseAdmin.rollWALWriter(sn); }
@Override public byte[][] rollHLogWriter() throws IOException, FailedLogCloseException { HLog wal = this.getWAL(); return wal.rollWriter(true); }
@Override public void rollWALWriter(ServerName serverName) throws IOException, FailedLogCloseException { throw new UnsupportedOperationException("rollWALWriter"); // TODO }
public byte[][] rollHLogWriter(String serverName) throws IOException, FailedLogCloseException { return delegate.rollHLogWriter(serverName); }
/** * 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; }
/** * Unsupported. */ public synchronized byte[][] rollHLogWriter(String serverName) throws IOException, FailedLogCloseException { throw new UnsupportedOperationException(); }
/** * Roll the log writer. That is, start writing log messages to a new file. * @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 If lots of logs, flush the returned regions so next time through we can clean logs. * Returns null if nothing to flush. Names are actual region names as returned by * {@link HRegionInfo#getEncodedName()} * @throws IOException if a remote or network exception occurs * @throws FailedLogCloseException */ public synchronized byte[][] rollHLogWriter(String serverName) throws IOException, FailedLogCloseException { ServerName sn = new ServerName(serverName); HRegionInterface rs = this.connection.getHRegionConnection(sn.getHostname(), sn.getPort()); return rs.rollHLogWriter(); }
/** * Roll the log writer. That is, start writing log messages to a new file. * * @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 If lots of logs, flush the returned regions so next time through * we can clean logs. Returns null if nothing to flush. Names are actual * region names as returned by {@link HRegionInfo#getEncodedName()} * @throws IOException if a remote or network exception occurs * @throws FailedLogCloseException */ public synchronized byte[][] rollHLogWriter(String serverName) throws IOException, FailedLogCloseException { ServerName sn = new ServerName(serverName); HRegionInterface rs = this.connection.getHRegionConnection( sn.getHostname(), sn.getPort()); return rs.rollHLogWriter(); }
/** * Roll the log writer. That is, start writing log messages to a new file. * * <p> * The implementation is synchronized in order to make sure there's one rollWriter * running at any given time. * * @return If lots of logs, flush the returned regions so next time through we * can clean logs. Returns null if nothing to flush. Names are actual * region names as returned by {@link HRegionInfo#getEncodedName()} */ byte[][] rollWriter() throws FailedLogCloseException, IOException;
/** * Roll the log writer. That is, start writing log messages to a new file. * * <p> * The implementation is synchronized in order to make sure there's one rollWriter * running at any given time. * * @param force * If true, force creation of a new writer even if no entries have * been written to the current writer * @return If lots of logs, flush the returned regions so next time through we * can clean logs. Returns null if nothing to flush. Names are actual * region names as returned by {@link HRegionInfo#getEncodedName()} */ byte[][] rollWriter(boolean force) throws FailedLogCloseException, IOException;
/** * Roll the log writer. I.e. for filesystem based write ahead logs, start writing to a new file. * * Note that the actual rolling of the log writer is asynchronous and may not be complete when * this method returns. As a side effect of this call, the named region server may schedule * store flushes at the request of the wal. * * @param serverName The servername of the regionserver. * @throws IOException if a remote or network exception occurs * @throws org.apache.hadoop.hbase.regionserver.wal.FailedLogCloseException */ void rollWALWriter(ServerName serverName) throws IOException, FailedLogCloseException;
/** * Roll the log writer. That is, start writing log messages to a new file. * * @throws IOException * @throws FailedLogCloseException * @return If lots of logs, flush the returned regions so next time through * we can clean logs. Returns null if nothing to flush. Names are actual * region names as returned by {@link HRegionInfo#getEncodedName()} */ public byte[][] rollHLogWriter() throws IOException, FailedLogCloseException;