Skip to content
Permalink
Browse files

Merge pull request #6 from spolitov/token_map

Skip rebulding token map when it is not required by balancing policy
  • Loading branch information...
spolitov committed Jun 1, 2019
2 parents 1c1aa2f + 58a7eff commit 6fc2772a140379bd2aaaed789781179196c732c8
@@ -1,5 +1,13 @@
# ChangeLog - DataStax C# Driver

## 3.7.1

2019-06-01

### Features

- Skip rebulding token map when it is not required by balancing policy

## 3.7.0

2018-11-26
@@ -265,6 +265,8 @@ public void Json()
// Test casts.
VerifyRowSet(_session.Execute("SELECT * FROM test_json WHERE CAST(c2->'a'->'q'->>'p' as " +
"bigint) = 4294967295"));
VerifyRowSet(_session.Execute("SELECT * FROM test_json WHERE CAST(c2->'a'->'q'->>'p' as " +
"decimal) = 4294967295"));
VerifyRowSet(_session.Execute("SELECT * FROM test_json WHERE CAST(c2->'a'->'q'->>'p' as " +
"text) = '4294967295'"));
VerifyRowSet(_session.Execute("SELECT * FROM test_json WHERE CAST(c2->'a'->'q'->>'r' as " +
@@ -297,6 +299,8 @@ public void Json()
"bigint) = 100").ToArray().Length);
Assert.AreEqual(0, _session.Execute("SELECT * FROM test_json WHERE CAST(c2->'a'->'q'->>'p' as " +
"bigint) < 99").ToArray().Length);
Assert.AreEqual(0, _session.Execute("SELECT * FROM test_json WHERE CAST(c2->'a'->'q'->>'p' as " +
"decimal) < 99").ToArray().Length);

// Invalid cast types.
ExecuteInvalid("SELECT * FROM test_json WHERE CAST(c2->'a'->'q'->>'p' as boolean) = 123");
@@ -308,7 +312,6 @@ public void Json()
ExecuteInvalid("SELECT * FROM test_json WHERE CAST(c2->'a'->'q'->>'p' as timeuuid) = 123");
ExecuteInvalid("SELECT * FROM test_json WHERE CAST(c2->'a'->'q'->>'p' as uuid) = 123");
ExecuteInvalid("SELECT * FROM test_json WHERE CAST(c2->'a'->'q'->>'p' as varint) = 123");
ExecuteInvalid("SELECT * FROM test_json WHERE CAST(c2->'a'->'q'->>'p' as decimal) = 123");
ExecuteInvalid("SELECT * FROM test_json WHERE CAST(c2->'a'->'q'->'p' as text) = '123'");

// Test update.
@@ -341,7 +344,6 @@ public void Json()
// Invalid rhs (needs to be valid json)
ExecuteInvalid("UPDATE test_json SET c2->'a'->'q'->'p' = 100 WHERE c1 = 1");
// non-existent key.
ExecuteInvalid("UPDATE test_json SET c2->'a'->'q'->'xyz' = '100' WHERE c1 = 1");
ExecuteInvalid("UPDATE test_json SET c2->'aa'->'q'->'p' = '100' WHERE c1 = 1");
// Array out of bounds.
ExecuteInvalid("UPDATE test_json SET c2->'a1'->200->'k2'->2 = '2000' WHERE c1 = 1");
@@ -4,8 +4,8 @@
<Copyright>Copyright © 2018 by YugaByte, Copyright © 2018 by DataStax</Copyright>
<AssemblyTitle>YugaByte C# Driver for YugaByte DB</AssemblyTitle>
<AssemblyVersion>3.99.0.0</AssemblyVersion>
<FileVersion>3.7.0.0</FileVersion>
<VersionPrefix>3.7.0</VersionPrefix>
<FileVersion>3.7.1.0</FileVersion>
<VersionPrefix>3.7.1</VersionPrefix>
<Authors>YugaByte</Authors>
<TargetFrameworks>net45;netstandard1.5</TargetFrameworks>
<NoWarn>$(NoWarn);1591</NoWarn>
@@ -153,6 +153,11 @@ public IEnumerable<IPEndPoint> AllReplicas()

internal void RebuildTokenMap()
{
if (!Configuration.Policies.LoadBalancingPolicy.RequiresTokenMap)
{
Logger.Info("Skip rebuilding token map");
return;
}
Logger.Info("Rebuilding token map");
if (Partitioner == null)
{
@@ -289,5 +289,13 @@ public bool RequiresPartitionMap
return false;
}
}

public bool RequiresTokenMap
{
get
{
return false;
}
}
}
}
@@ -80,5 +80,7 @@ public interface ILoadBalancingPolicy
IEnumerable<Host> NewQueryPlan(string keyspace, IStatement query);

bool RequiresPartitionMap { get; }

bool RequiresTokenMap { get; }
}
}
@@ -81,7 +81,15 @@ public bool RequiresPartitionMap
{
get
{
return false;
return _loadBalancingPolicy.RequiresPartitionMap;
}
}

public bool RequiresTokenMap
{
get
{
return _loadBalancingPolicy.RequiresTokenMap;
}
}
}
@@ -105,5 +105,13 @@ public bool RequiresPartitionMap
return false;
}
}

public bool RequiresTokenMap
{
get
{
return false;
}
}
}
}
@@ -153,7 +153,15 @@ public bool RequiresPartitionMap
{
get
{
return false;
return _childPolicy.RequiresPartitionMap;
}
}

public bool RequiresTokenMap
{
get
{
return true;
}
}
}
@@ -318,5 +318,13 @@ public bool RequiresPartitionMap
return true;
}
}

public bool RequiresTokenMap
{
get
{
return _childPolicy.RequiresTokenMap;
}
}
}
}

0 comments on commit 6fc2772

Please sign in to comment.
You can’t perform that action at this time.