-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add LRU for view groups #477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4fa9b4a
8a46404
231f4ba
0b9a6b8
9d42a6c
adc7b34
2f7dd4d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| %% Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
| %% use this file except in compliance with the License. You may obtain a copy of | ||
| %% the License at | ||
| %% | ||
| %% http://www.apache.org/licenses/LICENSE-2.0 | ||
| %% | ||
| %% Unless required by applicable law or agreed to in writing, software | ||
| %% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| %% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| %% License for the specific language governing permissions and limitations under | ||
| %% the License. | ||
|
|
||
| % Style guide for descriptions: Start with a lowercase letter & do not add | ||
| % a trailing full-stop / period | ||
| % Please keep this in alphabetical order | ||
|
|
||
| {[couchdb, couch_index_server, lru_skip], [ | ||
| {type, counter}, | ||
| {desc, <<"number of couch_index_server LRU operations skipped">>} | ||
| ]}. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -64,12 +64,14 @@ handle_call({compact, _}, _From, #st{pid=Pid}=State) when is_pid(Pid) -> | |
| {reply, {ok, Pid}, State}; | ||
| handle_call({compact, IdxState}, _From, #st{idx=Idx}=State) -> | ||
| Pid = spawn_link(fun() -> compact(Idx, State#st.mod, IdxState) end), | ||
| ok = couch_index_server:set_compacting(Idx, true), | ||
| {reply, {ok, Pid}, State#st{pid=Pid}}; | ||
| handle_call(cancel, _From, #st{pid=undefined}=State) -> | ||
| {reply, ok, State}; | ||
| handle_call(cancel, _From, #st{pid=Pid}=State) -> | ||
| unlink(Pid), | ||
| exit(Pid, kill), | ||
| ok = couch_index_server:set_compacting(State#st.idx, false), | ||
| {reply, ok, State#st{pid=undefined}}; | ||
| handle_call(get_compacting_pid, _From, #st{pid=Pid}=State) -> | ||
| {reply, {ok, Pid}, State}; | ||
|
|
@@ -84,6 +86,7 @@ handle_cast(_Mesg, State) -> | |
|
|
||
|
|
||
| handle_info({'EXIT', Pid, normal}, #st{pid=Pid}=State) -> | ||
| ok = couch_index_server:set_compacting(State#st.idx, false), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we also need to add the above line to this clause? clause?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Edit: This needs to be rebased onto master. Once that happens, this'll no longer be a problem. That clause is related to a bug that was fixed. |
||
| {noreply, State#st{pid=undefined}}; | ||
| handle_info({'EXIT', Pid, Reason}, #st{pid = Pid} = State) -> | ||
| #st{idx = Idx, mod = Mod} = State, | ||
|
|
@@ -92,11 +95,10 @@ handle_info({'EXIT', Pid, Reason}, #st{pid = Pid} = State) -> | |
| IdxName = Mod:get(idx_name, IdxState), | ||
| Args = [DbName, IdxName, Reason], | ||
| couch_log:error("Compaction failed for db: ~s idx: ~s reason: ~p", Args), | ||
| ok = couch_index_server:set_compacting(State#st.idx, false), | ||
| {noreply, State#st{pid = undefined}}; | ||
| handle_info({'EXIT', _Pid, normal}, State) -> | ||
| {noreply, State}; | ||
| handle_info({'EXIT', Pid, _Reason}, #st{idx=Pid}=State) -> | ||
| {stop, normal, State}; | ||
| handle_info(_Mesg, State) -> | ||
| {stop, unknown_info, State}. | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed we removed
because we're decoupling. Are these deletes moved elsewhere or is it okay to fully remove these two steps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That case is handled above on line 58.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return value of
CloseFunindicates if it should close the DB (or view) and/or stop iterating over the LRU. This change just explicitly pulled those two considerations apart.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wups, I missed it on 58, yup i see it now