-
Notifications
You must be signed in to change notification settings - Fork 18
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
Improvement cql stmt generation #435
base: master
Are you sure you want to change the base?
Improvement cql stmt generation #435
Conversation
776f81b
to
905daff
Compare
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.
Amazing Refactor, @CodeLieutenant! I just had a couple of questions related to the implementation itself.
Btw, since you're reorganizing the whole code would be a good thing to drop some DocBlocks around things you think that's important for people to understand before jump into the code.
sleep := time.Duration(0) | ||
|
||
func NewPump(stopFlag *stop.Flag, logger *zap.Logger) chan time.Duration { | ||
pump := make(chan time.Duration, 10000) | ||
logger = logger.Named("Pump") | ||
go func() { | ||
logger.Debug("pump channel opened") | ||
defer func() { | ||
close(pump) | ||
logger.Debug("pump channel closed") | ||
}() | ||
for !stopFlag.IsHardOrSoft() { | ||
pump <- newHeartBeat() | ||
} | ||
}() | ||
if rand.Int()%chance == 0 { | ||
sleep = sleepDuration | ||
} | ||
|
||
return pump | ||
pump <- sleep |
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 it should sleep? Can you explain me exactly how it acts?
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.
Burst mechanism, makes a user of this, sleep after change
is hit. practically if you make change = 10
.
It will sleep approximatly one in 10. This is just to not overload the server
Statement generation currently does not work as intended, gemini generates values for primary and clustering keys, that are completply invalid. The are not just off by value, but also off by type, e.g. generates `text` for `timeuuid`. This is the first step in resolving this issue, by refactoring how, when and where statements are generated. Signed-off-by: Dusan Malusev <dusan.malusev@scylladb.com>
1. Refactoring the Statement Generators into generators package 2. Each table gets it's own random number for validation and generation 3. Warmup consolidated into Job, runs with its own validator and statement generator -> propably can be removed, as Warmup is just a mutation without DDL and deletes Future Plans 1. Remove stopFlag as context.Context can do the same, hard kill is to CANCEL the Global Parent, and soft kill is cancelation of the current context 2. Generators Refactoring Signed-off-by: Dusan Malusev <dusan.malusev@scylladb.com>
context.Context Go has built it mehanizm to stop the execution of the long running process, like goroutines and network requests, and many libraries using inside gemini support it, lets just make a heavy usage of it, cause we can. Signed-off-by: Dusan Malusev <dusan.malusev@scylladb.com>
bcf3e1f
to
185729d
Compare
statement generator -> propably can be removed, as Warmup is just a
mutation without DDL and deletes
Future Plans
to CANCEL the Global Parent, and soft kill is cancelation of the
current context