Skip to content

server: don't stop iterating ranges if a range is missing#48681

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
ajwerner:ajwerner/dont-bail-when-a-range-is-missing
May 11, 2020
Merged

server: don't stop iterating ranges if a range is missing#48681
craig[bot] merged 1 commit intocockroachdb:masterfrom
ajwerner:ajwerner/dont-bail-when-a-range-is-missing

Conversation

@ajwerner
Copy link
Copy Markdown
Contributor

In #33585 we added a commit to not return an error when a range is msising
when iterating the set of ranges for the status server. This change seems
to have stopped the iteration of ranges in this case, which I don't believe
was the intention.

This PR is a drive-by, it's not clear when this case happens.

Release note: None

In cockroachdb#33585 we added a commit to not return an error when a range is msising
when iterating the set of ranges for the status server. This change seems
to have stopped the iteration of ranges in this case, which I don't believe
was the intention.

This PR is a drive-by, it's not clear when this case happens.

Release note: None
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@ajwerner ajwerner requested a review from tbg May 11, 2020 16:35
@tbg
Copy link
Copy Markdown
Member

tbg commented May 11, 2020

Ugh, thanks for catching. I'll keep this on my list of things to file as starter project, this api needs to be better

@ajwerner
Copy link
Copy Markdown
Contributor Author

bors r=tbg

@craig
Copy link
Copy Markdown
Contributor

craig Bot commented May 11, 2020

Build succeeded

@craig craig Bot merged commit 57ef61f into cockroachdb:master May 11, 2020
vrongmeal added a commit to vrongmeal/cockroach that referenced this pull request Jul 30, 2020
Previously, all the iterators were implemented using closures
that returned a bool and an error. The behaviour of bool was
dependent on the documentation, i.e., whether it represented
presence of "more" elements or the iteration was "done".

This was prone to errors as evident by fix in cockroachdb#48681.

This change introduces a type that can be commonly used by all
closure based iterators to implement them. Package iterutil
declares State which defines the following listed methods:

 - Cur: returns the current element of the iteration
 - Stop: stops the iteration
 - Done: checks if the iteration is over
 - Update: sets the value of current element

Done and Update methods can be used to create the iterator
whereas the Cur and Stop methods can be used by the closure to
get current element and stop the iteration respectively.

Resolves: cockroachdb#48709

Release note: None

Signed-off-by: Vaibhav <vrongmeal@gmail.com>
vrongmeal added a commit to vrongmeal/cockroach that referenced this pull request Aug 2, 2020
Previously, all the iterators were implemented using closures
that returned a bool and an error. The behaviour of bool was
dependent on the documentation, i.e., whether it represented
presence of "more" elements or the iteration was "done".

This was prone to errors as evident by fix in cockroachdb#48681.

This change introduces a type that can be commonly used by all
closure based iterators to implement them. Package iterutil
declares State which defines the following listed methods:

 - Cur: returns the current element of the iteration
 - Done: checks if the iteration is over
 - Update: sets the value of current element

Now, closures can take the "cur" as a parameter to get the current
element. Cur returns a wrapper which can be used to access the
element associated with the state of iteration and the index.
This "cur" can also be used to stop the iteration using Stop method.

Resolves: cockroachdb#48709

Release note: None

Signed-off-by: Vaibhav <vrongmeal@gmail.com>
vrongmeal added a commit to vrongmeal/cockroach that referenced this pull request Aug 2, 2020
Resolves: cockroachdb#48681

Release note: None

Signed-off-by: Vaibhav <vrongmeal@gmail.com>
vrongmeal added a commit to vrongmeal/cockroach that referenced this pull request Aug 5, 2020
Previously, all the iterators were implemented using closures
that returned a bool and an error. The behaviour of bool was
dependent on the documentation, i.e., whether it represented
presence of "more" elements or the iteration was "done".

This was prone to errors as evident by fix in cockroachdb#48681.

This change introduces a type that can be commonly used by all
closure based iterators to implement them. Package iterutil
declares State which defines the following listed methods:

 - Current: returns the current element of the iteration
 - Done: checks if the iteration is over

Now, closures can take the "cur" as a parameter to get the current
element. Cur returns a wrapper which can be used to access the
element associated with the state of iteration and the index.
This "cur" can also be used to stop the iteration using Stop method.

Resolves: cockroachdb#48709

Release note: None

Signed-off-by: Vaibhav <vrongmeal@gmail.com>
vrongmeal added a commit to vrongmeal/cockroach that referenced this pull request Aug 5, 2020
Resolves: cockroachdb#48681

Release note: None

Signed-off-by: Vaibhav <vrongmeal@gmail.com>
tbg pushed a commit to vrongmeal/cockroach that referenced this pull request Aug 6, 2020
Previously, all the iterators were implemented using closures
that returned a bool and an error. The behaviour of bool was
dependent on the documentation, i.e., whether it represented
presence of "more" elements or the iteration was "done".

This was prone to errors as evident by fix in cockroachdb#48681.

This change introduces a type that can be commonly used by all
closure based iterators to implement them. Package iterutil
declares State which defines the following listed methods:

 - Current: returns the current element of the iteration
 - Done: checks if the iteration is over

Now, closures can take the "cur" as a parameter to get the current
element. Cur returns a wrapper which can be used to access the
element associated with the state of iteration and the index.
This "cur" can also be used to stop the iteration using Stop method.

Resolves: cockroachdb#48709

Release note: None

Signed-off-by: Vaibhav <vrongmeal@gmail.com>
tbg pushed a commit to vrongmeal/cockroach that referenced this pull request Aug 6, 2020
Resolves: cockroachdb#48681

Release note: None

Signed-off-by: Vaibhav <vrongmeal@gmail.com>
craig Bot pushed a commit that referenced this pull request Aug 6, 2020
52158: util: add iterutil to create consistent iterators r=tbg a=vrongmeal

Previously, all the iterators were implemented using closures that returned a bool and an error. The behaviour of bool was dependent on the documentation, i.e., whether it represented presence of "more" elements or the iteration was "done".

This was prone to errors as evident by fix in #48681.

This change introduces a type that can be commonly used by all closure based iterators to implement them. Package iterutil declares State which defines the following listed methods:

 - Current: returns the current element of the iteration
 - Done: checks if the iteration is over

Now, closures can take the "cur" as a parameter to get the current element. Cur returns a wrapper which can be used to access the element associated with the state of iteration and the index. This "cur" can also be used to stop the iteration using Stop method.

Resolves: #48709

Release note: None

Signed-off-by: Vaibhav <vrongmeal@gmail.com>

52439: backupccl: fix race on RESTORE's summary r=pbardea a=pbardea

When RESTORE would return its bulk op summary, there would be a race
between returning the results in the error case and writing the bulk op
summary in the progress loop. We don't need to return the most
up-to-date results since we discard them anyway.

Fixes #52390.

Release note: None

Co-authored-by: Vaibhav <vrongmeal@gmail.com>
Co-authored-by: Paul Bardea <pbardea@gmail.com>
vrongmeal added a commit to vrongmeal/cockroach that referenced this pull request Aug 20, 2020
Closure based iterators returned two values: a bool and an error.
This was heavily documentation based whether the boolean meant
"more" or "done". This was prone to errors as evident by cockroachdb#48681.

This commit introduces a sentinel error, which means that the
iteration should stop if ErrStopIteration is returned.

Resolves: cockroachdb#48709

Release note: None

Signed-off-by: Vaibhav <vrongmeal@gmail.com>
vrongmeal added a commit to vrongmeal/cockroach that referenced this pull request Aug 30, 2020
Closure based iterators returned two values: a bool and an error.
This was heavily documentation based whether the boolean meant
"more" or "done". This was prone to errors as evident by cockroachdb#48681.

This commit introduces a sentinel error, which means that the
iteration should stop if errStopIteration is returned.

Resolves: cockroachdb#48709

Release note: None

Signed-off-by: Vaibhav <vrongmeal@gmail.com>
tbg pushed a commit to vrongmeal/cockroach that referenced this pull request Oct 7, 2020
Closure based iterators returned two values: a bool and an error.
This was heavily documentation based whether the boolean meant
"more" or "done". This was prone to errors as evident by cockroachdb#48681.

This commit introduces a sentinel error, which means that the
iteration should stop if errStopIteration is returned.

Resolves: cockroachdb#48709

Release note: None

Signed-off-by: Vaibhav <vrongmeal@gmail.com>
jayshrivastava pushed a commit that referenced this pull request Oct 8, 2020
Closure based iterators returned two values: a bool and an error.
This was heavily documentation based whether the boolean meant
"more" or "done". This was prone to errors as evident by #48681.

This commit introduces a sentinel error, which means that the
iteration should stop if errStopIteration is returned.

Resolves: #48709

Release note: None

Signed-off-by: Vaibhav <vrongmeal@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants