Skip to content
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

Gemini generates mutations non-deterministically #370

Open
nuivall opened this issue Jun 22, 2023 · 4 comments · Fixed by #376
Open

Gemini generates mutations non-deterministically #370

nuivall opened this issue Jun 22, 2023 · 4 comments · Fixed by #376
Labels
enhancement New feature or request

Comments

@nuivall
Copy link
Member

nuivall commented Jun 22, 2023

I altered the code to print performed modifications:

diff --git a/pkg/jobs/jobs.go b/pkg/jobs/jobs.go
index c065b5c..ceb6496 100644
--- a/pkg/jobs/jobs.go
+++ b/pkg/jobs/jobs.go
@@ -334,6 +334,7 @@ func ddl(
                return nil
        }
        for _, ddlStmt := range ddlStmts.List {
+               fmt.Println(ddlStmt.PrettyCQL())
                if w := logger.Check(zap.DebugLevel, "ddl statement"); w != nil {
                        w.Write(zap.String("pretty_cql", ddlStmt.PrettyCQL()))
                }
@@ -379,6 +380,7 @@ func mutation(
                return err
        }
        if mutateStmt == nil {
+               fmt.Println("no statement generated")
                if w := logger.Check(zap.DebugLevel, "no statement generated"); w != nil {
                        w.Write(zap.String("job", "mutation"))
                }
@@ -391,6 +393,7 @@ func mutation(
                        g.GiveOld(mutateStmt.ValuesWithToken)
                }()
        }
+       fmt.Println(mutateStmt.PrettyCQL())
        if w := logger.Check(zap.DebugLevel, "mutation statement"); w != nil {
                w.Write(zap.String("pretty_cql", mutateStmt.PrettyCQL()))
        }

Then I executed two times with default seed 1:

/gemini -d --duration 1s --warmup 0 -c 2 -m mixed -f --cql-features basic --max-mutation-retries 5 --max-mutation-retries-backoff 500ms --test-cluster=192.168.100.3 --oracle-cluster=192.168.100.2  --non-interactive=true --level=warn > out.txt

I observed that around 500 insert statements were generated but diff shows that both runs don't seem to have much in common. Sorting the files to test whether it's just non-deterministic ordering also doesn't produce the same or similar outputs.

This undermines reproducibility of the issues. It would be much better if seed applied also to mutations and not only to initial schema. I don't know if this was omitted in the original design or a bug was introduced later.

@dkropachev
Copy link
Collaborator

@nuivall , reason to that is that we are not using pseudo-randomization when generate schema and you did not provide schema to the gemini

@dkropachev dkropachev linked a pull request Jul 2, 2023 that will close this issue
@dkropachev
Copy link
Collaborator

I have implemented #376 to isolate schema seed from statements seed and found that it does not fix all the problems.

@nuivall
Copy link
Member Author

nuivall commented Jul 4, 2023

Actually when I was testing schema was the only stable thing (dependant on seed)

@dkropachev dkropachev added the enhancement New feature or request label Jul 8, 2023
@dkropachev
Copy link
Collaborator

It wasn't closed by #376

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants