-
Notifications
You must be signed in to change notification settings - Fork 16
REP-6804 Add option to read oplog directly #174
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
Open
FGasper
wants to merge
141
commits into
mongodb-labs:main
Choose a base branch
from
FGasper:REP-6804-mongod-oplog-final
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
141 commits
Select commit
Hold shift + click to select a range
687a57e
move to common
FGasper 61b89e3
move
FGasper 3d35d29
fix lint
FGasper 1c672f9
unused
FGasper aefe4d6
pointer receivers
FGasper 1cb493b
renames/refacotrs
FGasper 08d5633
cleanup
FGasper c9e4610
tidy
FGasper c7d9edd
string
FGasper 196f887
more renames
FGasper 06f7794
move
FGasper 0b13627
metadata
FGasper 25b7e61
comment
FGasper 3284468
comments
FGasper 15a7636
remove persistor error
FGasper df29cde
remove doneChan
FGasper fc6c8ce
remove reader error channel
FGasper d47c40a
allow eventual to accept nil -- MUST TEST!
FGasper 4e38f04
allow premature exit
FGasper 0d4e406
rename & move
FGasper 95129ef
Merge branch 'main' into REP-6804-scratch
FGasper 4e82706
Merge branch 'REP-6804-scratch' into REP-6804-fix-context
FGasper e23a503
move
FGasper d61a8f1
handling
FGasper b05ffe3
add oplog reader & alia
FGasper c6025f5
dedupe retry of change reader
FGasper 8751b11
format
FGasper d3070e2
oops
FGasper 06bc31b
nolint
FGasper 1cbb232
fix test
FGasper 51f4163
ddl allowance
FGasper 6918fda
token
FGasper eb0464d
test 2nd time
FGasper 7b30bff
save
FGasper 4df242e
add comment
FGasper d2b9e18
Merge branch 'REP-6804-fix-context' into REP-6804-mongod-oplog-final
FGasper e5a1596
tolerate later startAtTs
FGasper 90f9123
collmod test
FGasper 11140ae
empty ts
FGasper 8f6871b
read oplog for 4.2
FGasper 3c6380c
Merge branch 'main' into REP-6804-fix-context
FGasper 5337613
Merge branch 'REP-6804-fix-context' into REP-6804-mongod-oplog-final
FGasper 0fbc28e
maybe fix test?
FGasper 6052ecb
avoid $switch for 4.2.
FGasper 491e8f8
4.4
FGasper 6c0aa33
compat
FGasper 8c0a1d3
switch is OK
FGasper 1bfbe36
no oplog for 4.2 for now
FGasper e80cba3
projection is only 4.4 anyway
FGasper f3bf387
allow non-expr oplog
FGasper f07b8de
handle applyOps
FGasper 7840134
clone
FGasper ed11123
Merge branch 'main' into REP-6804-mongod-oplog-final
FGasper acbbbbe
options
FGasper ddeb8f3
github ci
FGasper e32835b
err check
FGasper bb78043
array
FGasper bf719a6
quotes
FGasper a74853e
quotes again
FGasper 1f1fdb4
support ns filter in oplog
FGasper 0622651
show Max the wonky
FGasper 0b68637
wth
FGasper 00d5a24
still failing :(
FGasper 3d20e9c
neutralize session
FGasper 2a5e55a
fixed test
FGasper eeb1f4f
more log
FGasper 1296de2
Merge branch 'main' into REP-6804-mongod-oplog-final
FGasper b5ccf30
lint
FGasper 77ea0d7
remove prints
FGasper 43a588f
no snapshot
FGasper 36ddf24
majority
FGasper aa86c4f
kill txns
FGasper 9677fdd
local rc
FGasper 683b055
redundant
FGasper b0f2aad
invert order
FGasper bc3ab8c
wait for catchup
FGasper 11be48d
clear out
FGasper 8c7578f
fix??
FGasper 1784a7b
tweak
FGasper 3160dc6
switch over
FGasper 263c9e7
fall back to start ts as needed
FGasper 95e7566
Merge branch 'REP-6832-afterclustertime-latest-clustertime' into REP-…
FGasper d009954
agg polish
FGasper f10c907
fix Eq
FGasper f05a4c6
use driver API
FGasper 93a808d
Merge branch 'REP-6832-afterclustertime-latest-clustertime' into REP-…
FGasper cf08833
sc
FGasper 22d5775
revert
FGasper 894f454
Merge branch 'REP-6832-afterclustertime-latest-clustertime' into REP-…
FGasper f2ca1e6
compulsory timestamp
FGasper 22e5072
start handling
FGasper 88b0657
another
FGasper ae85756
fix another
FGasper 37373ac
fix
FGasper b30e9a8
fix again
FGasper 0546f15
fix test
FGasper 1ffb5f6
more
FGasper a463151
move
FGasper a5ab503
save
FGasper fe22242
ctx
FGasper 474ae71
comment
FGasper c9c07f4
Merge branch 'REP-6832-afterclustertime-latest-clustertime' into REP-…
FGasper d038582
try 3.6 here
FGasper ab63521
Revert "try 3.6 here"
FGasper 1a70ae7
add
FGasper b2390d8
Revert "add"
FGasper 4631895
add majority RC
FGasper 40044f5
dummy
FGasper e9f534f
dummy
FGasper b3b1283
Merge branch 'main' into REP-6832-afterclustertime-latest-clustertime
FGasper 7f658a9
Merge branch 'REP-6832-afterclustertime-latest-clustertime' into REP-…
FGasper 22ac4e6
Merge branch 'main' into REP-6804-mongod-oplog-final
FGasper 858b7ff
add doc
FGasper 3211a98
no pointer
FGasper 0dfe832
revert some
FGasper 6fb0682
tweak
FGasper 1dc0576
comments
FGasper 627e793
fix
FGasper d001fde
revert
FGasper bf55759
don’t warn
FGasper a81561c
fix
FGasper 43e5a88
Printf
FGasper 9fe9613
comments
FGasper 88f7d22
remove TODO
FGasper b6692bc
panic clearer
FGasper b1c5390
document limitation
FGasper a7294d0
Forbid changing change reader opts.
FGasper 93b67d8
confirm failure
FGasper dbb15a0
moar doc
FGasper c2f422c
ofix test
FGasper 7e917b3
avoid sharded w/ oplog
FGasper e6e59f6
Merge branch 'main' into REP-6804-mongod-oplog-final
FGasper fc1d80f
rename
FGasper 6da0994
Withhold pending review - fixes
FGasper 58f3846
renames & such from Jian’s review
FGasper 0d284a3
fix & add more tests
FGasper 542ebdf
add unit test
FGasper 32445e9
tweak docs
FGasper 4cfdbd6
fix oplog tests
FGasper 6b33e8c
slip test
FGasper 9b75105
replace w/ 4.2
FGasper File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,208 @@ | ||
| // Package agg provides convenience types for aggregation operators. | ||
| // This yields two major advantages over using bson.D or bson.M: | ||
| // - simpler syntax | ||
| // - auto-completion (i.e., via gopls) | ||
| // | ||
| // Guiding principles are: | ||
| // - Prefer [1]any for unary operators (e.g., `$bsonSize`). | ||
| // - Prefer struct types for operators with named parameters. | ||
| // - Use functions sparingly, e.g., for “tuple” operators like `$in`. | ||
| package agg | ||
|
|
||
| import ( | ||
| "go.mongodb.org/mongo-driver/v2/bson" | ||
| ) | ||
|
|
||
| type Eq []any | ||
|
|
||
| var _ bson.Marshaler = Eq{} | ||
|
|
||
| func (e Eq) MarshalBSON() ([]byte, error) { | ||
| return bson.Marshal(bson.D{{"$eq", []any(e)}}) | ||
| } | ||
|
|
||
| // --------------------------------------------- | ||
|
|
||
| func In[T any](needle any, haystack []T) bson.D { | ||
| return bson.D{{"$in", bson.A{needle, haystack}}} | ||
| } | ||
|
|
||
| // --------------------------------------------- | ||
|
|
||
| type BSONSize [1]any | ||
|
|
||
| var _ bson.Marshaler = BSONSize{} | ||
|
|
||
| func (b BSONSize) MarshalBSON() ([]byte, error) { | ||
| return bson.Marshal(bson.D{{"$bsonSize", b[0]}}) | ||
| } | ||
|
|
||
| // --------------------------------------------- | ||
|
|
||
| type Type [1]any | ||
|
|
||
| var _ bson.Marshaler = Type{} | ||
|
|
||
| func (t Type) MarshalBSON() ([]byte, error) { | ||
| return bson.Marshal(bson.D{{"$type", t[0]}}) | ||
| } | ||
|
|
||
| // --------------------------------------------- | ||
|
|
||
| type Not [1]any | ||
|
|
||
| var _ bson.Marshaler = Type{} | ||
|
|
||
| func (n Not) MarshalBSON() ([]byte, error) { | ||
| return bson.Marshal(bson.D{{"$not", n[0]}}) | ||
| } | ||
|
|
||
| // --------------------------------------------- | ||
|
|
||
| type And []any | ||
|
|
||
| var _ bson.Marshaler = And{} | ||
|
|
||
| func (a And) MarshalBSON() ([]byte, error) { | ||
| return bson.Marshal(bson.D{ | ||
| {"$and", []any(a)}, | ||
| }) | ||
| } | ||
|
|
||
| // --------------------------------------------- | ||
|
|
||
| type Or []any | ||
|
|
||
| var _ bson.Marshaler = Or{} | ||
|
|
||
| func (o Or) MarshalBSON() ([]byte, error) { | ||
| return bson.Marshal(bson.D{ | ||
| {"$or", []any(o)}, | ||
| }) | ||
| } | ||
|
|
||
| // --------------------------------------------- | ||
|
|
||
| type MergeObjects []any | ||
|
|
||
| var _ bson.Marshaler = MergeObjects{} | ||
|
|
||
| func (m MergeObjects) MarshalBSON() ([]byte, error) { | ||
| return bson.Marshal(bson.D{ | ||
| {"$mergeObjects", []any(m)}, | ||
| }) | ||
| } | ||
|
|
||
| // --------------------------------------------- | ||
|
|
||
| type Cond struct { | ||
| If, Then, Else any | ||
| } | ||
|
|
||
| var _ bson.Marshaler = Cond{} | ||
|
|
||
| func (c Cond) D() bson.D { | ||
| return bson.D{ | ||
| {"$cond", bson.D{ | ||
| {"if", c.If}, | ||
| {"then", c.Then}, | ||
| {"else", c.Else}, | ||
| }}, | ||
| } | ||
| } | ||
|
|
||
| func (c Cond) MarshalBSON() ([]byte, error) { | ||
| return bson.Marshal(c.D()) | ||
| } | ||
|
|
||
| // --------------------------------------------- | ||
|
|
||
| type Switch struct { | ||
| Branches []SwitchCase | ||
| Default any | ||
| } | ||
|
|
||
| var _ bson.Marshaler = Switch{} | ||
|
|
||
| type SwitchCase struct { | ||
| Case any | ||
| Then any | ||
| } | ||
|
|
||
| func (s Switch) D() bson.D { | ||
| return bson.D{{"$switch", bson.D{ | ||
| {"branches", s.Branches}, | ||
| {"default", s.Default}, | ||
| }}} | ||
| } | ||
|
|
||
| func (s Switch) MarshalBSON() ([]byte, error) { | ||
| return bson.Marshal(s.D()) | ||
| } | ||
|
|
||
| // --------------------------------------------- | ||
|
|
||
| type ArrayElemAt struct { | ||
| Array any | ||
| Index int | ||
| } | ||
|
|
||
| var _ bson.Marshaler = ArrayElemAt{} | ||
|
|
||
| func (a ArrayElemAt) D() bson.D { | ||
| return bson.D{{"$arrayElemAt", bson.A{ | ||
| a.Array, | ||
| a.Index, | ||
| }}} | ||
| } | ||
|
|
||
| func (a ArrayElemAt) MarshalBSON() ([]byte, error) { | ||
| return bson.Marshal(a.D()) | ||
| } | ||
|
|
||
| // --------------------------------------------- | ||
|
|
||
| type Map struct { | ||
| Input, As, In any | ||
| } | ||
|
|
||
| var _ bson.Marshaler = Map{} | ||
|
|
||
| func (m Map) D() bson.D { | ||
| return bson.D{ | ||
| {"$map", bson.D{ | ||
| {"input", m.Input}, | ||
| {"as", m.As}, | ||
| {"in", m.In}, | ||
| }}, | ||
| } | ||
| } | ||
|
|
||
| func (m Map) MarshalBSON() ([]byte, error) { | ||
| return bson.Marshal(m.D()) | ||
| } | ||
|
|
||
| // ------------------------------------------ | ||
|
|
||
| type Filter struct { | ||
| Input, As, Cond, Limit any | ||
| } | ||
|
|
||
| var _ bson.Marshaler = Filter{} | ||
|
|
||
| func (f Filter) D() bson.D { | ||
| d := bson.D{ | ||
| {"input", f.Input}, | ||
| {"as", f.As}, | ||
| {"cond", f.Cond}, | ||
| } | ||
|
|
||
| if f.Limit != nil { | ||
| d = append(d, bson.E{"limit", f.Limit}) | ||
| } | ||
| return bson.D{{"$filter", d}} | ||
| } | ||
|
|
||
| func (f Filter) MarshalBSON() ([]byte, error) { | ||
| return bson.Marshal(f.D()) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| package helpers | ||
|
|
||
| import ( | ||
| "github.com/10gen/migration-verifier/agg" | ||
| "go.mongodb.org/mongo-driver/v2/bson" | ||
| ) | ||
|
|
||
| type Exists [1]any | ||
|
|
||
| func (e Exists) MarshalBSON() ([]byte, error) { | ||
| return bson.Marshal(agg.Not{agg.Eq{"missing", agg.Type{e[0]}}}) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| // Package helpers exposes functions that express common operations | ||
| // that don’t map to a single aggregation operator. | ||
| package helpers | ||
|
|
||
| import ( | ||
| "go.mongodb.org/mongo-driver/v2/bson" | ||
| ) | ||
|
|
||
| // StringHasPrefix parallels Go’s strings.HasPrefix. | ||
| type StringHasPrefix struct { | ||
| FieldRef any | ||
| Prefix string | ||
| } | ||
|
|
||
| func (sp StringHasPrefix) MarshalBSON() ([]byte, error) { | ||
| return bson.Marshal(bson.D{ | ||
| {"$eq", bson.A{ | ||
| 0, | ||
| bson.D{{"$indexOfCP", bson.A{ | ||
| sp.FieldRef, | ||
| sp.Prefix, | ||
| 0, | ||
| 1, | ||
| }}}, | ||
| }}, | ||
| }) | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.