Coder Social home page Coder Social logo

Comments (3)

slfritchie avatar slfritchie commented on August 17, 2024

@gburd @jonmeredith @justinsheehy @jtuple Opinions?

Usage:

./this-script 1
./this-script 2

Run this script at top of compiled bitcask source (see line 3 for -pz path).
If you don't see the Merged info report before phase 1 is done, then alter
the sleep time beyond the hardcoded 7 seconds.

#!/usr/bin/env escript
%%
%%! -pz ./ebin

main(["1"]) ->
    io:format("Deleting...\n"),
    os:cmd("rm -rf data"),
    io:format("Writing...\n"),
    Reference = bitcask:open("data", [read_write | opts()]),
    bitcask:put(Reference, <<"key_to_delete">>, <<"tr0ll">>),
    [ bitcask:put(Reference, term_to_binary(X), <<1:(8 * 1024 * 100)>>) || X <- lists:seq(1, 3000)],
    bitcask:delete(Reference, <<"key_to_delete">>),
    [ bitcask:put(Reference, term_to_binary(X), <<1:(8 * 1024 * 100)>>) || X <- lists:seq(1, 3000)],
    timer:sleep(1000 + 1000),
    bitcask_merge_worker:merge("data", opts(), ["data/2.bitcask.data"]),
    io:format("Sleeping...\n"),
    timer:sleep(7*1000),
    io:format("\nIf you see 'Merged' INFO REPORT, run this script with '2' arg\n");
main(["2"]) ->
    Reference = bitcask:open("data", [read_write | opts()]),
    io:format("Read zombie: ~p\n", [bitcask:get(Reference, <<"key_to_delete">>)]).

opts() ->
    [{max_file_size, 268435456},
     {dead_bytes_threshold, 89478485},
     {dead_bytes_merge_trigger, 178956970}].

from bitcask.

gburd avatar gburd commented on August 17, 2024

gburd@carbon:/eng/bitcask$ ./this-script 1
Deleting...
Writing...
Sleeping...
=INFO REPORT==== 12-Mar-2013::21:31:33 ===
Merged ["data",
[{max_file_size,268435456},
{dead_bytes_threshold,89478485},
{dead_bytes_merge_trigger,178956970}],
["data/2.bitcask.data"]] in 4.807972 seconds.
If you see 'Merged' INFO REPORT, run this script with '2' arg
gburd@carbon:
/eng/bitcask$ ./this-script 2

Read zombie: {ok,<<"tr0ll">>}

@gregburd | Basho Technologies | Riak | http://basho.com | @basho

On Tue, Mar 12, 2013 at 8:25 PM, Scott Lystig Fritchie <
[email protected]> wrote:

@gburd https://github.com/gburd @jonmeredithhttps://github.com/jonmeredith
@justinsheehy https://github.com/justinsheehy @jtuplehttps://github.com/jtupleOpinions?

Usage:

./this-script 1
./this-script 2

Run this script at top of compiled bitcask source (see line 3 for -pz
path).
If you don't see the Merged info report before phase 1 is done, then alter
the sleep time beyond the hardcoded 7 seconds.

#!/usr/bin/env escript
%%
%%! -pz ./ebin

main(["1"]) ->
io:format("Deleting...\n"),
os:cmd("rm -rf data"),
io:format("Writing...\n"),
Reference = bitcask:open("data", [read_write | opts()]),
bitcask:put(Reference, <<"key_to_delete">>, <<"tr0ll">>),
[ bitcask:put(Reference, term_to_binary(X), <<1:(8 * 1024 * 100)>>) || X <- lists:seq(1, 3000)],
bitcask:delete(Reference, <<"key_to_delete">>),
[ bitcask:put(Reference, term_to_binary(X), <<1:(8 * 1024 * 100)>>) || X <- lists:seq(1, 3000)],
bitcask_merge_worker:merge("data", opts(), ["data/2.bitcask.data"]),
io:format("Sleeping...\n"),
timer:sleep(7*1000),
io:format("\nIf you see 'Merged' INFO REPORT, run this script with '2' arg\n");
main(["2"]) ->
Reference = bitcask:open("data", [read_write | opts()]),
io:format("Read zombie: ~p\n", [bitcask:get(Reference, <<"key_to_delete">>)]).

opts() ->
[{max_file_size, 268435456},
{dead_bytes_threshold, 89478485},
{dead_bytes_merge_trigger, 178956970}].


Reply to this email directly or view it on GitHubhttps://github.com//issues/82#issuecomment-14814640
.

from bitcask.

slfritchie avatar slfritchie commented on August 17, 2024

Possible fixes are brewing in https://github.com/basho/bitcask/compare/slf-merge-panopticon. Sorry about the delay, this is a thorny problem full of race conditions with merge operations, unfortunately. No guarantee yet about when this code might be ready.

from bitcask.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.