Skip to content

Commit d52ce16

Browse files
committed
fix: journal buf dir path
1 parent 62f0ab1 commit d52ce16

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

journal.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ type Journal struct {
4747
outChan chan *libs.FluentMsg
4848
commitChan chan *libs.FluentMsg
4949

50-
baseJournalDir string
51-
jjLock *sync.Mutex
52-
tag2JMap, // map[string]*journal.Journal
50+
jjLock *sync.Mutex
51+
tag2JMap, // map[string]*journal.Journal
5352
tag2JJInchanMap, // map[string]chan *libs.FluentMsg
5453
tag2JJCommitChanMap, // map[string]chan *libs.FluentMsg
5554
tag2IDsCounter,
@@ -133,10 +132,10 @@ func (j *Journal) CloseTag(tag string) error {
133132

134133
// initLegacyJJ process existed legacy data and ids
135134
func (j *Journal) initLegacyJJ(ctx context.Context) {
136-
files, err := ioutil.ReadDir(j.baseJournalDir)
135+
files, err := ioutil.ReadDir(j.BufDirPath)
137136
if err != nil {
138137
utils.Logger.Error("try to read dir of journal",
139-
zap.String("directory", j.baseJournalDir),
138+
zap.String("directory", j.BufDirPath),
140139
zap.Error(err))
141140
return
142141
}
@@ -282,12 +281,11 @@ func (j *Journal) createJournalRunner(ctx context.Context, tag string) {
282281

283282
utils.Logger.Info("create new journal.Journal", zap.String("tag", tag))
284283
jj, err := journal.NewJournal(
285-
journal.WithBufDirPath(j.BufDirPath),
284+
journal.WithBufDirPath(filepath.Join(j.BufDirPath, tag)),
286285
journal.WithBufSizeByte(j.BufSizeBytes),
287286
journal.WithIsCompress(j.IsCompress),
288287
journal.WithCommitIDTTL(j.CommittedIDTTL),
289288
journal.WithIsAggresiveGC(false),
290-
journal.WithBufDirPath(filepath.Join(j.baseJournalDir, tag)),
291289
)
292290
if err != nil {
293291
utils.Logger.Panic("new journal", zap.Error(err))

0 commit comments

Comments
 (0)