public void RemoveRecord([NotNull] TaskIndexRecord taskIndexRecord, long timestamp)
        {
            var rowKey     = CassandraNameHelper.GetRowKey(taskIndexRecord.TaskIndexShardKey, taskIndexRecord.MinimalStartTicks);
            var columnName = CassandraNameHelper.GetColumnName(taskIndexRecord.MinimalStartTicks, taskIndexRecord.TaskId);

            RetrieveColumnFamilyConnection().DeleteColumn(rowKey, columnName, timestamp);
        }
        private void DoWriteRecord([NotNull] TaskIndexRecord taskIndexRecord, long timestamp, TimeSpan?ttl)
        {
            var rowKey     = CassandraNameHelper.GetRowKey(taskIndexRecord.TaskIndexShardKey, taskIndexRecord.MinimalStartTicks);
            var columnName = CassandraNameHelper.GetColumnName(taskIndexRecord.MinimalStartTicks, taskIndexRecord.TaskId);

            RetrieveColumnFamilyConnection().AddColumn(rowKey, new Column
            {
                Name      = columnName,
                Timestamp = timestamp,
                Value     = serializer.Serialize(taskIndexRecord.TaskId),
                TTL       = ttl.HasValue ? (int)ttl.Value.TotalSeconds : (int?)null,
            });
        }
예제 #3
0
 public bool MoveNext()
 {
     while (true)
     {
         if (eventEnumerator.MoveNext())
         {
             var currentLiveRecordTicks = CassandraNameHelper.GetTicksFromColumnName(eventEnumerator.Current.Name);
             if (currentLiveRecordTicks > toTicks)
             {
                 liveRecordTicksMarker.TryMoveForward(toTicks);
                 return(false);
             }
             liveRecordTicksMarker.TryMoveForward(currentLiveRecordTicks);
             if (!loggedTooOldIndexRecord && currentLiveRecordTicks < (Timestamp.Now - TimeSpan.FromHours(1)).Ticks)
             {
                 logger.Warn("Too old index record: [TaskId = {RtqTaskId}, ColumnName = {ColumnName}, ColumnTimestamp = {ColumnTimestamp}]",
                             new { RtqTaskId = Current.TaskId, ColumnName = eventEnumerator.Current.Name, ColumnTimestamp = eventEnumerator.Current.Timestamp });
                 loggedTooOldIndexRecord = true;
             }
             return(true);
         }
         if (iCur >= iTo)
         {
             liveRecordTicksMarker.TryMoveForward(toTicks);
             return(false);
         }
         iCur++;
         var    rowKey = CassandraNameHelper.GetRowKey(liveRecordTicksMarker.State.TaskIndexShardKey, CassandraNameHelper.GetMinimalTicksForRow(iCur));
         string exclusiveStartColumnName = null;
         if (iCur == iFrom)
         {
             exclusiveStartColumnName = CassandraNameHelper.GetColumnName(fromTicks, string.Empty);
         }
         eventEnumerator = connection.GetRow(rowKey, exclusiveStartColumnName, batchSize).GetEnumerator();
     }
 }