Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package org.apache.hadoop.hbase.backup.example;
 
 
Example class for how to use the table archiving coordinated via zookeeper
 
 public class ZKTableArchiveClient extends Configured {

  
Configuration key for the archive node.
 
   private static final String ZOOKEEPER_ZNODE_HFILE_ARCHIVE_KEY = "zookeeper.znode.hfile.archive";
   private HConnection connection;
 
   public ZKTableArchiveClient(Configuration confHConnection connection) {
     super(conf);
     this. = connection;
   }

  
Turn on backups for all HFiles for the given table.

All deleted hfiles are moved to the archive directory under the table directory, rather than being deleted.

If backups are already enabled for this table, does nothing.

If the table does not exist, the archiving the table's hfiles is still enabled as a future table with that name may be created shortly.

Parameters:
table name of the table to start backing up
Throws:
java.io.IOException if an unexpected exception occurs
org.apache.zookeeper.KeeperException if zookeeper can't be reached
 
   public void enableHFileBackupAsync(final byte[] tablethrows IOExceptionKeeperException {
   }

  
Disable hfile backups for the given table.

Previously backed up files are still retained (if present).

Asynchronous operation - some extra HFiles may be retained, in the archive directory after disable is called, dependent on the latency in zookeeper to the servers.

Parameters:
table name of the table stop backing up
Throws:
java.io.IOException if an unexpected exception occurs
org.apache.zookeeper.KeeperException if zookeeper can't be reached
 
   public void disableHFileBackup(String tablethrows IOExceptionKeeperException {
     disableHFileBackup(Bytes.toBytes(table));
   }

  
Disable hfile backups for the given table.

Previously backed up files are still retained (if present).

Asynchronous operation - some extra HFiles may be retained, in the archive directory after disable is called, dependent on the latency in zookeeper to the servers.

Parameters:
table name of the table stop backing up
Throws:
java.io.IOException if an unexpected exception occurs
org.apache.zookeeper.KeeperException if zookeeper can't be reached
 
   public void disableHFileBackup(final byte[] tablethrows IOExceptionKeeperException {
   }

  
Disable hfile backups for all tables.

Previously backed up files are still retained (if present).

Asynchronous operation - some extra HFiles may be retained, in the archive directory after disable is called, dependent on the latency in zookeeper to the servers.

Throws:
java.io.IOException if an unexpected exception occurs
org.apache.zookeeper.KeeperException if zookeeper can't be reached
  public void disableHFileBackup() throws IOExceptionKeeperException {
  }

  
Determine if archiving is enabled (but not necessarily fully propagated) for a table

Parameters:
table name of the table to check
Returns:
true if it is, false otherwise
Throws:
java.io.IOException if a connection to ZooKeeper cannot be established
org.apache.zookeeper.KeeperException
  public boolean getArchivingEnabled(byte[] tablethrows IOExceptionKeeperException {
    try {
      return manager.isArchivingEnabled(table);
    } finally {
      manager.stop();
    }
  }

  
Determine if archiving is enabled (but not necessarily fully propagated) for a table

Parameters:
table name of the table to check
Returns:
true if it is, false otherwise
Throws:
java.io.IOException if an unexpected network issue occurs
org.apache.zookeeper.KeeperException if zookeeper can't be reached
  public boolean getArchivingEnabled(String tablethrows IOExceptionKeeperException {
    return getArchivingEnabled(Bytes.toBytes(table));
  }

  

Returns:
A new HFileArchiveManager to manage which tables' hfiles should be archived rather than deleted.
Throws:
org.apache.zookeeper.KeeperException if we can't reach zookeeper
java.io.IOException if an unexpected network issue occurs
  private synchronized HFileArchiveManager createHFileArchiveManager() throws KeeperException,
      IOException {
    return new HFileArchiveManager(this.this.getConf());
  }

  

Parameters:
conf conf to read for the base archive node
zooKeeper zookeeper to used for building the full path
Returns:
get the znode for long-term archival of a table for
  public static String getArchiveZNode(Configuration confZooKeeperWatcher zooKeeper) {
    return ZKUtil.joinZNode(zooKeeper.baseZNodeconf.get(,
  }
New to GrepCode? Check out our FAQ X