Java Code Examples for org.apache.hadoop.hbase.Coprocessor#PRIORITY_USER
The following examples show how to use
org.apache.hadoop.hbase.Coprocessor#PRIORITY_USER .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractHBaseTableTest.java From phoenix-tephra with Apache License 2.0 | 6 votes |
protected static Table createTable(byte[] tableName, byte[][] columnFamilies, boolean existingData, List<String> coprocessors) throws Exception { HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(tableName)); for (byte[] family : columnFamilies) { HColumnDescriptor columnDesc = new HColumnDescriptor(family); columnDesc.setMaxVersions(Integer.MAX_VALUE); columnDesc.setValue(TxConstants.PROPERTY_TTL, String.valueOf(100000)); // in millis desc.addFamily(columnDesc); } if (existingData) { desc.setValue(TxConstants.READ_NON_TX_DATA, "true"); } // Divide individually to prevent any overflow int priority = Coprocessor.PRIORITY_USER; // order in list is the same order that coprocessors will be invoked for (String coprocessor : coprocessors) { desc.addCoprocessor(coprocessor, null, ++priority, null); } hBaseAdmin.createTable(desc); testUtil.waitTableAvailable(tableName, 5000); return testUtil.getConnection().getTable(TableName.valueOf(tableName)); }
Example 2
Source File: AbstractHBaseTableTest.java From phoenix-tephra with Apache License 2.0 | 6 votes |
protected static HTable createTable(byte[] tableName, byte[][] columnFamilies, boolean existingData, List<String> coprocessors) throws Exception { HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(tableName)); for (byte[] family : columnFamilies) { HColumnDescriptor columnDesc = new HColumnDescriptor(family); columnDesc.setMaxVersions(Integer.MAX_VALUE); columnDesc.setValue(TxConstants.PROPERTY_TTL, String.valueOf(100000)); // in millis desc.addFamily(columnDesc); } if (existingData) { desc.setValue(TxConstants.READ_NON_TX_DATA, "true"); } // Divide individually to prevent any overflow int priority = Coprocessor.PRIORITY_USER; // order in list is the same order that coprocessors will be invoked for (String coprocessor : coprocessors) { desc.addCoprocessor(coprocessor, null, ++priority, null); } hBaseAdmin.createTable(desc); testUtil.waitTableAvailable(tableName, 5000); return new HTable(testUtil.getConfiguration(), tableName); }
Example 3
Source File: AbstractHBaseTableTest.java From phoenix-tephra with Apache License 2.0 | 6 votes |
protected static Table createTable(byte[] tableName, byte[][] columnFamilies, boolean existingData, List<String> coprocessors) throws Exception { HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(tableName)); for (byte[] family : columnFamilies) { HColumnDescriptor columnDesc = new HColumnDescriptor(family); columnDesc.setMaxVersions(Integer.MAX_VALUE); columnDesc.setValue(TxConstants.PROPERTY_TTL, String.valueOf(100000)); // in millis desc.addFamily(columnDesc); } if (existingData) { desc.setValue(TxConstants.READ_NON_TX_DATA, "true"); } // Divide individually to prevent any overflow int priority = Coprocessor.PRIORITY_USER; // order in list is the same order that coprocessors will be invoked for (String coprocessor : coprocessors) { desc.addCoprocessor(coprocessor, null, ++priority, null); } hBaseAdmin.createTable(desc); testUtil.waitTableAvailable(tableName, 5000); return testUtil.getConnection().getTable(TableName.valueOf(tableName)); }
Example 4
Source File: AbstractHBaseTableTest.java From phoenix-tephra with Apache License 2.0 | 6 votes |
protected static Table createTable(byte[] tableName, byte[][] columnFamilies, boolean existingData, List<String> coprocessors) throws Exception { HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(tableName)); for (byte[] family : columnFamilies) { HColumnDescriptor columnDesc = new HColumnDescriptor(family); columnDesc.setMaxVersions(Integer.MAX_VALUE); columnDesc.setValue(TxConstants.PROPERTY_TTL, String.valueOf(100000)); // in millis desc.addFamily(columnDesc); } if (existingData) { desc.setValue(TxConstants.READ_NON_TX_DATA, "true"); } // Divide individually to prevent any overflow int priority = Coprocessor.PRIORITY_USER; // order in list is the same order that coprocessors will be invoked for (String coprocessor : coprocessors) { desc.addCoprocessor(coprocessor, null, ++priority, null); } hBaseAdmin.createTable(desc); testUtil.waitTableAvailable(tableName, 5000); return testUtil.getConnection().getTable(TableName.valueOf(tableName)); }
Example 5
Source File: AbstractHBaseTableTest.java From phoenix-tephra with Apache License 2.0 | 6 votes |
protected static HTable createTable(byte[] tableName, byte[][] columnFamilies, boolean existingData, List<String> coprocessors) throws Exception { HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(tableName)); for (byte[] family : columnFamilies) { HColumnDescriptor columnDesc = new HColumnDescriptor(family); columnDesc.setMaxVersions(Integer.MAX_VALUE); columnDesc.setValue(TxConstants.PROPERTY_TTL, String.valueOf(100000)); // in millis desc.addFamily(columnDesc); } if (existingData) { desc.setValue(TxConstants.READ_NON_TX_DATA, "true"); } // Divide individually to prevent any overflow int priority = Coprocessor.PRIORITY_USER; // order in list is the same order that coprocessors will be invoked for (String coprocessor : coprocessors) { desc.addCoprocessor(coprocessor, null, ++priority, null); } hBaseAdmin.createTable(desc); testUtil.waitTableAvailable(tableName, 5000); return new HTable(testUtil.getConfiguration(), tableName); }
Example 6
Source File: AbstractHBaseTableTest.java From phoenix-tephra with Apache License 2.0 | 6 votes |
protected static HTable createTable(byte[] tableName, byte[][] columnFamilies, boolean existingData, List<String> coprocessors) throws Exception { HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(tableName)); for (byte[] family : columnFamilies) { HColumnDescriptor columnDesc = new HColumnDescriptor(family); columnDesc.setMaxVersions(Integer.MAX_VALUE); columnDesc.setValue(TxConstants.PROPERTY_TTL, String.valueOf(100000)); // in millis desc.addFamily(columnDesc); } if (existingData) { desc.setValue(TxConstants.READ_NON_TX_DATA, "true"); } // Divide individually to prevent any overflow int priority = Coprocessor.PRIORITY_USER; // order in list is the same order that coprocessors will be invoked for (String coprocessor : coprocessors) { desc.addCoprocessor(coprocessor, null, ++priority, null); } hBaseAdmin.createTable(desc); testUtil.waitTableAvailable(tableName, 5000); return new HTable(testUtil.getConfiguration(), tableName); }
Example 7
Source File: AbstractHBaseTableTest.java From phoenix-tephra with Apache License 2.0 | 6 votes |
protected static HTable createTable(byte[] tableName, byte[][] columnFamilies, boolean existingData, List<String> coprocessors) throws Exception { HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(tableName)); for (byte[] family : columnFamilies) { HColumnDescriptor columnDesc = new HColumnDescriptor(family); columnDesc.setMaxVersions(Integer.MAX_VALUE); columnDesc.setValue(TxConstants.PROPERTY_TTL, String.valueOf(100000)); // in millis desc.addFamily(columnDesc); } if (existingData) { desc.setValue(TxConstants.READ_NON_TX_DATA, "true"); } // Divide individually to prevent any overflow int priority = Coprocessor.PRIORITY_USER; // order in list is the same order that coprocessors will be invoked for (String coprocessor : coprocessors) { desc.addCoprocessor(coprocessor, null, ++priority, null); } hBaseAdmin.createTable(desc); testUtil.waitTableAvailable(tableName, 5000); return new HTable(testUtil.getConfiguration(), tableName); }
Example 8
Source File: AbstractHBaseTableTest.java From phoenix-tephra with Apache License 2.0 | 6 votes |
protected static HTable createTable(byte[] tableName, byte[][] columnFamilies, boolean existingData, List<String> coprocessors) throws Exception { HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(tableName)); for (byte[] family : columnFamilies) { HColumnDescriptor columnDesc = new HColumnDescriptor(family); columnDesc.setMaxVersions(Integer.MAX_VALUE); columnDesc.setValue(TxConstants.PROPERTY_TTL, String.valueOf(100000)); // in millis desc.addFamily(columnDesc); } if (existingData) { desc.setValue(TxConstants.READ_NON_TX_DATA, "true"); } // Divide individually to prevent any overflow int priority = Coprocessor.PRIORITY_USER; // order in list is the same order that coprocessors will be invoked for (String coprocessor : coprocessors) { desc.addCoprocessor(coprocessor, null, ++priority, null); } hBaseAdmin.createTable(desc); testUtil.waitTableAvailable(tableName, 5000); return new HTable(testUtil.getConfiguration(), tableName); }
Example 9
Source File: TableDescriptorBuilder.java From hbase with Apache License 2.0 | 5 votes |
private static Optional<CoprocessorDescriptor> toCoprocessorDescriptor(String spec) { Matcher matcher = CP_HTD_ATTR_VALUE_PATTERN.matcher(spec); if (matcher.matches()) { // jar file path can be empty if the cp class can be loaded // from class loader. String path = matcher.group(1).trim().isEmpty() ? null : matcher.group(1).trim(); String className = matcher.group(2).trim(); if (className.isEmpty()) { return Optional.empty(); } String priorityStr = matcher.group(3).trim(); int priority = priorityStr.isEmpty() ? Coprocessor.PRIORITY_USER : Integer.parseInt(priorityStr); String cfgSpec = null; try { cfgSpec = matcher.group(4); } catch (IndexOutOfBoundsException ex) { // ignore } Map<String, String> ourConf = new TreeMap<>(); if (cfgSpec != null && !cfgSpec.trim().equals("|")) { cfgSpec = cfgSpec.substring(cfgSpec.indexOf('|') + 1); Matcher m = CP_HTD_ATTR_VALUE_PARAM_PATTERN.matcher(cfgSpec); while (m.find()) { ourConf.put(m.group(1), m.group(2)); } } return Optional.of(CoprocessorDescriptorBuilder.newBuilder(className) .setJarPath(path) .setPriority(priority) .setProperties(ourConf) .build()); } return Optional.empty(); }