@Override public ColumnListMutation<C> putEmptyColumn(C columnName, Integer ttl) { primary.putEmptyColumn(columnName, ttl); secondary.putEmptyColumn(columnName, ttl); return this; }
@Override public ColumnListMutation<C> putEmptyColumn(C columnName) { primary.putEmptyColumn(columnName); secondary.putEmptyColumn(columnName); return this; }
public Boolean apply(MutationBatch input) { input.withRow(CF_UNIQUE_CONSTRAINT, 10L).putEmptyColumn("MyCustomColumn", null); return true; } });
public Boolean apply(MutationBatch input) { input.withRow(CF_UNIQUE_CONSTRAINT, 10L).putEmptyColumn("MyCustomColumn", null); return true; } });
public void populateRows(int numRows) throws Exception { MutationBatch mb = keyspace.prepareMutationBatch(); for (int i=0; i<numRows; i++) { Date date = OriginalDate.plusMinutes(i).toDate(); mb.withRow(CF_USER_INFO, "acct_" + i) .putColumn("firstname", "john_" + i, null) .putColumn("lastname", "smith_" + i, null) .putColumn("address", "john smith address " + i, null) .putColumn("age", 30+i, null) .putColumn("ageShort", new Integer(30+i).shortValue(), null) .putColumn("ageLong", new Integer(30+i).longValue(), null) .putColumn("percentile", 30.1) .putColumn("married", true) .putColumn("single", false) .putColumn("birthdate", date) .putColumn("bytes", TestBytes) .putColumn("uuid", TestUUID) .putEmptyColumn("empty"); mb.execute(); mb.discardMutations(); } }
private static void populateRowsForUserInfo(int numRows) throws Exception { MutationBatch mb = keyspace.prepareMutationBatch(); for (int i=0; i<numRows; i++) { Date date = OriginalDate.plusMinutes(i).toDate(); mb.withRow(CF_USER_INFO, "acct_" + i) .putColumn("firstname", "john_" + i, null) .putColumn("lastname", "smith_" + i, null) .putColumn("address", "john smith address " + i, null) .putColumn("age", 30+i, null) .putColumn("ageShort", new Integer(30+i).shortValue(), null) .putColumn("ageLong", new Integer(30+i).longValue(), null) .putColumn("percentile", 30.1) .putColumn("married", true) .putColumn("single", false) .putColumn("birthdate", date) .putColumn("bytes", TestBytes) .putColumn("uuid", TestUUID) .putEmptyColumn("empty"); mb.execute(); mb.discardMutations(); } }
@ParameterizedTimed(type="AstyanaxStorageProvider") @Override public void writeChunk(Table tbl, String blobId, int chunkId, ByteBuffer data, Duration ttl, long timestamp) { AstyanaxTable table = (AstyanaxTable) checkNotNull(tbl, "table"); for (AstyanaxStorage storage : table.getWriteStorage()) { BlobPlacement placement = (BlobPlacement) storage.getPlacement(); // Write two columns: one small one and one big one with the binary data. Readers can query on // the presence of the small one to be confident that the big column has replicated and is available. MutationBatch mutation = placement.getKeyspace().prepareMutationBatch(CONSISTENCY_STRONG) .setTimestamp(timestamp); Integer ttlSeconds = Ttls.toSeconds(ttl, 1, null); mutation.withRow(placement.getBlobColumnFamily(), storage.getRowKey(blobId)) .putEmptyColumn(getColumn(ColumnGroup.B, chunkId), ttlSeconds) .putColumn(getColumn(ColumnGroup.Z, chunkId), data, ttlSeconds); execute(mutation); _blobWriteMeter.mark(data.remaining()); } }
@Test public void testHasValue() throws Exception { MutationBatch m = keyspace.prepareMutationBatch(); m.withRow(CF_USER_INFO, "acct1234") .putColumn("firstname", "john", null) .putColumn("lastname", "smith", null) .putColumn("address", "555 Elm St", null) .putColumn("age", 30, null) .putEmptyColumn("empty"); m.execute(); ColumnList<String> response = keyspace.prepareQuery(CF_USER_INFO).getRow("acct1234").execute().getResult(); Assert.assertEquals("firstname", response.getColumnByName("firstname").getName()); Assert.assertEquals("firstname", response.getColumnByName("firstname").getName()); Assert.assertEquals("john", response.getColumnByName("firstname").getStringValue()); Assert.assertEquals("john", response.getColumnByName("firstname").getStringValue()); Assert.assertEquals(true, response.getColumnByName("firstname").hasValue()); Assert.assertEquals(false, response.getColumnByName("empty").hasValue()); }
.putEmptyColumn(MessageMetadataEntry.newMessageId(getCompositeKey(shardKey, entry.getMessageId())), metadata.getRetentionTimeout());
m.withRow(columnFamily, key).putEmptyColumn(uniqueColumn, ttl); m.withRow(columnFamily, key).putEmptyColumn(uniqueColumn, null);
m.withRow(columnFamily, key).putEmptyColumn(uniqueColumn, ttl); m.withRow(columnFamily, key).putEmptyColumn(uniqueColumn, null);
bool = !bool; columnCount++; mRow.putEmptyColumn( new MockCompositeType(Character.toString(part1), part2, part3, bool, "UTF"), null);
ColumnListMutation<Long> cfmLong = m.withRow(CF_LONGCOLUMN, rowKey); for (Long l = -10L; l < 10L; l++) { cfmLong.putEmptyColumn(l, null); cfmLong.putEmptyColumn(Long.MAX_VALUE, null); m.execute();
public C isUnique(K key) throws ConnectionException { C unique = uniqueColumnSupplier.get(); // Phase 1: Write a unique column MutationBatch m = keyspace.prepareMutationBatch().setConsistencyLevel(consistencyLevel); m.withRow(columnFamily, key).putEmptyColumn(unique, ttl); m.execute(); // Phase 2: Read back all columns. There should be only 1 ColumnList<C> result = keyspace.prepareQuery(columnFamily).setConsistencyLevel(consistencyLevel).getKey(key) .execute().getResult(); if (result.size() == 1) { return unique; } if (this.monitor != null) this.monitor.onViolation(key, unique); // Rollback m = keyspace.prepareMutationBatch().setConsistencyLevel(consistencyLevel); m.withRow(columnFamily, key).deleteColumn(unique); m.execute(); return null; } }
public C isUnique(K key) throws ConnectionException { C unique = uniqueColumnSupplier.get(); // Phase 1: Write a unique column MutationBatch m = keyspace.prepareMutationBatch().setConsistencyLevel(consistencyLevel); m.withRow(columnFamily, key).putEmptyColumn(unique, ttl); m.execute(); // Phase 2: Read back all columns. There should be only 1 ColumnList<C> result = keyspace.prepareQuery(columnFamily).setConsistencyLevel(consistencyLevel).getKey(key) .execute().getResult(); if (result.size() == 1) { return unique; } if (this.monitor != null) this.monitor.onViolation(key, unique); // Rollback m = keyspace.prepareMutationBatch().setConsistencyLevel(consistencyLevel); m.withRow(columnFamily, key).deleteColumn(unique); m.execute(); return null; } }
.putEmptyColumn(MessageMetadataEntry.newMessageId(queue.getCompositeKey(queue.getShardKey(message), entry.getMessageId())), queue.metadataDeleteTTL); if (message.isKeepHistory()) { MessageHistory history = context.getHistory();
public String isUnique(K key) throws ConnectionException { String unique = uniqueColumnSupplier.get(); // Phase 1: Write a unique column MutationBatch m = keyspace.prepareMutationBatch().setConsistencyLevel(consistencyLevel); m.withRow(columnFamily, key).putEmptyColumn(prefix + unique, ttl); m.execute(); // Phase 2: Read back all columns. There should be only 1 ColumnList<String> result = keyspace.prepareQuery(columnFamily).setConsistencyLevel(consistencyLevel) .getKey(key) .withColumnRange(new RangeBuilder().setStart(prefix + "\u0000").setEnd(prefix + "\uFFFF").build()) .execute().getResult(); if (result.size() == 1) { return prefix + unique; } if (this.monitor != null) this.monitor.onViolation(key, prefix + unique); // Rollback m = keyspace.prepareMutationBatch().setConsistencyLevel(consistencyLevel); m.withRow(columnFamily, key).deleteColumn(prefix + unique); m.execute().getResult(); return null; } }
public String isUnique(K key) throws ConnectionException { String unique = uniqueColumnSupplier.get(); // Phase 1: Write a unique column MutationBatch m = keyspace.prepareMutationBatch().setConsistencyLevel(consistencyLevel); m.withRow(columnFamily, key).putEmptyColumn(prefix + unique, ttl); m.execute(); // Phase 2: Read back all columns. There should be only 1 ColumnList<String> result = keyspace.prepareQuery(columnFamily).setConsistencyLevel(consistencyLevel) .getKey(key) .withColumnRange(new RangeBuilder().setStart(prefix + "\u0000").setEnd(prefix + "\uFFFF").build()) .execute().getResult(); if (result.size() == 1) { return prefix + unique; } if (this.monitor != null) this.monitor.onViolation(key, prefix + unique); // Rollback m = keyspace.prepareMutationBatch().setConsistencyLevel(consistencyLevel); m.withRow(columnFamily, key).deleteColumn(prefix + unique); m.execute().getResult(); return null; } }
rm.putEmptyColumn("" + i, null);
.setTimestamp(result1.getColumnByName(2L).getTimestamp()-1) .deleteColumn(2L) .putEmptyColumn(3L, null);