increment counter by Cassandra

昨日の続き。しかし、11月号と言いつつ、発売日が9月末なので、ちょっと情報が古いのかもしれない。こわいなー。
ひとまず、cassandra incrementでググる
https://issues.apache.org/jira/browse/CASSANDRA-1072

Description
Break out the increment counters out of CASSANDRA-580. Classes are shared between the two features but without the plain version vector code the changeset becomes smaller and more manageable.

これかなー?

Fix Version/s: None

えーと、そもそもわたくし、オープンソース開発の現場を覗くってのてほとんど初めてに近いのですが、これって実装予定のバージョンは未定ってことでよいのでしょうか。
とりあえずtrunk(0.7.0beta3)には入っていませんですねぇ。うぅぅ…
というか、

amanar@lenny101:~/work$ wget https://issues.apache.org/jira/secure/attachment/12460218/CASSANDRA-1072.112210.patch
(snip)
amanar@lenny101:~/work$ view CASSANDRA-1072.112210.patch

diff --git a/conf/cassandra.yaml b/conf/cassandra.yaml
index d44e792..d9ab2c2 100644
 --- a/conf/cassandra.yaml
 +++ b/conf/cassandra.yaml
 @@ -369,100 +369,58 @@ index_interval: 128
 #        will be used.

なにこの変なパッチファイル…って、git使ったことないからなあ。

amanar@lenny101:~/work$ which git
/usr/bin/git

お、lennyには最初から入っているのね。

amanar@lenny101:~/work$ git clone git://git.apache.org/cassandra.git
Initialized empty Git repository in /home/amanar/work/cassandra/.git/
remote: Counting objects: 41978, done.
remote: Compressing objectsremote: :  remote: 17remote: % (remote: 1289remote: /remote: 7577remote: )rem
remote: Compressing objectsremote: :  remote: 20remote: % (remote: 1516remote: /remote: 7577remote: )rem
remote: Compressing objectsremote: :  remote: 69remote: % (remote: 5229remote: /remote: 7577remote: )rem
remote: Compressing objectsremote: :  remote: 89remote: % (remote: 6744remote: /remote: 7577remote: )rem
remote: Compressing objects: 100% (remote: 7577/7577), done.
remote: Total 41978remote:  (delta 24953), reused 39210 (delta remote: 22905)
Receiving objects: 100% (41978/41978), 33.82 MiB | 174 KiB/s, done.
Resolving deltas: 100% (24953/24953), done.

http://www.geocities.jp/jun930/etc/git_tips.html
おそるおそる。。。

amanar@lenny101:~/work/cassandra$ pwd
/home/amanar/work/cassandra
amanar@lenny101:~/work/cassandra$ ls
CHANGES.txt  NOTICE.txt  build.xml  debian   interface        lib     test
LICENSE.txt  README.txt  conf       doc      ivy.xml          redhat
NEWS.txt     bin         contrib    drivers  ivysettings.xml  src
amanar@lenny101:~/work/cassandra$ mv ../CASSANDRA-1072.112210.patch .
amanar@lenny101:~/work/cassandra$ git apply CASSANDRA-1072.112210.patch
CASSANDRA-1072.112210.patch:226: trailing whitespace.

CASSANDRA-1072.112210.patch:254: trailing whitespace.
                                  2:required ColumnParent column_parent,
CASSANDRA-1072.112210.patch:255: trailing whitespace.
                                  3:required SlicePredicate predicate,
CASSANDRA-1072.112210.patch:258: trailing whitespace.

CASSANDRA-1072.112210.patch:264: trailing whitespace.
                                                   3:required SlicePredicate predicate,
warning: squelched 74 whitespace errors
warning: 79 lines add whitespace errors.
amanar@lenny101:~/work/cassandra$ git apply --check  CASSANDRA-1072.112210.patch

ん、なんかエラー出てるけど、大丈夫なのかなぁ?

amanar@lenny101:~/work/cassandra$ find . -name *.java -exec grep -H [iI]ncrement {} \;
./test/unit/org/apache/cassandra/db/SuperColumnTest.java:    public void testAddColumnIncrementCounter()
./src/java/org/apache/cassandra/db/commitlog/CommitLog.java:                            i.incrementAndGet();
./src/java/org/apache/cassandra/db/context/CounterContext.java: *   1) increment the logical clock, and
./src/java/org/apache/cassandra/db/context/CounterContext.java: * NOTE: only a given node id may increment its associated count and
(以下略)

とりあえずなんかパッチは当たってるっぽいねー。ビルド通るのかしら。

    [javac] エラー 44 個

BUILD FAILED
/home/amanar/work/cassandra/build.xml:295: Compile failed; see the compiler error output for details.

Total time: 4 seconds
amanar@lenny101:~/work/cassandra$

ぎゃー駄目だー。
これ、そもそもtrunkからの差分で合っているのだろうか? ていうか、どのRevision??

苦闘は続く。。。

(2011/01/09 追記)

0.7.0 RC4 にて実装されたようなので、検証してみました。
Cassandra0.7 counter実践編