diff options
author | wg <wg@FreeBSD.org> | 2015-10-22 06:06:50 +0800 |
---|---|---|
committer | wg <wg@FreeBSD.org> | 2015-10-22 06:06:50 +0800 |
commit | 1a8c20d5f970e11faf50779bade030f304f4785e (patch) | |
tree | b67e73165d6379e5943018adeea9643893a2c773 /sysutils/riak-cs | |
parent | 61a22101b7a470e5e10b7ffadc79ed9d14c5d5c2 (diff) | |
download | freebsd-ports-gnome-1a8c20d5f970e11faf50779bade030f304f4785e.tar.gz freebsd-ports-gnome-1a8c20d5f970e11faf50779bade030f304f4785e.tar.zst freebsd-ports-gnome-1a8c20d5f970e11faf50779bade030f304f4785e.zip |
sysutils/riak-cs: update to 2.1.0
Submitted by: Scott Kamp
Diffstat (limited to 'sysutils/riak-cs')
-rw-r--r-- | sysutils/riak-cs/Makefile | 3 | ||||
-rw-r--r-- | sysutils/riak-cs/distinfo | 4 | ||||
-rw-r--r-- | sysutils/riak-cs/files/patch-riak_test_src_downgrage_bitcask.erl | 140 | ||||
-rw-r--r-- | sysutils/riak-cs/pkg-plist | 1 |
4 files changed, 144 insertions, 4 deletions
diff --git a/sysutils/riak-cs/Makefile b/sysutils/riak-cs/Makefile index 7aa0553ef0a5..6b9bad34d7a2 100644 --- a/sysutils/riak-cs/Makefile +++ b/sysutils/riak-cs/Makefile @@ -1,7 +1,7 @@ # $FreeBSD$ PORTNAME= riak-cs -PORTVERSION= 2.0.1 +PORTVERSION= 2.1.0 CATEGORIES= sysutils MASTER_SITES= http://s3.amazonaws.com/downloads.basho.com/riak-cs/${PORTVERSION:R}/${PORTVERSION}/ \ http://downloads.basho.com.s3.amazonaws.com/riak-cs/${PORTVERSION:R}/${PORTVERSION}/ @@ -15,7 +15,6 @@ BUILD_DEPENDS= ${LOCALBASE}/lib/riak-erlang/bin/erlc:${PORTSDIR}/lang/erlang-ria USES= gmake readline USE_RC_SUBR= riak-cs -USE_GCC= yes USERS= riakcs GROUPS= riak diff --git a/sysutils/riak-cs/distinfo b/sysutils/riak-cs/distinfo index 7b42b11f6f9b..ca3e9ef9b693 100644 --- a/sysutils/riak-cs/distinfo +++ b/sysutils/riak-cs/distinfo @@ -1,2 +1,2 @@ -SHA256 (riak-cs-2.0.1.tar.gz) = 7c8d38ff678c42271e51270bb9e82002358f8c2d15a071ae8e406d52655c64da -SIZE (riak-cs-2.0.1.tar.gz) = 9734438 +SHA256 (riak-cs-2.1.0.tar.gz) = 3a7a67069f170986f6275defe9e79c3b87937865e6c978eb7f7f97be3cf99360 +SIZE (riak-cs-2.1.0.tar.gz) = 10670941 diff --git a/sysutils/riak-cs/files/patch-riak_test_src_downgrage_bitcask.erl b/sysutils/riak-cs/files/patch-riak_test_src_downgrage_bitcask.erl new file mode 100644 index 000000000000..7965d6f7d5fb --- /dev/null +++ b/sysutils/riak-cs/files/patch-riak_test_src_downgrage_bitcask.erl @@ -0,0 +1,140 @@ +diff -ruN temp/riak-cs-2.1.0/riak_test/src/downgrade_bitcask.erl work/riak-cs-2.1.0/riak_test/src/downgrade_bitcask.erl +--- temp/riak-cs-2.1.0/riak_test/src/downgrade_bitcask.erl 1970-01-01 10:00:00.000000000 +1000 ++++ riak_test/src/downgrade_bitcask.erl 2015-10-22 08:44:18.415188879 +1100 +@@ -0,0 +1,136 @@ ++% Run this script to downgrade Bitcask files from the format ++% introduced in Riak 2.0 to the format used in Riak 1.4 ++% Run it by calling escript on it and pointing it to a data ++% directory after stopping the Riak node. ++% The script will recursively find all Bitcask files under that ++% directory and reformat them. ++% $ escript downgrade_bitcask.erl /my/riak/data/bitcask ++-module(downgrade_bitcask). ++-mode(compile). ++-export([main/1]). ++ ++-define(HEADER_SIZE, 14). ++-record(entry, { crc, tstamp, keysz, valsz, key, val}). ++ ++main([DataDir]) -> ++ downgrade_if_dir(DataDir). ++ ++maybe_downgrade_file(F) -> ++ is_bitcask_file(F) andalso downgrade_file(F). ++ ++downgrade_if_dir(Dir) -> ++ case filelib:is_dir(Dir) of ++ true -> ++ downgrade_dir(Dir); ++ false -> ++ ok ++ end. ++ ++downgrade_dir(Dir) -> ++ {ok, Children0} = file:list_dir(Dir), ++ Children = [filename:join(Dir, Child) || Child <- Children0], ++ case is_bitcask_dir(Dir) of ++ false -> ++ [downgrade_if_dir(Child) || Child <- Children]; ++ true -> ++ [maybe_downgrade_file(Child) || Child <- Children] ++ end. ++ ++is_bitcask_file(Filename0) -> ++ Filename = filename:basename(Filename0), ++ Match = re:run(Filename, "^\\d+\\.bitcask\\.data$"), ++ nomatch =/= Match. ++ ++is_bitcask_dir(Dir) -> ++ case filelib:is_dir(Dir) of ++ false -> ++ false; ++ true -> ++ {ok, Files} = file:list_dir(Dir), ++ lists:any(fun is_bitcask_file/1, Files) ++ end. ++ ++read_entry(F) -> ++ case file:read(F, ?HEADER_SIZE) of ++ {ok, <<CRC:32,Tstamp:32,KeySz:16,ValueSz:32>>} -> ++ case file:read(F, KeySz+ValueSz) of ++ {ok, <<Key:KeySz/bytes, Value:ValueSz/bytes>>} -> ++ % io:format("K: ~p, V: ~p\n", [Key, Value]), ++ {ok, #entry{crc=CRC, tstamp=Tstamp, keysz=KeySz, valsz=ValueSz, ++ key=Key, val=Value}}; ++ _ -> ++ error ++ end; ++ eof -> ++ eof; ++ _ -> ++ io:format("Error reading entry\n"), ++ error ++ end. ++ ++downgrade_file(F) -> ++ Dir = filename:dirname(F), ++ NewF = F ++ ".new", ++ HintFile = filename:join(Dir, filename:basename(F, ".data")++".hint"), ++ NewHF = HintFile ++ ".new", ++ io:format("Downgrading file ~s\n", [F]), ++ {ok, Fi} = file:open(F, [read, raw, binary]), ++ {ok, Fo} = file:open(NewF, [write, raw, binary]), ++ {ok, Fh} = file:open(NewHF, [write, raw, binary]), ++ ok = convert_file(Fi, Fo, Fh, 0, 0, fun tx_pre_20/1), ++ ok = file:close(Fi), ++ ok = file:close(Fo), ++ ok = file:close(Fh), ++ HintBak = HintFile ++ ".bak", ++ FBak = F ++ ".bak", ++ ok = file:rename(HintFile, HintBak), ++ ok = file:rename(F, FBak), ++ ok = file:rename(NewF, F), ++ ok = file:rename(NewHF, HintFile), ++ ok = file:delete(HintBak), ++ ok = file:delete(FBak), ++ ok. ++ ++convert_file(Fi, Fo, Fh, Ofs, Crc, Tx) -> ++ case read_entry(Fi) of ++ {ok, Entry} -> ++ NewEntry = Tx(Entry), ++ Sz = write_entry(Fo, NewEntry), ++ NewCrc = write_hint_entry(Fh, Ofs, Sz, Crc, NewEntry), ++ convert_file(Fi, Fo, Fh, Ofs+Sz, NewCrc, Tx); ++ eof -> ++ write_hint_entry(Fh, 16#ffffFFFFffffFFFF, Crc, 0, ++ #entry{key= <<>>, tstamp=0}), ++ % io:format("Finished reading file\n", []), ++ ok; ++ _ -> ++ io:format(standard_error, "Error reading file\n", []), ++ error ++ end. ++ ++write_hint_entry(F, Ofs, Sz, Crc, #entry{key=Key, tstamp=Tstamp}) -> ++ KeySz = size(Key), ++ Hint = [<<Tstamp:32, KeySz:16, Sz:32, Ofs:64>>, Key], ++ ok = file:write(F, Hint), ++ erlang:crc32(Crc, Hint). ++ ++write_entry(F, #entry {key=Key, val=Value, tstamp=Tstamp}) -> ++ KeySz = size(Key), ++ ValueSz = size(Value), ++ Bytes0 = [<<Tstamp:32>>, <<KeySz:16>>, <<ValueSz:32>>, Key, Value], ++ Bytes = [<<(erlang:crc32(Bytes0)):32>> | Bytes0], ++ ok = file:write(F, Bytes), ++ iolist_size(Bytes). ++ ++tx_pre_20(Entry = ++ #entry{key= <<2, BucketSz:16, Bucket:BucketSz/binary, ++ Key/binary>>}) -> ++ OldKey=term_to_binary({Bucket, Key}), ++ % io:format("Converted B/K ~s/~s\n", [Bucket, Key]), ++ tx_pre_20(Entry#entry{key=OldKey, keysz=size(OldKey)}); ++tx_pre_20(Entry= ++ #entry{val= <<"bitcask_tombstone2", _/binary>>}) -> ++ NewVal = <<"bitcask_tombstone">>, ++ Entry#entry{val=NewVal, valsz=size(NewVal)}; ++tx_pre_20(Entry) -> ++ Entry. diff --git a/sysutils/riak-cs/pkg-plist b/sysutils/riak-cs/pkg-plist index 3dadb32bbb93..fe387e704f20 100644 --- a/sysutils/riak-cs/pkg-plist +++ b/sysutils/riak-cs/pkg-plist @@ -6,6 +6,7 @@ sbin/riak-cs-gc sbin/riak-cs-multibag sbin/riak-cs-stanchion sbin/riak-cs-storage +sbin/riak-cs-supercluster @sample %%RIAKCS_CONFDIR%%/riak-cs.conf @sample %%RIAKCS_CONFDIR%%/advanced.config @sample %%RIAKCS_CONFDIR%%/key.pem |