Skip to content

Cross-language LazyQueryPlan PRNG compatibility test vectors #82

@dkropachev

Description

@dkropachev

Jira

DRIVER-454 (parent epic: DRIVER-446)

Overview

Add cross-language compatibility test vectors for the LazyQueryPlan PRNG to ensure the Go reference implementation doesn't regress and to document the contract that other language implementations (Java, Python, JS, Rust, C++, C#) must match.

Problem

For LWT optimization, all Alternator client implementations must produce identical node selection sequences for the same PRNG seed. Go is the reference implementation using math/rand (Lagged Fibonacci Generator) with pick-and-remove selection. Other languages must port this algorithm exactly.

Test Vectors

Seed Active Quarantined First 6 Nodes
42 10 0 node6, node9, node5, node2, node7, node1
123 10 0 node6, node1, node4, node3, node10, node5
999 10 0 node5, node10, node4, node1, node2, node3
0 10 0 node5, node1, node2, node10, node6, node8
-1 10 0 node2, node5, node1, node3, node6, node10
42 6 4 node6, node3, node1, node4, node2, node5
12345 10 0 node4, node5, node1, node7, node6, node8
MAX_INT64 10 0 node2, node7, node8, node1, node10, node4

Node naming: node{N}.example.com:8043 (active), quarantined{N}.example.com:8043 (quarantined).

Scope

Since Go is the reference implementation, the work here is adding the test vectors as regression tests in shared/query_plan_unit_test.go using NewLazyQueryPlanWithSeed().

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions