Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Abingcbc committed Sep 12, 2024
1 parent 750f732 commit 8f73fa7
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 165 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ require (
github.com/valyala/fastjson v1.6.3 // indirect
github.com/valyala/fastrand v1.1.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/valyala/gozstd v1.21.1 // indirect
github.com/valyala/gozstd v1.17.0 // indirect
github.com/valyala/histogram v1.2.0 // indirect
github.com/valyala/quicktemplate v1.7.0 // indirect
github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1534,8 +1534,8 @@ github.com/valyala/fastrand v1.1.0 h1:f+5HkLW4rsgzdNoleUOB69hyT9IlD2ZQh9GyDMfb5G
github.com/valyala/fastrand v1.1.0/go.mod h1:HWqCzkrkg6QXT8V2EXWvXCoow7vLwOFN002oeRzjapQ=
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/valyala/gozstd v1.21.1 h1:TQFZVTk5zo7iJcX3o4XYBJujPdO31LFb4fVImwK873A=
github.com/valyala/gozstd v1.21.1/go.mod h1:y5Ew47GLlP37EkTB+B4s7r6A5rdaeB7ftbl9zoYiIPQ=
github.com/valyala/gozstd v1.17.0 h1:M4Ds4MIrw+pD+s6vYtuFZ8D3iEw9htzfdytOV3C3iQU=
github.com/valyala/gozstd v1.17.0/go.mod h1:y5Ew47GLlP37EkTB+B4s7r6A5rdaeB7ftbl9zoYiIPQ=
github.com/valyala/histogram v1.2.0 h1:wyYGAZZt3CpwUiIb9AU/Zbllg1llXyrtApRS815OLoQ=
github.com/valyala/histogram v1.2.0/go.mod h1:Hb4kBwb4UxsaNbbbh+RRz8ZR6pdodR57tzWUS3BUzXY=
github.com/valyala/quicktemplate v1.7.0 h1:LUPTJmlVcb46OOUY3IeD9DojFpAVbsG+5WFTcjMJzCM=
Expand Down
16 changes: 8 additions & 8 deletions plugin_main/plugin_main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ func TestHangConfigWhenStop(t *testing.T) {
// Stop config, it will hang.
Stop(configName, 0)
time.Sleep(time.Second * 2)
// Load again, fail.
// Load again. It will success since independent reload.
time.Sleep(time.Second)
require.Equal(t, 1, LoadConfig("project", "logstore", configName, 0, badConfigStr))
require.Equal(t, 0, LoadConfig("project", "logstore", configName, 0, badConfigStr))

// Notify the config to quit so that it can be enabled again.
close(shutdown)
Expand All @@ -132,9 +132,9 @@ func TestHangConfigWhenStop(t *testing.T) {
// Stop config, hang again.
Stop(configName, 0)
time.Sleep(time.Second * 2)
// Load again, fail.
// Load again. It will success since independent reload.
time.Sleep(time.Second)
require.Equal(t, 1, LoadConfig("project", "logstore", configName, 0, badConfigStr))
require.Equal(t, 0, LoadConfig("project", "logstore", configName, 0, badConfigStr))

// Change config detail so that it can be loaded again.
validConfigStr := fmt.Sprintf(configTemplateJSONStr, 4)
Expand All @@ -146,9 +146,9 @@ func TestHangConfigWhenStop(t *testing.T) {
require.Equal(t, configName, config.ConfigName)

// Quit.
time.Sleep(time.Second)
StopAll(1, 1)
StopAll(1, 0)
time.Sleep(time.Second)
require.Equal(t, 0, pluginmanager.GetLogtailConfigSize())

// Close hanged goroutine.
Expand All @@ -171,10 +171,10 @@ func TestSlowConfigWhenStop(t *testing.T) {

// Stop config, it will hang.
Stop(configName, 0)
// Load again, fail.
// Load again. It will success since independent reload.
time.Sleep(time.Second)
require.Equal(t, 1, LoadConfig("project", "logstore", configName, 0, badConfigStr))
require.Equal(t, 0, pluginmanager.GetLogtailConfigSize())
require.Equal(t, 0, LoadConfig("project", "logstore", configName, 0, badConfigStr))
require.Equal(t, 1, pluginmanager.GetLogtailConfigSize())

// Wait more time, so that the config can finish stopping.
time.Sleep(time.Second * 5)
Expand Down
1 change: 1 addition & 0 deletions pluginmanager/checkpoint_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func (p *checkPointManager) Init() error {
return nil
}
p.shutdown = make(chan struct{}, 1)
p.configCounter = make(map[string]int)
logtailConfigDir := config.LogtailGlobalConfig.LogtailSysConfDir
pathExist, err := util.PathExists(logtailConfigDir)
var dbPath string
Expand Down
1 change: 1 addition & 0 deletions pluginmanager/plugin_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ func StopAll(exitFlag, withInput bool) error {
logger.Error(logstoreConfig.Context.GetRuntimeContext(), "CONFIG_STOP_TIMEOUT_ALARM",
"timeout when stop config, goroutine might leak")
}
LogtailConfig.Delete(key)
} else {
// should never happen
logger.Error(logstoreConfig.Context.GetRuntimeContext(), "CONFIG_STOP_ALARM", "stop config not match withInput", withInput, "configName", key)
Expand Down
154 changes: 0 additions & 154 deletions test/e2e/test_cases/load_same_block_config/case.feature

This file was deleted.

0 comments on commit 8f73fa7

Please sign in to comment.