org.apache.hadoop.hbase.client.Admin.modifyNamespace()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中org.apache.hadoop.hbase.client.Admin.modifyNamespace()方法的一些代码示例,展示了Admin.modifyNamespace()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Admin.modifyNamespace()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Admin
类名称:Admin
方法名:modifyNamespace

Admin.modifyNamespace介绍

[英]Modify an existing namespace
[中]修改现有名称空间

代码示例

代码示例来源:origin: apache/hbase

@Override
public void modifyNamespace(TNamespaceDescriptor namespaceDesc) throws TIOError, TException {
 try {
  NamespaceDescriptor descriptor = namespaceDescriptorFromThrift(namespaceDesc);
  connectionCache.getAdmin().modifyNamespace(descriptor);
 } catch (IOException e) {
  throw getTIOError(e);
 }
}

代码示例来源:origin: apache/hbase

@Override
 public Void call() throws Exception {
  admin.modifyNamespace(NamespaceDescriptor.create("non_existing_namespace").build());
  return null;
 }
}, NamespaceNotFoundException.class);

代码示例来源:origin: apache/hbase

private Response createOrUpdate(final NamespacesInstanceModel model, final UriInfo uriInfo,
  final Admin admin, final boolean updateExisting) {
 NamespaceDescriptor.Builder builder = NamespaceDescriptor.create(namespace);
 builder.addConfiguration(model.getProperties());
 if(model.getProperties().size() > 0){
  builder.addConfiguration(model.getProperties());
 }
 NamespaceDescriptor nsd = builder.build();
 try{
  if(updateExisting){
   admin.modifyNamespace(nsd);
  }else{
   admin.createNamespace(nsd);
  }
 }catch (IOException e) {
  servlet.getMetrics().incrementFailedPutRequests(1);
  return processException(e);
 }
 servlet.getMetrics().incrementSucessfulPutRequests(1);
 return Response.created(uriInfo.getAbsolutePath()).build();
}

代码示例来源:origin: apache/hbase

} while (selected.getConfigurationValue(nsTestConfigKey).equals(nsValueNew));
modifiedNsd.setConfiguration(nsTestConfigKey, nsValueNew);
admin.modifyNamespace(modifiedNsd);
NamespaceDescriptor freshNamespaceDesc = admin.getNamespaceDescriptor(namespaceName);
Assert.assertTrue(

代码示例来源:origin: apache/hbase

@Test
public void testPostModifyNamespace() throws IOException {
 final Admin admin = UTIL.getAdmin();
 final String ns = "postmodifyns";
 NamespaceDescriptor nsDesc = NamespaceDescriptor.create(ns).build();
 admin.createNamespace(nsDesc);
 HMaster master = UTIL.getMiniHBaseCluster().getMaster();
 MasterObserverForTest observer = master.getMasterCoprocessorHost().findCoprocessor(
   MasterObserverForTest.class);
 int preCount = observer.postHookCalls.get();
 try {
  admin.modifyNamespace(NamespaceDescriptor.create("nonexistent").build());
  fail("Modifying a missing namespace should fail");
 } catch (IOException e) {
  // Pass
 }
 int postCount = observer.postHookCalls.get();
 assertEquals("Expected no invocations of postModifyNamespace when the operation fails",
   preCount, postCount);
 // Validate that the postDeletNS hook is invoked
 preCount = observer.postHookCalls.get();
 admin.modifyNamespace(
   NamespaceDescriptor.create(nsDesc).addConfiguration("foo", "bar").build());
 postCount = observer.postHookCalls.get();
 assertEquals("Expected 1 invocation of postModifyNamespace", preCount + 1, postCount);
}

代码示例来源:origin: apache/hbase

@Test
public void testDefaultNamespaceCreateAndAssign() throws Exception {
 LOG.info("testDefaultNamespaceCreateAndAssign");
 String tableName = tablePrefix + "_testCreateAndAssign";
 admin.modifyNamespace(NamespaceDescriptor.create("default")
  .addConfiguration(RSGroupInfo.NAMESPACE_DESC_PROP_GROUP, "default").build());
 final TableDescriptor desc = TableDescriptorBuilder.newBuilder(TableName.valueOf(tableName))
  .setColumnFamily(ColumnFamilyDescriptorBuilder.of("f")).build();
 admin.createTable(desc);
 // wait for created table to be assigned
 TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() {
  @Override
  public boolean evaluate() throws Exception {
   return getTableRegionMap().get(desc.getTableName()) != null;
  }
 });
}

代码示例来源:origin: apache/hbase

ADMIN.createTable(tableDescOne);
ndesc.setConfiguration(TableNamespaceManager.KEY_MAX_REGIONS, "3");
ADMIN.modifyNamespace(ndesc);

代码示例来源:origin: apache/hbase

admin.modifyNamespace(ns1);

代码示例来源:origin: apache/hbase

admin.modifyNamespace(NamespaceDescriptor.create(nsName)
 .addConfiguration(RSGroupInfo.NAMESPACE_DESC_PROP_GROUP, groupName).build());
String anotherGroup = tablePrefix + "_anotherGroup";

代码示例来源:origin: larsgeorge/hbase-book

.addConfiguration("Description", "Test Namespace")
  .build();
admin.modifyNamespace(namespace3);

代码示例来源:origin: apache/hbase

admin.modifyNamespace(namespaceDescriptor);

代码示例来源:origin: org.apache.hbase/hbase-rsgroup

@Test
public void testDefaultNamespaceCreateAndAssign() throws Exception {
 LOG.info("testDefaultNamespaceCreateAndAssign");
 String tableName = tablePrefix + "_testCreateAndAssign";
 admin.modifyNamespace(NamespaceDescriptor.create("default")
   .addConfiguration(RSGroupInfo.NAMESPACE_DESC_PROP_GROUP, "default").build());
 final HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(tableName));
 desc.addFamily(new HColumnDescriptor("f"));
 admin.createTable(desc);
 //wait for created table to be assigned
 TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() {
  @Override
  public boolean evaluate() throws Exception {
   return getTableRegionMap().get(desc.getTableName()) != null;
  }
 });
}

代码示例来源:origin: com.aliyun.hbase/alihbase-rest

private Response createOrUpdate(final NamespacesInstanceModel model, final UriInfo uriInfo,
  final Admin admin, final boolean updateExisting) {
 NamespaceDescriptor.Builder builder = NamespaceDescriptor.create(namespace);
 builder.addConfiguration(model.getProperties());
 if(model.getProperties().size() > 0){
  builder.addConfiguration(model.getProperties());
 }
 NamespaceDescriptor nsd = builder.build();
 try{
  if(updateExisting){
   admin.modifyNamespace(nsd);
  }else{
   admin.createNamespace(nsd);
  }
 }catch (IOException e) {
  servlet.getMetrics().incrementFailedPutRequests(1);
  return processException(e);
 }
 servlet.getMetrics().incrementSucessfulPutRequests(1);
 return Response.created(uriInfo.getAbsolutePath()).build();
}

代码示例来源:origin: org.apache.hbase/hbase-rest

private Response createOrUpdate(final NamespacesInstanceModel model, final UriInfo uriInfo,
  final Admin admin, final boolean updateExisting) {
 NamespaceDescriptor.Builder builder = NamespaceDescriptor.create(namespace);
 builder.addConfiguration(model.getProperties());
 if(model.getProperties().size() > 0){
  builder.addConfiguration(model.getProperties());
 }
 NamespaceDescriptor nsd = builder.build();
 try{
  if(updateExisting){
   admin.modifyNamespace(nsd);
  }else{
   admin.createNamespace(nsd);
  }
 }catch (IOException e) {
  servlet.getMetrics().incrementFailedPutRequests(1);
  return processException(e);
 }
 servlet.getMetrics().incrementSucessfulPutRequests(1);
 return Response.created(uriInfo.getAbsolutePath()).build();
}

代码示例来源:origin: org.apache.hbase/hbase-it

} while (selected.getConfigurationValue(nsTestConfigKey).equals(nsValueNew));
modifiedNsd.setConfiguration(nsTestConfigKey, nsValueNew);
admin.modifyNamespace(modifiedNsd);
NamespaceDescriptor freshNamespaceDesc = admin.getNamespaceDescriptor(namespaceName);
Assert.assertTrue(

代码示例来源:origin: org.apache.hbase/hbase-server

@Test
public void testPostModifyNamespace() throws IOException {
 final Admin admin = UTIL.getAdmin();
 final String ns = "postmodifyns";
 NamespaceDescriptor nsDesc = NamespaceDescriptor.create(ns).build();
 admin.createNamespace(nsDesc);
 HMaster master = UTIL.getMiniHBaseCluster().getMaster();
 MasterObserverForTest observer = master.getMasterCoprocessorHost().findCoprocessor(
   MasterObserverForTest.class);
 int preCount = observer.postHookCalls.get();
 try {
  admin.modifyNamespace(NamespaceDescriptor.create("nonexistent").build());
  fail("Modifying a missing namespace should fail");
 } catch (IOException e) {
  // Pass
 }
 int postCount = observer.postHookCalls.get();
 assertEquals("Expected no invocations of postModifyNamespace when the operation fails",
   preCount, postCount);
 // Validate that the postDeletNS hook is invoked
 preCount = observer.postHookCalls.get();
 admin.modifyNamespace(
   NamespaceDescriptor.create(nsDesc).addConfiguration("foo", "bar").build());
 postCount = observer.postHookCalls.get();
 assertEquals("Expected 1 invocation of postModifyNamespace", preCount + 1, postCount);
}

代码示例来源:origin: org.apache.hbase/hbase-server

ADMIN.createTable(tableDescOne);
ndesc.setConfiguration(TableNamespaceManager.KEY_MAX_REGIONS, "3");
ADMIN.modifyNamespace(ndesc);

代码示例来源:origin: org.apache.hbase/hbase-server

admin.modifyNamespace(ns1);

代码示例来源:origin: org.apache.hbase/hbase-rsgroup

admin.modifyNamespace(
  NamespaceDescriptor.create(nsName)
   .addConfiguration(RSGroupInfo.NAMESPACE_DESC_PROP_GROUP, groupName)

相关文章

Admin类方法