Skip to content

Commit

Permalink
restrict shard_key_auto_discovery event to str shard keys
Browse files Browse the repository at this point in the history
  • Loading branch information
rsh-yam authored Dec 14, 2023
1 parent cc560d4 commit e3f2fc3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/coordinatorsharding.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,9 @@ func (crd *Coordinator) PreprocessSharding(requests []*netstring.Netstring) (boo
logger.GetLogger().Log(logger.Verbose, fmt.Sprintf("shard info auto discovery: key_name=%s, num_values=%d", GetConfig().ShardKeyName, len(crd.shard.shardValues)))
}

if len(crd.shard.shardValues) > 0 {
if (len(crd.shard.shardValues) > 0) && GetConfig().ShardKeyValueTypeIsString {
// shard_key_auto_discovery
// restricting this event to only String type Shard Keys
evt := cal.NewCalEvent(EvtTypeSharding, EvtNameShardKeyAutodisc, cal.TransOK, "")
evt.AddDataStr("shardkey", GetConfig().ShardKeyName+"|"+crd.shard.shardValues[0])
evt.AddDataInt("shardid", int64(crd.shard.shardID))
Expand Down

0 comments on commit e3f2fc3

Please sign in to comment.