public SSTableSliceIterator( SSTableReader sstable, DecoratedKey key, ByteBuffer startColumn, ByteBuffer finishColumn, boolean reversed) { this.key = key; fileToClose = sstable.getFileDataInput(this.key, NodeDescriptor.getSlicedReadBufferSizeInKB() * 1024); if (fileToClose == null) return; try { DecoratedKey keyInDisk = SSTableReader.decodeKey( sstable.partitioner, sstable.descriptor, ByteBufferUtil.readWithShortLength(fileToClose)); assert keyInDisk.equals(key) : String.format("%s != %s in %s", keyInDisk, key, fileToClose.getPath()); SSTableReader.readRowSize(fileToClose, sstable.descriptor); } catch (IOException e) { throw new IOError(e); } reader = createReader(sstable, fileToClose, startColumn, finishColumn, reversed); }
public void applyModels() throws IOException { // reinitialize the table. KSMetaData ksm = NodeDescriptor.getTableDefinition(cfm.ksName); ksm = makeNewKeyspaceDefinition(ksm); try { CFMetaData.map(cfm); } catch (ConfigurationException ex) { throw new IOException(ex); } Table.open( cfm.ksName); // make sure it's init-ed w/ the old definitions first, since we're going to // call initCf on the new one manually NodeDescriptor.setTableDefinition(ksm, newVersion); // these definitions could have come from somewhere else. CFMetaData.fixMaxId(); if (!StorageService.instance.isClientMode()) Table.open(ksm.name).initCf(cfm.cfId, cfm.cfName); }
public AddColumnFamily(CFMetaData cfm) throws ConfigurationException, IOException { super( UUIDGen.makeType1UUIDFromHost(GossipUtilities.getLocalAddress()), NodeDescriptor.getDefsVersion()); this.cfm = cfm; KSMetaData ksm = NodeDescriptor.getTableDefinition(cfm.ksName); if (ksm == null) throw new ConfigurationException("No such keyspace: " + cfm.ksName); else if (ksm.cfMetaData().containsKey(cfm.cfName)) throw new ConfigurationException( String.format("%s already exists in keyspace %s", cfm.cfName, cfm.ksName)); else if (!Migration.isLegalName(cfm.cfName)) throw new ConfigurationException("Invalid column family name: " + cfm.cfName); for (Map.Entry<ByteBuffer, ColumnDefinition> entry : cfm.getColumn_metadata().entrySet()) { String indexName = entry.getValue().getIndexName(); if (indexName != null && !Migration.isLegalName(indexName)) throw new ConfigurationException("Invalid index name: " + indexName); } // clone ksm but include the new cf def. KSMetaData newKsm = makeNewKeyspaceDefinition(ksm); rm = Migration.makeDefinitionMutation(newKsm, null, newVersion); }