Skip to content
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

lock boltdb and tsdb index while queries are in process #7367

Merged
merged 1 commit into from
Oct 7, 2022

Conversation

sandeepsukhani
Copy link
Contributor

What this PR does / why we need it:
We noticed ingesters and index-gateways panicking when using tsdb as an index store with the latest build. This is caused by closing mmap while the index queries are still being processed. This PR takes care of it by locking the index until we are done querying the index.

Checklist

  • Tests updated

@sandeepsukhani sandeepsukhani requested a review from a team as a code owner October 7, 2022 12:52
@grafanabot
Copy link
Collaborator

./tools/diff_coverage.sh ../loki-main/test_results.txt test_results.txt ingester,distributor,querier,querier/queryrange,iter,storage,chunkenc,logql,loki

Change in test coverage per package. Green indicates 0 or positive change, red indicates that test coverage for a package fell.

+           ingester	0%
+        distributor	0%
+            querier	0%
+ querier/queryrange	0%
+               iter	0%
+            storage	0%
+           chunkenc	0%
+              logql	0%
+               loki	0%

@owen-d owen-d merged commit bbe6880 into grafana:main Oct 7, 2022
sandeepsukhani added a commit that referenced this pull request Oct 11, 2022
…nd boltdb shipper (#7381)

**What this PR does / why we need it**:
In PR #7367, I was relying on cancellation of context to detect if the
index read operation has finished or not, but it is error prone since a
cancelled or timed-out query could cancel the context while we are still
reading the index. Since `tsdb` doesn't can't check the context for each
read operation, we could still panic in this scenario. I am adding a
channel where the consumer of the index would explicitly signal the
completion of the read operation to the `indexshipper`

**Checklist**
- [x] Tests updated
owen-d added a commit to owen-d/loki that referenced this pull request Oct 20, 2022
owen-d added a commit to owen-d/loki that referenced this pull request Oct 21, 2022
owen-d added a commit to owen-d/loki that referenced this pull request Oct 28, 2022
lxwzy pushed a commit to lxwzy/loki that referenced this pull request Nov 7, 2022
**What this PR does / why we need it**:
We noticed ingesters and index-gateways panicking when using `tsdb` as
an index store with the latest build. This is caused by closing `mmap`
while the index queries are still being processed. This PR takes care of
it by locking the index until we are done querying the index.

**Checklist**
- [x] Tests updated
lxwzy pushed a commit to lxwzy/loki that referenced this pull request Nov 7, 2022
…nd boltdb shipper (grafana#7381)

**What this PR does / why we need it**:
In PR grafana#7367, I was relying on cancellation of context to detect if the
index read operation has finished or not, but it is error prone since a
cancelled or timed-out query could cancel the context while we are still
reading the index. Since `tsdb` doesn't can't check the context for each
read operation, we could still panic in this scenario. I am adding a
channel where the consumer of the index would explicitly signal the
completion of the read operation to the `indexshipper`

**Checklist**
- [x] Tests updated
changhyuni pushed a commit to changhyuni/loki that referenced this pull request Nov 8, 2022
**What this PR does / why we need it**:
We noticed ingesters and index-gateways panicking when using `tsdb` as
an index store with the latest build. This is caused by closing `mmap`
while the index queries are still being processed. This PR takes care of
it by locking the index until we are done querying the index.

**Checklist**
- [x] Tests updated
changhyuni pushed a commit to changhyuni/loki that referenced this pull request Nov 8, 2022
…nd boltdb shipper (grafana#7381)

**What this PR does / why we need it**:
In PR grafana#7367, I was relying on cancellation of context to detect if the
index read operation has finished or not, but it is error prone since a
cancelled or timed-out query could cancel the context while we are still
reading the index. Since `tsdb` doesn't can't check the context for each
read operation, we could still panic in this scenario. I am adding a
channel where the consumer of the index would explicitly signal the
completion of the read operation to the `indexshipper`

**Checklist**
- [x] Tests updated
Abuelodelanada pushed a commit to canonical/loki that referenced this pull request Dec 1, 2022
**What this PR does / why we need it**:
We noticed ingesters and index-gateways panicking when using `tsdb` as
an index store with the latest build. This is caused by closing `mmap`
while the index queries are still being processed. This PR takes care of
it by locking the index until we are done querying the index.

**Checklist**
- [x] Tests updated
Abuelodelanada pushed a commit to canonical/loki that referenced this pull request Dec 1, 2022
…nd boltdb shipper (grafana#7381)

**What this PR does / why we need it**:
In PR grafana#7367, I was relying on cancellation of context to detect if the
index read operation has finished or not, but it is error prone since a
cancelled or timed-out query could cancel the context while we are still
reading the index. Since `tsdb` doesn't can't check the context for each
read operation, we could still panic in this scenario. I am adding a
channel where the consumer of the index would explicitly signal the
completion of the read operation to the `indexshipper`

**Checklist**
- [x] Tests updated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants