-
Notifications
You must be signed in to change notification settings - Fork 63
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
JVM: support inject fault to MySQL Java client #106
Conversation
Signed-off-by: xiang <[email protected]>
Signed-off-by: xiang <[email protected]>
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Signed-off-by: xiang <[email protected]>
Signed-off-by: xiang <[email protected]>
Signed-off-by: xiang <[email protected]>
Signed-off-by: xiang <[email protected]>
Signed-off-by: xiang <[email protected]>
Signed-off-by: xiang <[email protected]>
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.
pkg/server/chaosd/jvm.go
Outdated
@@ -83,13 +60,25 @@ func (j jvmAttack) Attack(options core.AttackConfig, env Environment) (err error | |||
log.Debug(string(output), zap.Error(err)) | |||
} | |||
|
|||
// submit helper jar | |||
bmSubmitCmd := fmt.Sprintf(bmSubmitCommand, attack.Port, "b", fmt.Sprintf("%s/lib/byteman-helper.jar", os.Getenv("BYTEMAN_HOME"))) |
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 think we may add this into docs.
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 need to do this, I think it's the internal implementation logic
PTAL @cwen0 |
I think we should add e2e-test for JVM test. |
Signed-off-by: xiang <[email protected]>
a2686ed
to
f24c884
Compare
Signed-off-by: xiang <[email protected]>
You are right, I add a integration test, PTAL again @Andrewmatilde |
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
@WangXiangUSTC We need a new document to guide users on how to use it. |
chaos-mesh/website#245 create an issue for it @cwen0 |
@WangXiangUSTC How about split to two pr? You can update stress and gc in JVM by using https://github.com/chaos-mesh/byteman-helper in a single pr. |
OK |
Signed-off-by: xiang <[email protected]>
pkg/core/jvm.go
Outdated
@@ -123,6 +137,24 @@ type JVMStressSpec struct { | |||
MemoryType string `json:"mem-type,omitempty"` | |||
} | |||
|
|||
// only when SQL match the Database, Table, SQLType, chaosd will inject fault |
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.
This comment is incomplete and irregular.
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 passed the check with the Grammarly 🥲
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 is customary for go comments to begin with the "JVMMySQLSpec" and introduce the general information about this strcut.
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.
done
Table string | ||
|
||
// the match sql type | ||
SQLType string |
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.
Is this field required? If I want to inject delay on all SQL of a specific table, do this feature supported?
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.
Both Database
, Table
and SQLType
are not required, the default value is "". For example:
select * from test.t1
can match configDatabase="test", Table='", SQLType=""
select * from test.t1
can match configDatabase="", Table="t1", SQLType=""
select * from test.t1
can match configDatabase="test", Table='", SQLType="select"
- all sql can match
Database="", Table='", SQLType=""
There is a unit test for this https://github.com/chaos-mesh/byteman-helper/blob/main/BytemanHelper/src/test/java/org/chaos_mesh/byteman/helper/SQLParserTest.java
Signed-off-by: xiang <[email protected]>
I updated the comment, PTAL again @cwen0 |
Signed-off-by: xiang <[email protected]>
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
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 4a87c28
|
Usage