-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[mongodb] Plan2: Match multiple database and collection names using a regular expression in MongoDB. #940
[mongodb] Plan2: Match multiple database and collection names using a regular expression in MongoDB. #940
Conversation
7d7b93a
to
f9a9a84
Compare
f9a9a84
to
b6429e0
Compare
@@ -226,4 +256,103 @@ private boolean isCopying() { | |||
throw new IllegalStateException("Cannot access isCopying field of SourceTask", e); | |||
} | |||
} | |||
|
|||
private void init(Map<String, String> props) { |
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.
private void init(Map<String, String> props) { | |
private void initCapturedCollections(MongoClient mongoClient, Map<String, String> props) { |
and then we can put this method to CollectionDiscoveryUtils
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.
Fixed
|
||
/** match single database and multiple collections: collection = ^db0\.coll_b\d?$ . */ | ||
@Test | ||
public void testMatchSingleDatabaseAndMultipleCollections() throws Exception { |
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.
public void testMatchSingleDatabaseAndMultipleCollections() throws Exception { | |
public void testMatchSingleQualifiedCollectionPattern() throws Exception { |
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.
Fixed
|
||
/** match single database and multiple collections: database = db0 collection = .*coll_b\d? . */ | ||
@Test | ||
public void testMatchSingleDatabaseAndMultipleCollections1() throws Exception { |
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.
public void testMatchSingleDatabaseAndMultipleCollections1() throws Exception { | |
public void testMatchSingleDatabaseWithCollectionPattern() throws Exception { |
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.
Fixed
### MongoDB Namespaces Filters | ||
|
||
The config option `copy.existing.namespace.regex` is a regular expression that matches the namespaces from which to copy data.<br> | ||
|
||
In the following example, matches namespaces `db0.coll0` and `db1.coll1` to snapshot. | ||
|
||
``` | ||
'copy.existing.namespace.regex' = '^(db0\\.coll0|db1\\.coll1)$' | ||
``` | ||
|
||
The config option `namespace.regex` is a regular expression that matches the namespaces from which to watch for changes.<br> | ||
|
||
In the following example, matches namespaces `db0.coll0` and `db1.coll1` to watch. | ||
|
||
``` | ||
'namespace.regex' = '^(db0\\.coll0|db1\\.coll1)$' | ||
``` |
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.
Do we still need this document?
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.
Thanks, I missed it here.
603f474
to
c851129
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.
Thanks @Jiabao-Sun for the update, LGTM.
Please feel free to merge once the CI passed.
Thanks @leonardBang , @bobby-richard. |
Match multiple database and collection names using a regular expression in MongoDB.
Support regex filter by databaseList and collectionList.