Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ekoontz/605193 to your computer and use it in GitHub Desktop.
Save ekoontz/605193 to your computer and use it in GitHub Desktop.
From fb5ac5b657eee77df539a09d4aa5696ffd19b7c0 Mon Sep 17 00:00:00 2001
From: Eugene Koontz <ekoontz@hiro-tan.org>
Date: Thu, 30 Sep 2010 12:47:34 -0700
Subject: [PATCH] use UGI:getCurrentUser().getUserName(), at creation time, as owner of .META. and -ROOT-
---
.../java/org/apache/hadoop/hbase/HRegionInfo.java | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/src/main/java/org/apache/hadoop/hbase/HRegionInfo.java b/src/main/java/org/apache/hadoop/hbase/HRegionInfo.java
index d95c033..d331f52 100644
--- a/src/main/java/org/apache/hadoop/hbase/HRegionInfo.java
+++ b/src/main/java/org/apache/hadoop/hbase/HRegionInfo.java
@@ -32,6 +32,7 @@ import org.apache.hadoop.hbase.util.JenkinsHash;
import org.apache.hadoop.hbase.util.MD5Hash;
import org.apache.hadoop.io.VersionedWritable;
import org.apache.hadoop.io.WritableComparable;
+import org.apache.hadoop.security.UserGroupInformation;
/**
* HRegion information.
@@ -174,6 +175,22 @@ public class HRegionInfo extends VersionedWritable implements WritableComparable
regionId, false);
this.regionNameStr = Bytes.toStringBinary(this.regionName);
setHashCode();
+
+ if (tableDesc == HTableDescriptor.ROOT_TABLEDESC) {
+ try {
+ tableDesc.setOwnerString(UserGroupInformation.getCurrentUser().getUserName());
+ } catch (IOException ioe) {
+ LOG.debug("UGI.getCurrentUser() failed", ioe);
+ }
+ }
+
+ if (tableDesc == HTableDescriptor.META_TABLEDESC) {
+ try {
+ tableDesc.setOwnerString(UserGroupInformation.getCurrentUser().getUserName());
+ } catch (IOException ioe) {
+ LOG.debug("UGI.getCurrentUser() failed", ioe);
+ }
+ }
}
/** Default constructor - creates empty object */
--
1.7.1+GitX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment