Skip to content

Commit

Permalink
correction of comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Moguchev Leonid Alekseevich committed Apr 14, 2024
1 parent 2376551 commit c41d4d3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions scylla_shard_aware_extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type ShardAwareRoutingInfo struct {
// The driver may not always receive routing information and this is normal.
// In this case, the function will return an error and your application needs to process it normally.
//
// Exampple for SELECT WHERE IN:
// Example for SELECT WHERE IN:
/*
const shardsAbout = 100 // node * (cpu-1)
Expand Down Expand Up @@ -143,18 +143,18 @@ func (s *Session) GetShardAwareRoutingInfo(table string, colums []string, values
var hosts []*HostInfo
if ht := tokenMetadata.replicas[keyspace].replicasFor(mm3token); ht != nil {
hosts = make([]*HostInfo, len(ht.hosts))
copy(hosts, ht.hosts) // будем далее сортировать
copy(hosts, ht.hosts) // need copy because of later we will sort hosts
} else {
host, _ := tokenMetadata.tokenRing.GetHostForToken(mm3token)
hosts = []*HostInfo{host}
}

getHostTier := func(h *HostInfo) uint {
if tierer, tiererOk := tokenAwarePolicy.fallback.(HostTierer); tiererOk { // ex. RackAware
if tierer, tiererOk := tokenAwarePolicy.fallback.(HostTierer); tiererOk { // e.g. RackAware
return tierer.HostTier(h)
} else if tokenAwarePolicy.fallback.IsLocal(h) { // ex. DCAware
} else if tokenAwarePolicy.fallback.IsLocal(h) { // e.g. DCAware
return 0
} else { // ex. RoundRobin
} else { // e.g. RoundRobin
return 1
}
}
Expand Down
8 changes: 4 additions & 4 deletions scylla_shard_aware_extension_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestSession_GetShardAwareRoutingInfo_Integration(t *testing.T) {

session, err := cluster.CreateSession()
if err != nil {
t.Fatalf("failed to create tsesion '%v'", err)
t.Fatalf("failed to create session '%v'", err)
}
defer session.Close()

Expand All @@ -34,7 +34,7 @@ func TestSession_GetShardAwareRoutingInfo_Integration(t *testing.T) {

err = createTable(session, fmt.Sprintf(`CREATE KEYSPACE %s
WITH replication = {
'class' : 'SimpleStrategy',
'class': 'NetworkTopologyStrategy',
'replication_factor' : %d
}`, keyspace, *flagRF))

Expand All @@ -50,7 +50,7 @@ func TestSession_GetShardAwareRoutingInfo_Integration(t *testing.T) {

session, err := cluster.CreateSession()
if err != nil {
t.Fatalf("failed to create tsesion '%v'", err)
t.Fatalf("failed to create session '%v'", err)
}

info, err := session.GetShardAwareRoutingInfo(table, []string{"first_id", "second_id", "third_id"}, 1, 2, 3)
Expand All @@ -62,7 +62,7 @@ func TestSession_GetShardAwareRoutingInfo_Integration(t *testing.T) {
t.Fatal("empty host info")
}

// для составного ключа PK ключа (1,2)
// composite key PC key (1,2)
var (
mask = []byte{0, 4}
delim = byte(0)
Expand Down

0 comments on commit c41d4d3

Please sign in to comment.