forked from milvus-io/milvus
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: watch channel stuck due to misuse of timer.Reset (milvus-io#37433)
issue: milvus-io#37166 cause the misuse of timer.Reset, which cause dispatcher failed to send msg to virtual channel buffer, and dispatcher do splitting again and again, which hold the dispatcher manager's lock, block watching channel progress. This PR fix the misuse of timer.Reset Signed-off-by: Wei Liu <[email protected]>
- Loading branch information
1 parent
60f9631
commit 2dedb93
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package msgdispatcher | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"go.uber.org/zap" | ||
|
||
"github.com/milvus-io/milvus-proto/go-api/v2/msgpb" | ||
"github.com/milvus-io/milvus/pkg/log" | ||
"github.com/milvus-io/milvus/pkg/mq/msgstream" | ||
"github.com/milvus-io/milvus/pkg/util/paramtable" | ||
) | ||
|
||
func TestSendTimeout(t *testing.T) { | ||
target := newTarget("test1", &msgpb.MsgPosition{}) | ||
|
||
time.Sleep(paramtable.Get().MQCfg.MaxTolerantLag.GetAsDuration(time.Second)) | ||
|
||
counter := 0 | ||
for i := 0; i < 10; i++ { | ||
err := target.send(&msgstream.MsgPack{}) | ||
if err != nil { | ||
log.Error("send failed", zap.Int("idx", i), zap.Error(err)) | ||
counter++ | ||
} | ||
} | ||
assert.Equal(t, counter, 0) | ||
} |