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

Make slogger use current class #3994

Merged

Conversation

hangc0276
Copy link
Contributor

Motivation

We use Slogger to support DirectIO Entrylogger and create the slogger instance in DbLedgerStorage and passed down to DirectIOEntrylogger. However, in the subclasses, we generate a new Slogger instance without setting the context, which leads to the Slogger instance belonging to DbLedgerStorage or Slf4j. The broker logs are as follows.

2023-06-19T15:21:56,518+0800 [main] INFO  org.apache.bookkeeper.bookie.storage.ldb.DbLedgerStorage - ENTRYLOG_IDS_CANDIDATES_SELECTED
2023-06-19T15:21:56,561+0800 [main] INFO  org.apache.bookkeeper.slogger.slf4j.Slf4jSlogger {directory=data/bookkeeper/ledgers/current, event=ENTRYLOGGER_CREATED, maxCachedReaders=32, maxCachedReadersPerThread=4, maxFileSize=1073741824, maxSaneEntrySize=5252620, perThreadBufferSize=33554432, readBufferSize=8388608, singleWriteBufferSize=33554432, totalReadBufferSize=268435456, totalWriteBufferSize=268435456} - ENTRYLOGGER_CREATED

Without the specific slogger instance name, it will be hard to configure a specific class to enable KV logger configuration.

Modification

Set the specific class context for each subclass slogger instance.
After this change, the broker logs are as follows.

2023-06-19T16:01:56,685+0800 [main] INFO  org.apache.bookkeeper.bookie.storage.directentrylogger.EntryLogIdsImpl {dirs=[data/bookkeeper/ledgers/current], durationMs=0, event=ENTRYLOG_IDS_CANDIDATES_SELECTED, maxId=21474836
47, nextId=0} - ENTRYLOG_IDS_CANDIDATES_SELECTED
2023-06-19T16:01:56,721+0800 [main] INFO  org.apache.bookkeeper.bookie.storage.directentrylogger.DirectEntryLogger {directory=data/bookkeeper/ledgers/current, event=ENTRYLOGGER_CREATED, maxCachedReaders=32, maxCachedReader
sPerThread=4, maxFileSize=1073741824, maxSaneEntrySize=5252620, perThreadBufferSize=33554432, readBufferSize=8388608, singleWriteBufferSize=33554432, totalReadBufferSize=268435456, totalWriteBufferSize=268435456} - ENTRYLO
GGER_CREATED

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

+1

@zymap zymap merged commit 8085f66 into apache:master Jun 20, 2023
zymap pushed a commit that referenced this pull request Jun 20, 2023
### Motivation
We use Slogger to support DirectIO Entrylogger and create the slogger instance in DbLedgerStorage and passed down to DirectIOEntrylogger. However, in the subclasses, we generate a new Slogger instance without setting the context, which leads to the Slogger instance belonging to DbLedgerStorage or Slf4j. The broker logs are as follows.
```
2023-06-19T15:21:56,518+0800 [main] INFO  org.apache.bookkeeper.bookie.storage.ldb.DbLedgerStorage - ENTRYLOG_IDS_CANDIDATES_SELECTED
2023-06-19T15:21:56,561+0800 [main] INFO  org.apache.bookkeeper.slogger.slf4j.Slf4jSlogger {directory=data/bookkeeper/ledgers/current, event=ENTRYLOGGER_CREATED, maxCachedReaders=32, maxCachedReadersPerThread=4, maxFileSize=1073741824, maxSaneEntrySize=5252620, perThreadBufferSize=33554432, readBufferSize=8388608, singleWriteBufferSize=33554432, totalReadBufferSize=268435456, totalWriteBufferSize=268435456} - ENTRYLOGGER_CREATED
```

Without the specific slogger instance name, it will be hard to configure a specific class to enable KV logger configuration.

### Modification
Set the specific class context for each subclass slogger instance.
After this change, the broker logs are as follows.
```
2023-06-19T16:01:56,685+0800 [main] INFO  org.apache.bookkeeper.bookie.storage.directentrylogger.EntryLogIdsImpl {dirs=[data/bookkeeper/ledgers/current], durationMs=0, event=ENTRYLOG_IDS_CANDIDATES_SELECTED, maxId=21474836
47, nextId=0} - ENTRYLOG_IDS_CANDIDATES_SELECTED
2023-06-19T16:01:56,721+0800 [main] INFO  org.apache.bookkeeper.bookie.storage.directentrylogger.DirectEntryLogger {directory=data/bookkeeper/ledgers/current, event=ENTRYLOGGER_CREATED, maxCachedReaders=32, maxCachedReader
sPerThread=4, maxFileSize=1073741824, maxSaneEntrySize=5252620, perThreadBufferSize=33554432, readBufferSize=8388608, singleWriteBufferSize=33554432, totalReadBufferSize=268435456, totalWriteBufferSize=268435456} - ENTRYLO
GGER_CREATED
```

(cherry picked from commit 8085f66)
Ghatage pushed a commit to sijie/bookkeeper that referenced this pull request Jul 12, 2024
### Motivation
We use Slogger to support DirectIO Entrylogger and create the slogger instance in DbLedgerStorage and passed down to DirectIOEntrylogger. However, in the subclasses, we generate a new Slogger instance without setting the context, which leads to the Slogger instance belonging to DbLedgerStorage or Slf4j. The broker logs are as follows.
```
2023-06-19T15:21:56,518+0800 [main] INFO  org.apache.bookkeeper.bookie.storage.ldb.DbLedgerStorage - ENTRYLOG_IDS_CANDIDATES_SELECTED
2023-06-19T15:21:56,561+0800 [main] INFO  org.apache.bookkeeper.slogger.slf4j.Slf4jSlogger {directory=data/bookkeeper/ledgers/current, event=ENTRYLOGGER_CREATED, maxCachedReaders=32, maxCachedReadersPerThread=4, maxFileSize=1073741824, maxSaneEntrySize=5252620, perThreadBufferSize=33554432, readBufferSize=8388608, singleWriteBufferSize=33554432, totalReadBufferSize=268435456, totalWriteBufferSize=268435456} - ENTRYLOGGER_CREATED
```

Without the specific slogger instance name, it will be hard to configure a specific class to enable KV logger configuration.

### Modification
Set the specific class context for each subclass slogger instance.
After this change, the broker logs are as follows.
```
2023-06-19T16:01:56,685+0800 [main] INFO  org.apache.bookkeeper.bookie.storage.directentrylogger.EntryLogIdsImpl {dirs=[data/bookkeeper/ledgers/current], durationMs=0, event=ENTRYLOG_IDS_CANDIDATES_SELECTED, maxId=21474836
47, nextId=0} - ENTRYLOG_IDS_CANDIDATES_SELECTED
2023-06-19T16:01:56,721+0800 [main] INFO  org.apache.bookkeeper.bookie.storage.directentrylogger.DirectEntryLogger {directory=data/bookkeeper/ledgers/current, event=ENTRYLOGGER_CREATED, maxCachedReaders=32, maxCachedReader
sPerThread=4, maxFileSize=1073741824, maxSaneEntrySize=5252620, perThreadBufferSize=33554432, readBufferSize=8388608, singleWriteBufferSize=33554432, totalReadBufferSize=268435456, totalWriteBufferSize=268435456} - ENTRYLO
GGER_CREATED
```
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.

3 participants