2020-09-04 17:52:49 +08:00
|
|
|
package test
|
2020-08-27 11:06:17 +08:00
|
|
|
|
|
|
|
import (
|
2020-11-05 19:11:12 +08:00
|
|
|
//"context"
|
|
|
|
//"sync"
|
2020-09-04 17:52:49 +08:00
|
|
|
"testing"
|
2020-11-03 14:53:36 +08:00
|
|
|
|
2021-04-22 14:45:57 +08:00
|
|
|
"github.com/milvus-io/milvus/internal/util/typeutil"
|
2020-08-27 11:06:17 +08:00
|
|
|
)
|
|
|
|
|
2020-11-04 17:58:43 +08:00
|
|
|
type Timestamp = typeutil.Timestamp
|
|
|
|
|
2020-11-05 19:11:12 +08:00
|
|
|
//func GetInsertMsg(collectionName string, partitionTag string, entityId UniqueID) *msgpb.InsertOrDeleteMsg {
|
|
|
|
// return &msgpb.InsertOrDeleteMsg{
|
|
|
|
// CollectionName: collectionName,
|
|
|
|
// PartitionTag: partitionTag,
|
2020-11-13 15:17:18 +08:00
|
|
|
// SegmentID: UniqueID(entityId / 100),
|
2020-11-05 19:11:12 +08:00
|
|
|
// Uid: UniqueID(entityId),
|
|
|
|
// Timestamp: Timestamp(entityId),
|
|
|
|
// ClientId: 0,
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//func GetDeleteMsg(collectionName string, entityId UniqueID) *msgpb.InsertOrDeleteMsg {
|
|
|
|
// return &msgpb.InsertOrDeleteMsg{
|
|
|
|
// CollectionName: collectionName,
|
|
|
|
// Uid: entityId,
|
|
|
|
// Timestamp: Timestamp(entityId + 100),
|
|
|
|
// }
|
|
|
|
//}
|
2020-08-27 11:06:17 +08:00
|
|
|
|
2020-09-04 17:52:49 +08:00
|
|
|
func TestInsert(t *testing.T) {
|
2020-10-15 21:31:50 +08:00
|
|
|
// TODO: fix test
|
2020-11-11 09:54:01 +08:00
|
|
|
//return
|
2020-11-05 19:11:12 +08:00
|
|
|
//ctx := context.Background()
|
|
|
|
//var topics []string
|
|
|
|
//topics = append(topics, "test")
|
|
|
|
//topics = append(topics, "test1")
|
|
|
|
//writerNode, _ := writer.NewWriteNode(ctx, "null", topics, 0)
|
|
|
|
//var insertMsgs []*msgpb.InsertOrDeleteMsg
|
|
|
|
//for i := 0; i < 120; i++ {
|
|
|
|
// insertMsgs = append(insertMsgs, GetInsertMsg("collection0", "tag01", UniqueID(i)))
|
|
|
|
//}
|
|
|
|
//wg := sync.WaitGroup{}
|
|
|
|
//wg.Add(3)
|
|
|
|
////var wg sync.WaitGroup
|
|
|
|
//writerNode.InsertBatchData(ctx, insertMsgs, &wg)
|
|
|
|
//var insertMsgs2 []*msgpb.InsertOrDeleteMsg
|
|
|
|
//for i := 120; i < 200; i++ {
|
|
|
|
// insertMsgs2 = append(insertMsgs2, GetInsertMsg("collection0", "tag02", UniqueID(i)))
|
|
|
|
//}
|
|
|
|
//writerNode.InsertBatchData(ctx, insertMsgs2, &wg)
|
|
|
|
//var deleteMsgs []*msgpb.InsertOrDeleteMsg
|
|
|
|
//deleteMsgs = append(deleteMsgs, GetDeleteMsg("collection0", 2))
|
|
|
|
//deleteMsgs = append(deleteMsgs, GetDeleteMsg("collection0", 120))
|
|
|
|
//writerNode.DeleteBatchData(ctx, deleteMsgs)
|
2020-08-27 11:06:17 +08:00
|
|
|
}
|