Repository: atlas
Updated Branches:
  refs/heads/branch-0.8 842943709 -> 9640a7c64


ATLAS-2445: updated HBase hook to handle table-clone and snapshot-restore 
operations

Signed-off-by: Madhan Neethiraj <mad...@apache.org>
(cherry picked from commit 4119f431ebb7c948fbe6ea031338d918acb30919)


Project: http://git-wip-us.apache.org/repos/asf/atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/9640a7c6
Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/9640a7c6
Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/9640a7c6

Branch: refs/heads/branch-0.8
Commit: 9640a7c64124d73930658eab24aa2f4251f7a818
Parents: 8429437
Author: rmani <rm...@hortonworks.com>
Authored: Wed Feb 14 11:28:04 2018 -0800
Committer: Madhan Neethiraj <mad...@apache.org>
Committed: Wed Feb 14 12:19:17 2018 -0800

----------------------------------------------------------------------
 .../atlas/hbase/hook/HBaseAtlasCoprocessor.java | 25 ++++++++++++++++++++
 1 file changed, 25 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/9640a7c6/addons/hbase-bridge/src/main/java/org/apache/atlas/hbase/hook/HBaseAtlasCoprocessor.java
----------------------------------------------------------------------
diff --git 
a/addons/hbase-bridge/src/main/java/org/apache/atlas/hbase/hook/HBaseAtlasCoprocessor.java
 
b/addons/hbase-bridge/src/main/java/org/apache/atlas/hbase/hook/HBaseAtlasCoprocessor.java
index 8beccd2..af8afd4 100644
--- 
a/addons/hbase-bridge/src/main/java/org/apache/atlas/hbase/hook/HBaseAtlasCoprocessor.java
+++ 
b/addons/hbase-bridge/src/main/java/org/apache/atlas/hbase/hook/HBaseAtlasCoprocessor.java
@@ -27,6 +27,7 @@ import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.NamespaceDescriptor;
 import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
 import org.apache.hadoop.hbase.coprocessor.ObserverContext;
+import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -149,6 +150,30 @@ public class HBaseAtlasCoprocessor extends 
HBaseAtlasCoprocessorBase {
             LOG.debug("<== HBaseAtlasCoprocessor.postModifyNamespace()");
         }
     }
+
+    @Override
+    public void 
postCloneSnapshot(ObserverContext<MasterCoprocessorEnvironment> 
observerContext, HBaseProtos.SnapshotDescription snapshotDescription, 
HTableDescriptor hTableDescriptor) throws IOException {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("==> HBaseAtlasCoprocessoror.postCloneSnapshot()");
+        }
+        hbaseAtlasHook.sendHBaseTableOperation(hTableDescriptor, null, 
HBaseAtlasHook.OPERATION.CREATE_TABLE);
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("<== HBaseAtlasCoprocessoror.postCloneSnapshot()");
+        }
+
+    }
+
+    @Override
+    public void 
postRestoreSnapshot(ObserverContext<MasterCoprocessorEnvironment> 
observerContext, HBaseProtos.SnapshotDescription snapshotDescription, 
HTableDescriptor hTableDescriptor) throws IOException {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("==> HBaseAtlasCoprocessor.postRestoreSnapshot()");
+        }
+        hbaseAtlasHook.sendHBaseTableOperation(hTableDescriptor, 
hTableDescriptor.getTableName(), HBaseAtlasHook.OPERATION.ALTER_TABLE);
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("<== HBaseAtlasCoprocessor.postRestoreSnapshot()");
+        }
+    }
+
 }
 
 

Reply via email to