开发者

Limitation in Cassandra-0.8.1 when using batch mutation

I found some exceptions from cassandra when I do batch mutation, it said "already has modifications in this mutation", but the info given are two different operations. I use Super column with counters in this case, it's like

  • Key: md5 of urls, utf-8
  • SuperColumnName: date, utf-8
  • ColumnName: Counter name is a random number from 1 to 200,
  • ColumnValue:1L

L

public void SuperCounterMutation(ArrayList<String> urlList) {
    LinkedList<HCounterSuperColumn<String, String>> counterSuperColumns;
    for(String line : urlList) {
      String[] ele = StringUtils.split(StringUtils.strip(line), ':');
      String key = ele[0];
      String SuperColumnName = ele[1];
      LinkedList<HCounterColumn<String>> ColumnList = new LinkedList<HCounterColumn<String>>();
      for(int i = 2; i < ele.length; ++i) {
        ColumnList.add(HFactory.createCounterColumn(ele[i], 1L,开发者_如何学运维 ser));
      }
      mutator.addCounter(key, ColumnFamilyName, HFactory.createCounterSuperColumn(SuperColumnName, ColumnList, ser, ser));
      ++count;
      if(count >= BUF_MAX_NUM) {
        try {
          mutator.execute();
        } catch(Exception e) {
          e.printStackTrace();
        }   
        mutator = HFactory.createMutator(keyspace, ser);
        count = 0;
      }   
    }
    return;
}

Error info from cassandra log showed that the duplicated operations have the same key only, SuperColumnName are not the same, and for counter name set, some conflicts have intersects and some not.

I'm using Cassandra 0.8.1 with hector 0.8.0-rc2

Can anyone tell me the reason of this problem? Thanks in advance!


Error info from cassandra log showed that the duplicated operations have the same key

Bingo. You'll need to combine operations from the same key into a single mutation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜