mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 17:18:35 +08:00
issue: #43897, #44123 pr: #45266 also pick pr: #45237, #45264,#45244,#45275 fix: kafka should auto reset the offset from earliest to read (#45237) issue: #44172, #45210, #44851,#45244 kafka will auto reset the offset to "latest" if the offset is Out-of-range. the recovery of milvus wal cannot read any message from that. So once the offset is out-of-range, kafka should read from eariest to read the latest uncleared data. https://kafka.apache.org/documentation/#consumerconfigs_auto.offset.reset enhance: support alter collection/database with WAL-based DDL framework (#45266) issue: #43897 - Alter collection/database is implemented by WAL-based DDL framework now. - Support AlterCollection/AlterDatabase in wal now. - Alter operation can be synced by new CDC now. - Refactor some UT for alter DDL. fix: milvus role cannot stop at initializing state (#45244) issue: #45243 fix: support upgrading from 2.6.x -> 2.6.5 (#45264) issue: #43897 --------- Signed-off-by: chyezh <chyezh@outlook.com>
52 lines
1.1 KiB
Go
52 lines
1.1 KiB
Go
package common
|
|
|
|
import (
|
|
"reflect"
|
|
|
|
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
|
|
)
|
|
|
|
type KeyValuePairs []*commonpb.KeyValuePair
|
|
|
|
func (pairs KeyValuePairs) Clone() KeyValuePairs {
|
|
if pairs == nil {
|
|
return nil
|
|
}
|
|
clone := make(KeyValuePairs, 0, len(pairs))
|
|
for _, pair := range pairs {
|
|
clone = append(clone, &commonpb.KeyValuePair{
|
|
Key: pair.GetKey(),
|
|
Value: pair.GetValue(),
|
|
})
|
|
}
|
|
return clone
|
|
}
|
|
|
|
func (pairs KeyValuePairs) ToMap() map[string]string {
|
|
ret := make(map[string]string)
|
|
for _, pair := range pairs {
|
|
ret[pair.GetKey()] = pair.GetValue()
|
|
}
|
|
return ret
|
|
}
|
|
|
|
func (pairs KeyValuePairs) Equal(other KeyValuePairs) bool {
|
|
return reflect.DeepEqual(pairs.ToMap(), other.ToMap())
|
|
}
|
|
|
|
func CloneKeyValuePairs(pairs KeyValuePairs) KeyValuePairs {
|
|
return pairs.Clone()
|
|
}
|
|
|
|
// NewKeyValuePairs creates a new KeyValuePairs from a map[string]string.
|
|
func NewKeyValuePairs(kvs map[string]string) KeyValuePairs {
|
|
pairs := make(KeyValuePairs, 0, len(kvs))
|
|
for key, value := range kvs {
|
|
pairs = append(pairs, &commonpb.KeyValuePair{
|
|
Key: key,
|
|
Value: value,
|
|
})
|
|
}
|
|
return pairs
|
|
}
|