setting timestamp fails for first row/column #236

jimooo opened this Issue Mar 15, 2013 · 2 comments

2 participants


I'm writing code to change every TTL in every column over the whole database. As part of that, I want to set the timestamp as well. Setting timestamp works for all columns (maybe for the entire row -- my test data only has 1 column per row) except for the very first one. The timestamp for the first one remains the "current time".

Here is my code:

   public <R,C> void updateTTLInAllRows(final ColumnFamily<R,C> cf, final Integer newTTL) throws ConnectionException
      // Inserting data
      final MutationBatch mutator = getKeyspace().prepareMutationBatch();

      final OperationResult<Rows<R, C>> result =

      for (Row<R, C> row : result.getResult())
         final R rowKey = row.getKey();
         final ColumnListMutation<C> mutationBatch = mutator.withRow(cf, rowKey);
         for (Column<C> column : row.getColumns())
            final C columnKey = column.getName();
            final long timestamp = 1400000000000001L; // column.getTimestamp();
            final ByteBuffer value = column.getByteBufferValue();
            mutationBatch.putColumn(columnKey, value, newTTL);

As a secondary issue, if I call mutator.lockCurrentTimestamp() after the call to setTimestamp, I get a null pointer exception. I'm not really concerned about that one though, it's just fyi.

Netflix, Inc. member

Which version of astyanax are you using? I wrote a unit test against the latest version and the timestamp is getting set correctly. I did see the NPE and will fix it.

Netflix, Inc. member

One other thing to keep in mind is that setting the timestamp on the mutator will only take effect for the next withRow. To set the timestamp for columns in a row call mutationBatch.setTimestamp. This is by design.

@elandau elandau closed this Mar 27, 2013
@omar-eyeviewdigital omar-eyeviewdigital pushed a commit to omar-eyeviewdigital/astyanax that referenced this issue Oct 31, 2013
@elandau elandau Fix mutation timestamp override NPE.
Fix for Netflix#236.
Added a bunch of 'sample' functions to be used with the all rows
reader: row copier, column counter, row counter, row trace.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment