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

Add support to export/full load MongoDB/DocumentDB collection with _id field of different data type #4503

Merged
merged 3 commits into from
May 6, 2024

Conversation

dinujoh
Copy link
Member

@dinujoh dinujoh commented May 6, 2024

Description

Add support to export/full load MongoDB/DocumentDB collection with _id field of different data type

Check List

  • New functionality includes testing.
  • New functionality has a documentation issue. Please link to it in this PR.
    • New functionality has javadoc added
  • Commits are signed with a real name per the DCO

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

dinujoh added 2 commits May 6, 2024 10:44
// TODO fix eventVersionNumber
final Event event = recordConverter.convert(record, eventCreationTimeMillis, eventCreationTimeMillis, document.getOperationTypeString());
event.put(DEFAULT_ID_MAPPING_FIELD_NAME, event.get(MONGO_ID_FIELD_NAME, Object.class));
// event.put(DEFAULT_ID_MAPPING_FIELD_NAME, event.get(DOCUMENTDB_ID_FIELD_NAME, Object.class));
Copy link
Member Author

@dinujoh dinujoh May 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be configurable in follow up PR. If customer enables the configuration, we will write to customer provided field. Same for export processing.

final long bytes = record.getBytes().length;
bytesReceivedSummary.record(bytes);
// The version number is the export time minus some overlap to ensure new stream events still get priority
final long eventVersionNumber = (exportStartTime - VERSION_OVERLAP_TIME_FOR_EXPORT.toMillis()) * 1_000;
final Event event = recordConverter.convert(record, exportStartTime, eventVersionNumber);

// event.put(DEFAULT_ID_MAPPING_FIELD_NAME, event.get(DOCUMENTDB_ID_FIELD_NAME, Object.class));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be configurable in follow up PR. If customer enables the configuration, we will write to customer provided field. Same for stream processing.

switch (streamEventName) {
case "INSERT":
case "MODIFY":
switch (streamEventName.toLowerCase()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be an enum?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will fix in follow up PR

@dinujoh dinujoh merged commit 681c587 into opensearch-project:main May 6, 2024
47 checks passed
@@ -376,7 +376,7 @@ void test_processStream_terminateChangeStreamSuccess() {
when(s3PartitionStatus.getPartitions()).thenReturn(partitions);
when(mockPartitionCheckpoint.getGlobalS3FolderCreationStatus(collection)).thenReturn(Optional.of(s3PartitionStatus));
Event event = mock(Event.class);
when(event.get("_id", Object.class)).thenReturn(UUID.randomUUID().toString());
//when(event.get("_id", Object.class)).thenReturn(UUID.randomUUID().toString());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some extra comments in some of these tests.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will have follow up CR to enable this.

@kkondaka kkondaka added this to the v2.8 milestone May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants