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

chore(ae): add more logging #21381

Merged
merged 6 commits into from
May 7, 2021
Merged

chore(ae): add more logging #21381

merged 6 commits into from
May 7, 2021

Conversation

davidby-influx
Copy link
Contributor

@davidby-influx davidby-influx commented May 5, 2021

tsdb.Engine.IsIdle and tsdb.Engine.Digest now return a reason string for why the engine & shard are not idle.
Callers can then use this string for logging, if desired. The returned reason does not allocate memory, so the
caller may want to add the shard ID and path for more information in the log. This is intended to be used in
calls from the anti-entropy service in Enterprise.

Closes #21380

tsdb.Engine.IsIdle and tsdb.Shard.Digest now take a boolean parameter, isLogged.
If this is true, the engine will use trace-logging and report which checks are
causing the engine not to be idle.  tsdb.Shard exposes a funcion LoggedIsIdle()
which calls tsdb.Engine.IsIdle(true).  This is only used in calls from the
anti-entropy service in Enterprise.
Copy link
Contributor

@danxmoran danxmoran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main logic makes sense to me, some nitpicky questions

tsdb/engine/tsm1/engine.go Outdated Show resolved Hide resolved
tsdb/engine/tsm1/engine.go Outdated Show resolved Hide resolved
tsdb/shard.go Outdated Show resolved Hide resolved
tsdb/engine.go Outdated Show resolved Hide resolved
@davidby-influx davidby-influx marked this pull request as draft May 6, 2021 00:16
@davidby-influx davidby-influx marked this pull request as ready for review May 7, 2021 18:48
Co-authored-by: David Norton <dgnorton@gmail.com>
danxmoran
danxmoran previously approved these changes May 7, 2021
Copy link
Contributor

@danxmoran danxmoran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small suggestions but LGTM overall

flux/control/controller_test.go Show resolved Hide resolved
tsdb/shard.go Outdated
}

// Make sure the shard is idle/cold. (No use creating a digest of a
// hot shard that is rapidly changing.)
if !engine.IsIdle() {
return nil, 0, ErrShardNotIdle
if state, reason := engine.IsIdle(); !state {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if state, reason := engine.IsIdle(); !state {
if isIdle, reason := engine.IsIdle(); !isIdle {

Easier for me to understand, the current way took my brain a bit to process

@davidby-influx davidby-influx merged commit bf45841 into 1.8 May 7, 2021
@davidby-influx davidby-influx deleted the DSB_ae_logging branch May 7, 2021 19:56
@davidby-influx davidby-influx linked an issue May 10, 2021 that may be closed by this pull request
davidby-influx added a commit that referenced this pull request May 10, 2021
tsdb.Engine.IsIdle and tsdb.Engine.Digest now return a reason string for why the engine & shard are not idle.
Callers can then use this string for logging, if desired. The returned reason does not allocate memory, so the
caller may want to add the shard ID and path for more information in the log. This is intended to be used in
calls from the anti-entropy service in Enterprise.

(cherry picked from commit bf45841)
davidby-influx added a commit that referenced this pull request May 11, 2021
tsdb.Engine.IsIdle and tsdb.Engine.Digest now return a reason string for why the engine & shard are not idle.
Callers can then use this string for logging, if desired. The returned reason does not allocate memory, so the
caller may want to add the shard ID and path for more information in the log. This is intended to be used in
calls from the anti-entropy service in Enterprise.

(cherry picked from commit bf45841)

fixes #21448
davidby-influx added a commit that referenced this pull request May 17, 2021
tsdb.Engine.IsIdle and tsdb.Engine.Digest now return a
reason string for why the engine & shard are not idle.
Callers can then use this string for logging, if desired.
The returned reason does not allocate memory, so the
caller may want to add the shard ID and path for more
information in the log. This is intended to be used in
calls from the anti-entropy service in Enterprise.

(cherry picked from commit bf45841)

Fixes #21449
davidby-influx added a commit that referenced this pull request May 17, 2021
tsdb.Engine.IsIdle and tsdb.Engine.Digest now return a
reason string for why the engine & shard are not idle.
Callers can then use this string for logging, if desired.
The returned reason does not allocate memory, so the
caller may want to add the shard ID and path for more
information in the log. This is intended to be used in
calls from the anti-entropy service in Enterprise.

(cherry picked from commit bf45841)

Fixes #21449
davidby-influx added a commit that referenced this pull request Jul 20, 2021
tsdb.Engine.IsIdle and tsdb.Engine.Digest now return a reason string for why the engine & shard are not idle.
Callers can then use this string for logging, if desired. The returned reason does not allocate memory, so the
caller may want to add the shard ID and path for more information in the log. This is intended to be used in
calls from the anti-entropy service in Enterprise.

(cherry picked from commit bf45841)

fixes #21448

(cherry picked from commit c8da9ba)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add optional Engine.IsIdle() trace logging
3 participants