private static List<ColumnFamilyDescriptor> getExistingColumnFamilyDesc(Map conf, String dbPath) throws IOException { try { List<byte[]> families = Lists.newArrayList(); List<byte[]> existingFamilies = RocksDB.listColumnFamilies(getOptions(conf), dbPath); if (existingFamilies != null) { families.addAll(existingFamilies); } else { families.add(RocksDB.DEFAULT_COLUMN_FAMILY); } List<ColumnFamilyDescriptor> columnFamilyDescriptors = new ArrayList<>(); for (byte[] bytes : families) { columnFamilyDescriptors.add(new ColumnFamilyDescriptor(bytes, getColumnFamilyOptions(conf))); LOG.info("Load column family of {}", new String(bytes)); } return columnFamilyDescriptors; } catch (RocksDBException e) { throw new IOException("Failed to retrieve existing column families.", e); } }
familyOptions.setNumLevels(levelNum); familyOptions.setLevelZeroFileNumCompactionTrigger(compactionTriggerNum); List<byte[]> families = RocksDB.listColumnFamilies(options, dbPath); List<ColumnFamilyDescriptor> columnFamilyDescriptors = new ArrayList<>(); if (families != null) {
public static Set<String> listCFs(String path) throws RocksDBException { Set<String> cfs = new HashSet<>(); List<byte[]> oldCFs = RocksDB.listColumnFamilies(new Options(), path); if (oldCFs.isEmpty()) { cfs.add("default"); } else { for (byte[] oldCF : oldCFs) { cfs.add(decode(oldCF)); } } return cfs; }
/** * Static method to determine all available column families for a * rocksdb database identified by path * * @param options Options for opening the database * @param path Absolute path to rocksdb database * @return List<byte[]> List containing the column family names * * @throws RocksDBException thrown if error happens in underlying * native library. */ public static List<byte[]> listColumnFamilies(final Options options, final String path) throws RocksDBException { return Arrays.asList(RocksDB.listColumnFamilies(options.nativeHandle_, path)); }
public static Set<String> listCFs(String path) throws RocksDBException { Set<String> cfs = new HashSet<>(); List<byte[]> oldCFs = RocksDB.listColumnFamilies(new Options(), path); if (oldCFs.isEmpty()) { cfs.add("default"); } else { for (byte[] oldCF : oldCFs) { cfs.add(decode(oldCF)); } } return cfs; }
/** * Gets all available column family names from a RocksDb data directory. * * @param path * @return * @throws RocksDBException */ public static String[] getColumnFamilyList(String path) throws RocksDBException { List<byte[]> cfList = RocksDB.listColumnFamilies(new Options(), path); if (cfList == null || cfList.size() == 0) { return ArrayUtils.EMPTY_STRING_ARRAY; } List<String> result = new ArrayList<>(cfList.size()); for (byte[] cf : cfList) { result.add(new String(cf, UTF8)); } return result.toArray(ArrayUtils.EMPTY_STRING_ARRAY); }
RocksDB.listColumnFamilies(new Options(dbOptions, cfMetadataOptions), dbDir.getAbsolutePath()), ImmutableList.<byte[]>of()); List<ColumnFamilyDescriptor> cfDescriptors = Lists.newArrayListWithCapacity(initialCfs.size()); List<ColumnFamilyHandle> cfHandles = Lists.newArrayListWithCapacity(1 + initialCfs.size());
options.setCreateIfMissing(true); families = new ArrayList<>(RocksDB.listColumnFamilies(options, path));
rocksDBOptions.setMaxSubcompactions(maxSubcompactions); List<byte[]> families = RocksDB.listColumnFamilies(rocksDBOptions, uri.getPath()); List<ColumnFamilyHandle> handles = new ArrayList<>(families.size() + 1); List<ColumnFamilyDescriptor> descriptors = new ArrayList<>(families.size() + 1);
List<byte[]> columnFamilies = RocksDB.listColumnFamilies(new Options(), path); colFamilyNames = columnFamilies.stream().map(fn).collect(Collectors.toList()); } catch (RocksDBException e) {
final List<String> colFamilyNames; try { colFamilyNames = Lists.transform(RocksDB.listColumnFamilies(new Options(), path), (ba) -> new String(ba, Charsets.UTF_8)); } catch (RocksDBException e) {