Skip to content

Conversation

@klementtan
Copy link
Contributor

@klementtan klementtan commented May 31, 2022

Currently, leveldb background thread does not have a thread name and as a result, an empty thread name is logged.

This PR fixes this by logging thread name as "unknown" if the thread name is empty

On master:

2022-06-02T14:30:38Z [] [leveldb:debug] Generated table #281@0: 1862 keys, 138303 bytes

On this PR:

2022-06-02T14:30:38Z [unknown] [leveldb:debug] Generated table #281@0: 1862 keys, 138303 bytes

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure what would be a good way to do this, but we shouldn't make changes to upstream leveldb here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, remove the commit that modifies leveldb.

@jonatack
Copy link
Member

jonatack commented May 31, 2022

@klementtan do you wish to add the configuration option and logging RPC option to change the default log severity level? I haven't done that yet in #25203 and have been moving forward on the basis that the default level will be info.

@klementtan klementtan force-pushed the add_leveldb_threadname branch from a97de2c to 398d78b Compare May 31, 2022 17:17
@klementtan klementtan changed the title logging: Add leveldb thread name and fix logging empty thread name logging: fix logging empty thread name May 31, 2022
@klementtan
Copy link
Contributor Author

@klementtan do you wish to add the configuration option and logging RPC option to change the default log severity level?

@jonatack my apologies for the delay. I was busy these few days and am planning to make a PR for it by this weekend.

have been moving forward on the basis that the default level will be info.

Yes, I am planning on setting the minimum log level to Info.

@hebasto
Copy link
Member

hebasto commented May 31, 2022

On master:

2022-05-31T15:44:41Z [] [leveldb:debug] Generated table #223@0: 18859 keys, 1502400 bytes

On this PR:

2022-05-31T17:16:16Z [leveldb:debug] Generated table #268@1: 27047 keys, 2150932 bytes

Concept ~0.

The example above creates a false view as if leveldb's thread has name "leveldb:debug".

@laanwj
Copy link
Member

laanwj commented Jun 1, 2022

The example above creates a false view as if leveldb's thread has name "leveldb:debug".

I agree, this makes parsing more of a hassle. Maybe we can log something like [unknown] or [-] for unknown thread names?

Edit: alternatively, log the thread id instead, but this may be platform specific hassle.

@maflcko maflcko removed the Upstream label Jun 1, 2022
@klementtan klementtan force-pushed the add_leveldb_threadname branch from 398d78b to 3a171f7 Compare June 2, 2022 14:31
@klementtan
Copy link
Contributor Author

@hebasto @laanwj Thanks for the feedback! Updated the PR to log thread name as "unknown" instead.

@laanwj
Copy link
Member

laanwj commented Jun 2, 2022

Code review ACK 3a171f7

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

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

ACK 3a171f7

PR description seems messed about master/PR:

On master:

2022-06-02T14:30:38Z [unknown] [leveldb:debug] Generated table #281@0: 1862 keys, 138303 bytes

On this PR:

2022-05-31T17:16:16Z [leveldb:debug] Generated table #268@1: 27047 keys, 2150932 bytes

and should be updated before merging.

@maflcko maflcko merged commit 2cf8c2c into bitcoin:master Jun 3, 2022
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jun 3, 2022
3a171f7 logging: fix logging empty threadname (klementtan)

Pull request description:

  Currently, `leveldb` background thread does not have a thread name and as a result, an empty thread name is logged.

  This PR fixes this by logging thread name as `"unknown"` if the thread name is empty

  On master:
  ```txt
  2022-06-02T14:30:38Z [] [leveldb:debug] Generated table #281@0: 1862 keys, 138303 bytes
  ```

  On this PR:
  ```txt
  2022-06-02T14:30:38Z [unknown] [leveldb:debug] Generated table #281@0: 1862 keys, 138303 bytes
  ```

ACKs for top commit:
  laanwj:
    Code review ACK 3a171f7
  hebasto:
    ACK 3a171f7

Tree-SHA512: 0af0fa5c4ddd3640c6dab9595fe9d97f74d0e0f4b41287a6630cf8ac5a21240250e0659ec4ac5a561e888d522f5304bf627104de2aba0fd0a86c1222de0897c2
@klementtan klementtan deleted the add_leveldb_threadname branch June 23, 2022 16:20
@bitcoin bitcoin locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants