You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "tibrewalpratik17 (via GitHub)" <gi...@apache.org> on 2023/10/26 13:46:52 UTC
[PR] Add upsert config - outOfOrderRecordColumn to track out-of-order events [pinot]
tibrewalpratik17 opened a new pull request, #11877:
URL: https://github.com/apache/pinot/pull/11877
label:
1. `feature`
2. `upsert`
Relates to #11796
This PR adds an upsert config `outOfOrderRecordColumn`. When set to a non-null value, we check whether an event is `OOO` or not and then accordingly update the corresponding column value to true / false. This will help in tracking which event is out-of-order while using `skipUpsert`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Add upsert config - outOfOrderRecordColumn to track out-of-order events [pinot]
Posted by "Jackie-Jiang (via GitHub)" <gi...@apache.org>.
Jackie-Jiang commented on PR #11877:
URL: https://github.com/apache/pinot/pull/11877#issuecomment-1800280879
@tibrewalpratik17 Are you planning to use this out-of-order field in a programmatical way to serve your customers or use it for easier debugging? Since you already added the option to not ingest out-of-order field in #11811, do you still see this PR necessary? If it is purely for debugging, I'd prefer not adding it because of the overhead and extra complexity of the logic
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Add upsert config - outOfOrderRecordColumn to track out-of-order events [pinot]
Posted by "tibrewalpratik17 (via GitHub)" <gi...@apache.org>.
tibrewalpratik17 commented on code in PR #11877:
URL: https://github.com/apache/pinot/pull/11877#discussion_r1393071921
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/indexsegment/mutable/MutableSegmentImpl.java:
##########
@@ -496,7 +502,11 @@ public boolean index(GenericRow row, @Nullable RowMetadata rowMetadata)
// segment indexing or addNewRow call errors out in those scenario, there can be metadata inconsistency where
// a key is pointing to some other key's docID
// TODO fix this metadata mismatch scenario
- if (_partitionUpsertMetadataManager.addRecord(this, recordInfo)) {
+ boolean isOutOfOrderRecord = _partitionUpsertMetadataManager.addRecord(this, recordInfo);
+ if (_upsertOutOfOrderRecordColumn != null) {
Review Comment:
Umm why? This if clause is for populating `_upsertOutOfOrderRecordColumn` field specifically.
Not adding record check is at line 509.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Add upsert config - outOfOrderRecordColumn to track out-of-order events [pinot]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #11877:
URL: https://github.com/apache/pinot/pull/11877#issuecomment-1782725284
## [Codecov](https://app.codecov.io/gh/apache/pinot/pull/11877?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
> Merging [#11877](https://app.codecov.io/gh/apache/pinot/pull/11877?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (230997b) into [master](https://app.codecov.io/gh/apache/pinot/commit/5d58102d0ac7366d578ea1012ec125379ef70e7c?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (5d58102) will **decrease** coverage by `0.06%`.
> The diff coverage is `73.33%`.
```diff
@@ Coverage Diff @@
## master #11877 +/- ##
============================================
- Coverage 61.45% 61.40% -0.06%
Complexity 1147 1147
============================================
Files 2375 2375
Lines 128500 128510 +10
Branches 19846 19849 +3
============================================
- Hits 78974 78910 -64
- Misses 43815 43896 +81
+ Partials 5711 5704 -7
```
| [Flag](https://app.codecov.io/gh/apache/pinot/pull/11877/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [custom-integration1](https://app.codecov.io/gh/apache/pinot/pull/11877/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `<0.01% <0.00%> (ø)` | |
| [integration](https://app.codecov.io/gh/apache/pinot/pull/11877/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `<0.01% <0.00%> (ø)` | |
| [integration1](https://app.codecov.io/gh/apache/pinot/pull/11877/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `<0.01% <0.00%> (ø)` | |
| [integration2](https://app.codecov.io/gh/apache/pinot/pull/11877/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `0.00% <0.00%> (ø)` | |
| [java-11](https://app.codecov.io/gh/apache/pinot/pull/11877/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `61.37% <73.33%> (-0.04%)` | :arrow_down: |
| [java-21](https://app.codecov.io/gh/apache/pinot/pull/11877/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `34.72% <6.66%> (-26.59%)` | :arrow_down: |
| [skip-bytebuffers-false](https://app.codecov.io/gh/apache/pinot/pull/11877/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `61.39% <73.33%> (-0.03%)` | :arrow_down: |
| [skip-bytebuffers-true](https://app.codecov.io/gh/apache/pinot/pull/11877/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `34.70% <6.66%> (-26.59%)` | :arrow_down: |
| [temurin](https://app.codecov.io/gh/apache/pinot/pull/11877/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `61.40% <73.33%> (-0.06%)` | :arrow_down: |
| [unittests](https://app.codecov.io/gh/apache/pinot/pull/11877/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `61.39% <73.33%> (-0.06%)` | :arrow_down: |
| [unittests1](https://app.codecov.io/gh/apache/pinot/pull/11877/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `46.63% <6.66%> (-0.03%)` | :arrow_down: |
| [unittests2](https://app.codecov.io/gh/apache/pinot/pull/11877/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `27.57% <66.66%> (-0.04%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Files](https://app.codecov.io/gh/apache/pinot/pull/11877?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [...cal/upsert/BasePartitionUpsertMetadataManager.java](https://app.codecov.io/gh/apache/pinot/pull/11877?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3Qtc2VnbWVudC1sb2NhbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3Qvc2VnbWVudC9sb2NhbC91cHNlcnQvQmFzZVBhcnRpdGlvblVwc2VydE1ldGFkYXRhTWFuYWdlci5qYXZh) | `40.94% <100.00%> (+0.16%)` | :arrow_up: |
| [...t/local/upsert/BaseTableUpsertMetadataManager.java](https://app.codecov.io/gh/apache/pinot/pull/11877?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3Qtc2VnbWVudC1sb2NhbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3Qvc2VnbWVudC9sb2NhbC91cHNlcnQvQmFzZVRhYmxlVXBzZXJ0TWV0YWRhdGFNYW5hZ2VyLmphdmE=) | `77.88% <100.00%> (+0.21%)` | :arrow_up: |
| [...psert/ConcurrentMapTableUpsertMetadataManager.java](https://app.codecov.io/gh/apache/pinot/pull/11877?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3Qtc2VnbWVudC1sb2NhbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3Qvc2VnbWVudC9sb2NhbC91cHNlcnQvQ29uY3VycmVudE1hcFRhYmxlVXBzZXJ0TWV0YWRhdGFNYW5hZ2VyLmphdmE=) | `33.33% <ø> (ø)` | |
| [...t/ConcurrentMapPartitionUpsertMetadataManager.java](https://app.codecov.io/gh/apache/pinot/pull/11877?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3Qtc2VnbWVudC1sb2NhbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3Qvc2VnbWVudC9sb2NhbC91cHNlcnQvQ29uY3VycmVudE1hcFBhcnRpdGlvblVwc2VydE1ldGFkYXRhTWFuYWdlci5qYXZh) | `85.81% <87.50%> (+0.39%)` | :arrow_up: |
| [...rg/apache/pinot/spi/config/table/UpsertConfig.java](https://app.codecov.io/gh/apache/pinot/pull/11877?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3Qtc3BpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9zcGkvY29uZmlnL3RhYmxlL1Vwc2VydENvbmZpZy5qYXZh) | `78.57% <25.00%> (-4.13%)` | :arrow_down: |
... and [12 files with indirect coverage changes](https://app.codecov.io/gh/apache/pinot/pull/11877/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Add upsert config - outOfOrderRecordColumn to track out-of-order events [pinot]
Posted by "Jackie-Jiang (via GitHub)" <gi...@apache.org>.
Jackie-Jiang commented on PR #11877:
URL: https://github.com/apache/pinot/pull/11877#issuecomment-1793358161
> In one of the use-cases where a user was using `skipUpsert` in their queries, they start seeing nulls for a partial-upsert table where previous non-nulls were sent for those columns. On debugging we realised those were because of out-of-order events. Ideally, we had want to give users the feature to skip those out-of-order event records as well in query response when using `skipUpsert`.
Can you give an example of the desired behavior?
> I understand it adds an overhead in case of full-upserts mainly by doing an additional read from the hashmap. For partial-upserts, I think the overhead is mainly around an extra boolean column.
>
> Also one question around this, what is the general recommendation of using `skipUpsert` query options? Should they be only used for debugging purposes or are they reliable enough to use it in a manner for getting all records for a given key (just like an append-only table)?
`skipUpsert` is mostly used for debugging purpose, but can also be used to show the change history. With clean up tasks such as compaction (#6912), change history can be cleaned up though
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Add upsert config - outOfOrderRecordColumn to track out-of-order events [pinot]
Posted by "Jackie-Jiang (via GitHub)" <gi...@apache.org>.
Jackie-Jiang commented on PR #11877:
URL: https://github.com/apache/pinot/pull/11877#issuecomment-1786250971
I don't know how much value this feature is adding if it is just for debugging purpose. It will add quite some overhead, and when debugging, we should be able to figure out the out-of-order records by looking at the segment name, doc id and comparison column. We also already emit a metric for the out-of-order records.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Add upsert config - outOfOrderRecordColumn to track out-of-order events [pinot]
Posted by "tibrewalpratik17 (via GitHub)" <gi...@apache.org>.
tibrewalpratik17 commented on PR #11877:
URL: https://github.com/apache/pinot/pull/11877#issuecomment-1793514337
> Can you give an example of the desired behavior?
Adding to the example here - https://github.com/apache/pinot/issues/11796#issuecomment-1765210093
In this particular use-case, there are multiple services pushing to the same kafka topic on which partial-upsert table is created. Customers want to use the same table for tracking change history for a particular request plus tracking open requests as well. One service is primarily responsible for pushing request-status updates while other services are pushing additional metadata for request-id. These metadata events can come out-of-order resulting in persisting a lot of fields as null (since no merger is performed). Now when querying using `skipUpsert` for change history, the status field and few other fields comes up as null. This is an issue since it's difficult to differentiate here what field is actually null from beginning and never received a non-null value or is the null value due to the record being out-of-order.
Having a column to differentiate will help analyse on customer's end the scale of out-of-order event as well and what data they are missing out on for these out-of-order events.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Add upsert config - outOfOrderRecordColumn to track out-of-order events [pinot]
Posted by "Jackie-Jiang (via GitHub)" <gi...@apache.org>.
Jackie-Jiang commented on code in PR #11877:
URL: https://github.com/apache/pinot/pull/11877#discussion_r1395023012
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/BasePartitionUpsertMetadataManager.java:
##########
@@ -362,6 +360,7 @@ public boolean addRecord(MutableSegment segment, RecordInfo recordInfo) {
}
}
+ // doAddRecord returns whether the event is out-of-order or not, if out-of-order returns false else true
Review Comment:
We should add the same documentation to `PartitionUpsertMetadataManager.addRecord()`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Add upsert config - outOfOrderRecordColumn to track out-of-order events [pinot]
Posted by "Jackie-Jiang (via GitHub)" <gi...@apache.org>.
Jackie-Jiang merged PR #11877:
URL: https://github.com/apache/pinot/pull/11877
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Add upsert config - outOfOrderRecordColumn to track out-of-order events [pinot]
Posted by "tibrewalpratik17 (via GitHub)" <gi...@apache.org>.
tibrewalpratik17 commented on PR #11877:
URL: https://github.com/apache/pinot/pull/11877#issuecomment-1786261037
> don't know how much value this feature is adding if it is just for debugging purpose.
In one of the use-cases where a user was using `skipUpsert` in their queries, they start seeing nulls for a partial-upsert table where previous non-nulls were sent for those columns. On debugging we realised those were because of out-of-order events. Ideally, we had want to give users the feature to skip those out-of-order event records as well in query response when using `skipUpsert`.
> It will add quite some overhead, and when debugging, we should be able to figure out the out-of-order records by looking at the segment name, doc id and comparison column. We also already emit a metric for the out-of-order records.
I understand it adds an overhead in case of full-upserts mainly by doing an additional read from the hashmap. For partial-upserts, I think the overhead is mainly around an extra boolean column.
Also one question around this, what is the general recommendation of using `skipUpsert` query options? Should they be only used for debugging purposes or are they reliable enough to use it in a manner for getting all records for a given key (just like an append-only table)?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Add upsert config - outOfOrderRecordColumn to track out-of-order events [pinot]
Posted by "tibrewalpratik17 (via GitHub)" <gi...@apache.org>.
tibrewalpratik17 commented on PR #11877:
URL: https://github.com/apache/pinot/pull/11877#issuecomment-1800890760
> Are you planning to use this out-of-order field in a programmatical way to serve your customers or use it for easier debugging?
@Jackie-Jiang it is to use this out-of-order field in a programmatical way.
> Since you already added the option to not ingest out-of-order field in https://github.com/apache/pinot/pull/11811, do you still see this PR necessary?
This will lead out to missing information about fields / columns which come only once in the entire lifecycle of a primary-key record but unfortunately was out-of-ordered. Having this config, will help find those unordered events programmatically and populate the value of missing field accordingly.
> If it is purely for debugging, I'd prefer not adding it because of the overhead and extra complexity of the logic
I think we can maybe add a suggestion somewhere that using this for full-upsert will add significant overhead. For partial-upsert, i think the overhead of having another column in terms of size will be known to customer as they will have to add the column in upstream. Wdyt?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Add upsert config - outOfOrderRecordColumn to track out-of-order events [pinot]
Posted by "Jackie-Jiang (via GitHub)" <gi...@apache.org>.
Jackie-Jiang commented on code in PR #11877:
URL: https://github.com/apache/pinot/pull/11877#discussion_r1395017264
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/BasePartitionUpsertMetadataManager.java:
##########
@@ -362,6 +360,7 @@ public boolean addRecord(MutableSegment segment, RecordInfo recordInfo) {
}
}
+ // doAddRecord returns whether the event is out-of-order or not, if out-of-order returns false else true
Review Comment:
```suggestion
/**
Returns {@code true} when the record is added to the upsert metadata manager, {@code false} when the record is out-of-order thus not added.
*/
```
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/indexsegment/mutable/MutableSegmentImpl.java:
##########
@@ -496,7 +502,11 @@ public boolean index(GenericRow row, @Nullable RowMetadata rowMetadata)
// segment indexing or addNewRow call errors out in those scenario, there can be metadata inconsistency where
// a key is pointing to some other key's docID
// TODO fix this metadata mismatch scenario
- if (_partitionUpsertMetadataManager.addRecord(this, recordInfo)) {
+ boolean isOutOfOrderRecord = !_partitionUpsertMetadataManager.addRecord(this, recordInfo);
+ if (_upsertOutOfOrderRecordColumn != null) {
+ updatedRow.putValue(_upsertOutOfOrderRecordColumn, BooleanUtils.toInt(String.valueOf(isOutOfOrderRecord)));
Review Comment:
Let's add `int toInt(boolean value)` into `BooleanUtils` to avoid the back and forth conversion to string
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/indexsegment/mutable/MutableSegmentImpl.java:
##########
@@ -496,7 +502,11 @@ public boolean index(GenericRow row, @Nullable RowMetadata rowMetadata)
// segment indexing or addNewRow call errors out in those scenario, there can be metadata inconsistency where
// a key is pointing to some other key's docID
// TODO fix this metadata mismatch scenario
- if (_partitionUpsertMetadataManager.addRecord(this, recordInfo)) {
+ boolean isOutOfOrderRecord = _partitionUpsertMetadataManager.addRecord(this, recordInfo);
+ if (_upsertOutOfOrderRecordColumn != null) {
Review Comment:
Sorry I misread it. I thought we should only set the value when it is out of order
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Add upsert config - outOfOrderRecordColumn to track out-of-order events [pinot]
Posted by "Jackie-Jiang (via GitHub)" <gi...@apache.org>.
Jackie-Jiang commented on code in PR #11877:
URL: https://github.com/apache/pinot/pull/11877#discussion_r1392982068
##########
pinot-spi/src/main/java/org/apache/pinot/spi/config/table/UpsertConfig.java:
##########
@@ -189,6 +197,12 @@ public void setDeleteRecordColumn(String deleteRecordColumn) {
}
}
+ public void setOutOfOrderRecordColumn(String outOfOrderRecordColumn) {
+ if (outOfOrderRecordColumn != null) {
+ _outOfOrderRecordColumn = outOfOrderRecordColumn;
+ }
Review Comment:
We should not have this `null` check`. Can you also remove the `null` check for `deleteRecordColumn`? It is needed only for `comparisonColumn` to solve the backward compatible issue introduced when adding `comparisonColumns`
```suggestion
_outOfOrderRecordColumn = outOfOrderRecordColumn;
```
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/ConcurrentMapPartitionUpsertMetadataManager.java:
##########
@@ -288,7 +288,7 @@ protected boolean doAddRecord(MutableSegment segment, RecordInfo recordInfo) {
// Update metrics
_serverMetrics.setValueOfPartitionGauge(_tableNameWithType, _partitionId, ServerGauge.UPSERT_PRIMARY_KEYS_COUNT,
_primaryKeyToRecordLocationMap.size());
- return !shouldDropRecord.get();
+ return shouldDropRecord.get();
Review Comment:
Suggest still returning `true` when record is added (not out-of-order) to follow common contract of adding value to a collection
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/ConcurrentMapPartitionUpsertMetadataManager.java:
##########
@@ -240,6 +240,7 @@ public void doRemoveExpiredPrimaryKeys() {
persistWatermark(_largestSeenComparisonValue);
}
+ // doAddRecord returns whether the event is out-of-order or not
Review Comment:
Don't add javadoc here. Let's add it into the base class (and also the interface), and follows the javadoc format.
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/BaseTableUpsertMetadataManager.java:
##########
@@ -65,6 +65,7 @@ public abstract class BaseTableUpsertMetadataManager implements TableUpsertMetad
protected List<String> _primaryKeyColumns;
protected List<String> _comparisonColumns;
protected String _deleteRecordColumn;
+ protected String _outOfOrderRecordColumn;
Review Comment:
Not required. `_dropOutOfOrderRecord` can also be removed
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/ConcurrentMapPartitionUpsertMetadataManager.java:
##########
@@ -240,6 +240,7 @@ public void doRemoveExpiredPrimaryKeys() {
persistWatermark(_largestSeenComparisonValue);
}
+ // doAddRecord returns whether the event is out-of-order or not
@Override
protected boolean doAddRecord(MutableSegment segment, RecordInfo recordInfo) {
AtomicBoolean shouldDropRecord = new AtomicBoolean(false);
Review Comment:
Rename it to `isOutOfOrderRecord`
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/indexsegment/mutable/MutableSegmentImpl.java:
##########
@@ -496,7 +502,11 @@ public boolean index(GenericRow row, @Nullable RowMetadata rowMetadata)
// segment indexing or addNewRow call errors out in those scenario, there can be metadata inconsistency where
// a key is pointing to some other key's docID
// TODO fix this metadata mismatch scenario
- if (_partitionUpsertMetadataManager.addRecord(this, recordInfo)) {
+ boolean isOutOfOrderRecord = _partitionUpsertMetadataManager.addRecord(this, recordInfo);
+ if (_upsertOutOfOrderRecordColumn != null) {
Review Comment:
(MAJOR) We need to check `isOutOfOrderRecord` first. Please add a test for this new feature
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/realtime/impl/RealtimeSegmentConfig.java:
##########
@@ -195,6 +200,14 @@ public String getUpsertDeleteRecordColumn() {
return _upsertDeleteRecordColumn;
}
+ public String getUpsertOutOfOrderRecordColumn() {
+ return _upsertOutOfOrderRecordColumn;
+ }
+
+ public boolean getUpsertDropOutOfOrderRecord() {
Review Comment:
```suggestion
public boolean isUpsertDropOutOfOrderRecord() {
```
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/indexsegment/mutable/MutableSegmentImpl.java:
##########
@@ -165,6 +165,8 @@ public class MutableSegmentImpl implements MutableSegment {
private final PartitionUpsertMetadataManager _partitionUpsertMetadataManager;
private final List<String> _upsertComparisonColumns;
private final String _deleteRecordColumn;
+ private final String _upsertOutOfOrderRecordColumn;
Review Comment:
We can add a validation in `TableConfigUtils` to verify only one of `_upsertOutOfOrderRecordColumn` and `_upsertDropOutOfOrderRecord` should be set
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Add upsert config - outOfOrderRecordColumn to track out-of-order events [pinot]
Posted by "tibrewalpratik17 (via GitHub)" <gi...@apache.org>.
tibrewalpratik17 commented on PR #11877:
URL: https://github.com/apache/pinot/pull/11877#issuecomment-1803556807
> we can add the column value in MutableSegmentImpl similar to how we not ingest the record.
For this, we will have to initialise upsert-related config `_outOfOrderRecordColumn` in `MutableSegmentImpl` -- is that okay to do?
One more thing, at present `addRecord` returns whether we should add the record or not based on `out-of-order` event and `dropOutOfOrderRecord` config both, do you want me to change the logic to just returning whether it's an `out-of-order` event or not and then expose `dropOutOfOrderRecord` in `MutableSegmentImpl` as well?
I was thinking to not leak upsert-related configs to `MutableSegmentImpl` but I am fine with the refactoring as you suggest.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Add upsert config - outOfOrderRecordColumn to track out-of-order events [pinot]
Posted by "Jackie-Jiang (via GitHub)" <gi...@apache.org>.
Jackie-Jiang commented on PR #11877:
URL: https://github.com/apache/pinot/pull/11877#issuecomment-1804272117
@tibrewalpratik17 Yes, this is the proposal. `addRecord` always return whether the record is out-of-order, and the caller can decide how to handle it. IMO this is a cleaner abstraction
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Add upsert config - outOfOrderRecordColumn to track out-of-order events [pinot]
Posted by "tibrewalpratik17 (via GitHub)" <gi...@apache.org>.
tibrewalpratik17 commented on code in PR #11877:
URL: https://github.com/apache/pinot/pull/11877#discussion_r1393334972
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/indexsegment/mutable/MutableSegmentImpl.java:
##########
@@ -496,7 +502,11 @@ public boolean index(GenericRow row, @Nullable RowMetadata rowMetadata)
// segment indexing or addNewRow call errors out in those scenario, there can be metadata inconsistency where
// a key is pointing to some other key's docID
// TODO fix this metadata mismatch scenario
- if (_partitionUpsertMetadataManager.addRecord(this, recordInfo)) {
+ boolean isOutOfOrderRecord = _partitionUpsertMetadataManager.addRecord(this, recordInfo);
+ if (_upsertOutOfOrderRecordColumn != null) {
Review Comment:
Added UTs for this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org