-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[to #439] introduce MockThreeStoresTest to onStoreUnreachable #518
Conversation
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
@@ -166,6 +178,10 @@ private static VersionInfo getVersionInfo() { | |||
} | |||
|
|||
private synchronized void warmUp() { | |||
if (conf.isTest()) { | |||
logger.info("skip warm up in test mode"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why skip warmup in test mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PDMockServerTest
is the base class ofMockServerTest
.TiSession
is initialized inPDMockServerTest
, and it callswarmup
.warmup
callsgetAllStores
andrawGet
.
This results in a dependent hell. We should ignore this anti-pattern warmup operation in TiSession
, otherwise, we could not launch MockServerTest
propperly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignored warmup by setEnableWarmup(false)
@@ -97,7 +124,7 @@ private void verifyContext(Context context) throws Exception { | |||
if (context.getRegionId() != region.getId() | |||
|| !context.getRegionEpoch().equals(region.getRegionEpoch()) | |||
|| !context.getPeer().equals(region.getLeader())) { | |||
throw new Exception(); | |||
throw new Exception("context doesn't match"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be better to specifically point out the mismatched field in context.
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
@@ -40,6 +40,7 @@ | |||
import org.tikv.kvproto.Metapb.Region; | |||
|
|||
public class TiRegion implements Serializable { | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can do code format in another PR
import org.tikv.kvproto.Metapb; | ||
import org.tikv.kvproto.Pdpb; | ||
|
||
public class MockThreeStoresTest extends PDMockServerTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename MockThreeStoresTest
to MockTiKVClusterTest
?
The store number can be config?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just want to keep it simple enough, for now, refactoring will be introduced in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create an issue to describe this refactoring?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could I just add some comments to this class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
…-java into test-seek-leader-store
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #518 +/- ##
============================================
+ Coverage 30.94% 31.90% +0.95%
- Complexity 1282 1311 +29
============================================
Files 278 278
Lines 17343 17344 +1
Branches 1975 1975
============================================
+ Hits 5367 5533 +166
+ Misses 11387 11192 -195
- Partials 589 619 +30
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…-java into test-seek-leader-store
Signed-off-by: iosmanthus myosmanthustree@gmail.com
What problem does this PR solve?
Issue Number: close #439
This pull request tries to mock a TiKV grpc server and cover the error handling logic of client-java, mostly, the logic of
seekLeaderStore
andseekProxyStore
inhandleRequestError
.