diff options
author | Russell Branca <chewbranca@apache.org> | 2021-09-22 16:09:05 -0700 |
---|---|---|
committer | Russell Branca <chewbranca@apache.org> | 2021-09-22 16:09:05 -0700 |
commit | 01305b518dda09330e924e29ab4c37b983033173 (patch) | |
tree | fab543170342cb298f2bd9fd53ee440b70a180a2 | |
parent | 67d6e0ad39fd7f5891b2709fbc2aefecacf4d283 (diff) | |
download | couchdb-01305b518dda09330e924e29ab4c37b983033173.tar.gz |
HACK: enable parallel readers
-rw-r--r-- | src/couch/src/couch_file.erl | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/couch/src/couch_file.erl b/src/couch/src/couch_file.erl index e63b58353..0cfc91ec8 100644 --- a/src/couch/src/couch_file.erl +++ b/src/couch/src/couch_file.erl @@ -82,7 +82,8 @@ open(Filepath, Options, IOQPid0) -> IOQPid0 end, Tab = gen_server:call(Fd, get_cache_ref), - {ok, #ioq_file{fd=Fd, ioq=IOQPid, tab=Tab}}; + ParallelReads = config:get_boolean("couchdb", "couch_file_parallel", false), + {ok, #ioq_file{fd=Fd, ioq=IOQPid, tab=Tab, parallel=ParallelReads}}; ignore -> % get the error receive @@ -198,6 +199,17 @@ pread_binary(Fd, Pos) -> {ok, iolist_to_binary(L)}. +pread_iolist(#ioq_file{parallel=true, fd=File}, Pos) -> + {LenIolist, NextPos} = read_raw_iolist_int(File, Pos, 4), + case iolist_to_binary(LenIolist) of + <<1:1/integer,Len:31/integer>> -> % an MD5-prefixed term + {Md5AndIoList, _} = read_raw_iolist_int(File, NextPos, Len+16), + {Md5, IoList} = extract_md5(Md5AndIoList), + {ok, verify_md5(File, Pos, IoList, Md5)}; + <<0:1/integer,Len:31/integer>> -> + {Iolist, _} = read_raw_iolist_int(File, NextPos, Len), + {ok, Iolist} + end; pread_iolist(Fd, Pos) -> case load_from_cache(Fd, Pos) of {ok, IoList, Md5} -> |