public Version getVersion(HTableDescriptor tableDescriptor) { // 1) First, try to use cdap.version property on HBase table. // 2) If cdap.version property is not available, then it is 2.7 or 2.6 & older. // 2a) If table has no increment handler coprocessor, it is 2.6 or older // 2b) If table has increment handler coprocessor, it is 2.7 ProjectInfo.Version version = HBaseTableUtil.getVersion(tableDescriptor); // note: major version is 0 if table doesn't have the cdap version property if (version.getMajor() > 0) { if (version.getMajor() < 2) { return Version.VERSION_2_6_OR_LOWER; } if (version.getMajor() == 2 && version.getMinor() <= 6) { return Version.VERSION_2_6_OR_LOWER; } if (version.getMajor() == 2 && version.getMinor() <= 7) { return Version.VERSION_2_7; } return Version.VERSION_2_8_OR_HIGHER; } Map<String, HBaseTableUtil.CoprocessorInfo> cpsInfo = HBaseTableUtil.getCoprocessorInfo(tableDescriptor); if (cpsInfo.containsKey(tableUtil.getIncrementHandlerClassForVersion().getName())) { // note: if the version is 2.8 or higher, it would have cdap.version property return Version.VERSION_2_7; } return Version.VERSION_2_6_OR_LOWER; } }
public Version getVersion(HTableDescriptor tableDescriptor) { // 1) First, try to use cdap.version property on HBase table. // 2) If cdap.version property is not available, then it is 2.7 or 2.6 & older. // 2a) If table has no increment handler coprocessor, it is 2.6 or older // 2b) If table has increment handler coprocessor, it is 2.7 ProjectInfo.Version version = HBaseTableUtil.getVersion(tableDescriptor); // note: major version is 0 if table doesn't have the cdap version property if (version.getMajor() > 0) { if (version.getMajor() < 2) { return Version.VERSION_2_6_OR_LOWER; } if (version.getMajor() == 2 && version.getMinor() <= 6) { return Version.VERSION_2_6_OR_LOWER; } if (version.getMajor() == 2 && version.getMinor() <= 7) { return Version.VERSION_2_7; } return Version.VERSION_2_8_OR_HIGHER; } Map<String, HBaseTableUtil.CoprocessorInfo> cpsInfo = HBaseTableUtil.getCoprocessorInfo(tableDescriptor); if (cpsInfo.containsKey(tableUtil.getIncrementHandlerClassForVersion().getName())) { // note: if the version is 2.8 or higher, it would have cdap.version property return Version.VERSION_2_7; } return Version.VERSION_2_6_OR_LOWER; } }
Map<String, HBaseTableUtil.CoprocessorInfo> coprocessorInfo = HBaseTableUtil.getCoprocessorInfo(tableDescriptor);
Map<String, HBaseTableUtil.CoprocessorInfo> coprocessorInfo = HBaseTableUtil.getCoprocessorInfo(tableDescriptor);
Map<String, HBaseTableUtil.CoprocessorInfo> coprocessorInfo = HBaseTableUtil.getCoprocessorInfo(tableDescriptor); for (Map.Entry<String, HBaseTableUtil.CoprocessorInfo> coprocessorEntry : coprocessorInfo.entrySet()) { newDescriptor.removeCoprocessor(coprocessorEntry.getValue().getClassName());
Map<String, HBaseTableUtil.CoprocessorInfo> coprocessorInfo = HBaseTableUtil.getCoprocessorInfo(tableDescriptor); for (Map.Entry<String, HBaseTableUtil.CoprocessorInfo> coprocessorEntry : coprocessorInfo.entrySet()) { newDescriptor.removeCoprocessor(coprocessorEntry.getValue().getClassName());