You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "AmatyaAvadhanula (via GitHub)" <gi...@apache.org> on 2023/11/07 07:09:41 UTC
[PR] Better automatic offset reset for Kinesis ingestion (druid)
AmatyaAvadhanula opened a new pull request, #15338:
URL: https://github.com/apache/druid/pull/15338
Kinesis automatic reset attempts to reset the offsets in the metadata store for all the shards in a task even if one of them has fallen behind.
This PR aims to improve this behaviour by resetting the checkpoints for only those partitions for which the sequence numbers are unavailable.
- [ ] been self-reviewed.
- [ ] using the [concurrency checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md) (Remove this item if the PR doesn't have any relation to concurrency.)
- [ ] added documentation for new or modified features or behaviors.
- [ ] a release note entry in the PR description.
- [ ] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
- [ ] added or updated version, license, or notice information in [licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
- [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
- [ ] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for [code coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md) is met.
- [ ] added integration tests.
- [ ] been tested in a test Druid cluster.
--
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@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Better automatic offset reset for Kinesis ingestion (druid)
Posted by "AmatyaAvadhanula (via GitHub)" <gi...@apache.org>.
AmatyaAvadhanula commented on code in PR #15338:
URL: https://github.com/apache/druid/pull/15338#discussion_r1424835235
##########
extensions-core/kinesis-indexing-service/src/main/java/org/apache/druid/indexing/kinesis/KinesisIndexTaskRunner.java:
##########
@@ -125,28 +125,42 @@ protected void possiblyResetDataSourceMetadata(
{
if (!task.getTuningConfig().isSkipSequenceNumberAvailabilityCheck()) {
final ConcurrentMap<String, String> currOffsets = getCurrentOffsets();
+ final Map<StreamPartition<String>, String> shardResetMap = new HashMap<>();
Review Comment:
Done
##########
extensions-core/kinesis-indexing-service/src/main/java/org/apache/druid/indexing/kinesis/KinesisIndexTaskRunner.java:
##########
@@ -125,28 +125,42 @@ protected void possiblyResetDataSourceMetadata(
{
if (!task.getTuningConfig().isSkipSequenceNumberAvailabilityCheck()) {
final ConcurrentMap<String, String> currOffsets = getCurrentOffsets();
+ final Map<StreamPartition<String>, String> shardResetMap = new HashMap<>();
for (final StreamPartition<String> streamPartition : assignment) {
String sequence = currOffsets.get(streamPartition.getPartitionId());
if (!recordSupplier.isOffsetAvailable(streamPartition, KinesisSequenceNumber.of(sequence))) {
- if (task.getTuningConfig().isResetOffsetAutomatically()) {
- log.info("Attempting to reset sequences automatically for all partitions");
- try {
- sendResetRequestAndWait(
- assignment.stream()
- .collect(Collectors.toMap(x -> x, x -> currOffsets.get(x.getPartitionId()))),
- toolbox
- );
- }
- catch (IOException e) {
- throw new ISE(e, "Exception while attempting to automatically reset sequences");
- }
- } else {
+ shardResetMap.put(streamPartition, sequence);
+ }
+ }
+
+ if (!shardResetMap.isEmpty()) {
+ for (Map.Entry<StreamPartition<String>, String> partitionToReset : shardResetMap.entrySet()) {
Review Comment:
Done
--
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@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Better automatic offset reset for Kinesis ingestion (druid)
Posted by "AmatyaAvadhanula (via GitHub)" <gi...@apache.org>.
AmatyaAvadhanula commented on PR #15338:
URL: https://github.com/apache/druid/pull/15338#issuecomment-1851303004
@abhishekrb19, thanks for the review.
Yes, this functionality does not seem to have comprehensive tests and is hard to test in general.
--
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@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Better automatic offset reset for Kinesis ingestion (druid)
Posted by "AmatyaAvadhanula (via GitHub)" <gi...@apache.org>.
AmatyaAvadhanula merged PR #15338:
URL: https://github.com/apache/druid/pull/15338
--
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@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Better automatic offset reset for Kinesis ingestion (druid)
Posted by "abhishekrb19 (via GitHub)" <gi...@apache.org>.
abhishekrb19 commented on code in PR #15338:
URL: https://github.com/apache/druid/pull/15338#discussion_r1423488169
##########
extensions-core/kinesis-indexing-service/src/main/java/org/apache/druid/indexing/kinesis/KinesisIndexTaskRunner.java:
##########
@@ -125,28 +125,42 @@ protected void possiblyResetDataSourceMetadata(
{
if (!task.getTuningConfig().isSkipSequenceNumberAvailabilityCheck()) {
final ConcurrentMap<String, String> currOffsets = getCurrentOffsets();
+ final Map<StreamPartition<String>, String> shardResetMap = new HashMap<>();
for (final StreamPartition<String> streamPartition : assignment) {
String sequence = currOffsets.get(streamPartition.getPartitionId());
if (!recordSupplier.isOffsetAvailable(streamPartition, KinesisSequenceNumber.of(sequence))) {
- if (task.getTuningConfig().isResetOffsetAutomatically()) {
- log.info("Attempting to reset sequences automatically for all partitions");
- try {
- sendResetRequestAndWait(
- assignment.stream()
- .collect(Collectors.toMap(x -> x, x -> currOffsets.get(x.getPartitionId()))),
- toolbox
- );
- }
- catch (IOException e) {
- throw new ISE(e, "Exception while attempting to automatically reset sequences");
- }
- } else {
+ shardResetMap.put(streamPartition, sequence);
+ }
+ }
+
+ if (!shardResetMap.isEmpty()) {
+ for (Map.Entry<StreamPartition<String>, String> partitionToReset : shardResetMap.entrySet()) {
Review Comment:
nit: `partitionToReset` -> `partitionToSequence`
##########
extensions-core/kinesis-indexing-service/src/main/java/org/apache/druid/indexing/kinesis/KinesisIndexTaskRunner.java:
##########
@@ -125,28 +125,42 @@ protected void possiblyResetDataSourceMetadata(
{
if (!task.getTuningConfig().isSkipSequenceNumberAvailabilityCheck()) {
final ConcurrentMap<String, String> currOffsets = getCurrentOffsets();
+ final Map<StreamPartition<String>, String> shardResetMap = new HashMap<>();
Review Comment:
nit: for clarity, maybe call this map `partitionToSequenceResetMap` since we refer to the keys and values of the map a few times?
--
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@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Better automatic offset reset for Kinesis ingestion (druid)
Posted by "AmatyaAvadhanula (via GitHub)" <gi...@apache.org>.
AmatyaAvadhanula commented on code in PR #15338:
URL: https://github.com/apache/druid/pull/15338#discussion_r1423403298
##########
extensions-core/kinesis-indexing-service/src/main/java/org/apache/druid/indexing/kinesis/KinesisIndexTaskRunner.java:
##########
@@ -125,28 +125,31 @@ protected void possiblyResetDataSourceMetadata(
{
if (!task.getTuningConfig().isSkipSequenceNumberAvailabilityCheck()) {
final ConcurrentMap<String, String> currOffsets = getCurrentOffsets();
+ final Map<StreamPartition<String>, String> shardResetMap = new HashMap<>();
for (final StreamPartition<String> streamPartition : assignment) {
String sequence = currOffsets.get(streamPartition.getPartitionId());
if (!recordSupplier.isOffsetAvailable(streamPartition, KinesisSequenceNumber.of(sequence))) {
- if (task.getTuningConfig().isResetOffsetAutomatically()) {
- log.info("Attempting to reset sequences automatically for all partitions");
- try {
- sendResetRequestAndWait(
- assignment.stream()
- .collect(Collectors.toMap(x -> x, x -> currOffsets.get(x.getPartitionId()))),
- toolbox
- );
- }
- catch (IOException e) {
- throw new ISE(e, "Exception while attempting to automatically reset sequences");
- }
- } else {
- throw new ISE(
- "Starting sequenceNumber [%s] is no longer available for partition [%s] and resetOffsetAutomatically is not enabled",
- sequence,
- streamPartition.getPartitionId()
- );
+ shardResetMap.put(streamPartition, sequence);
+ }
+ }
+
+ if (!shardResetMap.isEmpty()) {
+ for (Map.Entry<StreamPartition<String>, String> partitionToReset : shardResetMap.entrySet()) {
+ log.warn("Starting sequence number [%s] is no longer available for partition [%s]",
Review Comment:
Done
##########
extensions-core/kinesis-indexing-service/src/main/java/org/apache/druid/indexing/kinesis/KinesisIndexTaskRunner.java:
##########
@@ -125,28 +125,31 @@ protected void possiblyResetDataSourceMetadata(
{
if (!task.getTuningConfig().isSkipSequenceNumberAvailabilityCheck()) {
final ConcurrentMap<String, String> currOffsets = getCurrentOffsets();
+ final Map<StreamPartition<String>, String> shardResetMap = new HashMap<>();
for (final StreamPartition<String> streamPartition : assignment) {
String sequence = currOffsets.get(streamPartition.getPartitionId());
if (!recordSupplier.isOffsetAvailable(streamPartition, KinesisSequenceNumber.of(sequence))) {
- if (task.getTuningConfig().isResetOffsetAutomatically()) {
- log.info("Attempting to reset sequences automatically for all partitions");
- try {
- sendResetRequestAndWait(
- assignment.stream()
- .collect(Collectors.toMap(x -> x, x -> currOffsets.get(x.getPartitionId()))),
- toolbox
- );
- }
- catch (IOException e) {
- throw new ISE(e, "Exception while attempting to automatically reset sequences");
- }
- } else {
- throw new ISE(
- "Starting sequenceNumber [%s] is no longer available for partition [%s] and resetOffsetAutomatically is not enabled",
- sequence,
- streamPartition.getPartitionId()
- );
+ shardResetMap.put(streamPartition, sequence);
+ }
+ }
+
+ if (!shardResetMap.isEmpty()) {
+ for (Map.Entry<StreamPartition<String>, String> partitionToReset : shardResetMap.entrySet()) {
+ log.warn("Starting sequence number [%s] is no longer available for partition [%s]",
+ partitionToReset.getValue(),
+ partitionToReset.getKey().getPartitionId()
+ );
+ }
+ if (task.getTuningConfig().isResetOffsetAutomatically()) {
+ log.info("Attempting to reset offsets for [%d] partitions.", shardResetMap.size());
Review Comment:
Done
##########
extensions-core/kinesis-indexing-service/src/main/java/org/apache/druid/indexing/kinesis/KinesisIndexTaskRunner.java:
##########
@@ -125,28 +125,31 @@ protected void possiblyResetDataSourceMetadata(
{
if (!task.getTuningConfig().isSkipSequenceNumberAvailabilityCheck()) {
final ConcurrentMap<String, String> currOffsets = getCurrentOffsets();
+ final Map<StreamPartition<String>, String> shardResetMap = new HashMap<>();
for (final StreamPartition<String> streamPartition : assignment) {
String sequence = currOffsets.get(streamPartition.getPartitionId());
if (!recordSupplier.isOffsetAvailable(streamPartition, KinesisSequenceNumber.of(sequence))) {
- if (task.getTuningConfig().isResetOffsetAutomatically()) {
- log.info("Attempting to reset sequences automatically for all partitions");
- try {
- sendResetRequestAndWait(
- assignment.stream()
- .collect(Collectors.toMap(x -> x, x -> currOffsets.get(x.getPartitionId()))),
- toolbox
- );
- }
- catch (IOException e) {
- throw new ISE(e, "Exception while attempting to automatically reset sequences");
- }
- } else {
- throw new ISE(
- "Starting sequenceNumber [%s] is no longer available for partition [%s] and resetOffsetAutomatically is not enabled",
- sequence,
- streamPartition.getPartitionId()
- );
+ shardResetMap.put(streamPartition, sequence);
+ }
+ }
+
+ if (!shardResetMap.isEmpty()) {
+ for (Map.Entry<StreamPartition<String>, String> partitionToReset : shardResetMap.entrySet()) {
+ log.warn("Starting sequence number [%s] is no longer available for partition [%s]",
+ partitionToReset.getValue(),
+ partitionToReset.getKey().getPartitionId()
+ );
+ }
+ if (task.getTuningConfig().isResetOffsetAutomatically()) {
+ log.info("Attempting to reset offsets for [%d] partitions.", shardResetMap.size());
+ try {
+ sendResetRequestAndWait(shardResetMap, toolbox);
+ }
+ catch (IOException e) {
+ throw new ISE(e, "Exception while attempting to automatically reset sequences");
Review Comment:
Done
##########
extensions-core/kinesis-indexing-service/src/main/java/org/apache/druid/indexing/kinesis/KinesisIndexTaskRunner.java:
##########
@@ -125,28 +125,31 @@ protected void possiblyResetDataSourceMetadata(
{
if (!task.getTuningConfig().isSkipSequenceNumberAvailabilityCheck()) {
final ConcurrentMap<String, String> currOffsets = getCurrentOffsets();
+ final Map<StreamPartition<String>, String> shardResetMap = new HashMap<>();
for (final StreamPartition<String> streamPartition : assignment) {
String sequence = currOffsets.get(streamPartition.getPartitionId());
if (!recordSupplier.isOffsetAvailable(streamPartition, KinesisSequenceNumber.of(sequence))) {
- if (task.getTuningConfig().isResetOffsetAutomatically()) {
- log.info("Attempting to reset sequences automatically for all partitions");
- try {
- sendResetRequestAndWait(
- assignment.stream()
- .collect(Collectors.toMap(x -> x, x -> currOffsets.get(x.getPartitionId()))),
- toolbox
- );
- }
- catch (IOException e) {
- throw new ISE(e, "Exception while attempting to automatically reset sequences");
- }
- } else {
- throw new ISE(
- "Starting sequenceNumber [%s] is no longer available for partition [%s] and resetOffsetAutomatically is not enabled",
- sequence,
- streamPartition.getPartitionId()
- );
+ shardResetMap.put(streamPartition, sequence);
+ }
+ }
+
+ if (!shardResetMap.isEmpty()) {
+ for (Map.Entry<StreamPartition<String>, String> partitionToReset : shardResetMap.entrySet()) {
+ log.warn("Starting sequence number [%s] is no longer available for partition [%s]",
+ partitionToReset.getValue(),
+ partitionToReset.getKey().getPartitionId()
+ );
+ }
+ if (task.getTuningConfig().isResetOffsetAutomatically()) {
+ log.info("Attempting to reset offsets for [%d] partitions.", shardResetMap.size());
+ try {
+ sendResetRequestAndWait(shardResetMap, toolbox);
+ }
+ catch (IOException e) {
+ throw new ISE(e, "Exception while attempting to automatically reset sequences");
}
+ } else {
+ throw new ISE("Sequence numbers are unavailable but automatic offset reset is disabled.");
Review Comment:
Done
--
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@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Better automatic offset reset for Kinesis ingestion (druid)
Posted by "abhishekrb19 (via GitHub)" <gi...@apache.org>.
abhishekrb19 commented on code in PR #15338:
URL: https://github.com/apache/druid/pull/15338#discussion_r1399648539
##########
extensions-core/kinesis-indexing-service/src/main/java/org/apache/druid/indexing/kinesis/KinesisIndexTaskRunner.java:
##########
@@ -125,28 +125,31 @@ protected void possiblyResetDataSourceMetadata(
{
if (!task.getTuningConfig().isSkipSequenceNumberAvailabilityCheck()) {
final ConcurrentMap<String, String> currOffsets = getCurrentOffsets();
+ final Map<StreamPartition<String>, String> shardResetMap = new HashMap<>();
for (final StreamPartition<String> streamPartition : assignment) {
String sequence = currOffsets.get(streamPartition.getPartitionId());
if (!recordSupplier.isOffsetAvailable(streamPartition, KinesisSequenceNumber.of(sequence))) {
- if (task.getTuningConfig().isResetOffsetAutomatically()) {
- log.info("Attempting to reset sequences automatically for all partitions");
- try {
- sendResetRequestAndWait(
- assignment.stream()
- .collect(Collectors.toMap(x -> x, x -> currOffsets.get(x.getPartitionId()))),
- toolbox
- );
- }
- catch (IOException e) {
- throw new ISE(e, "Exception while attempting to automatically reset sequences");
- }
- } else {
- throw new ISE(
- "Starting sequenceNumber [%s] is no longer available for partition [%s] and resetOffsetAutomatically is not enabled",
- sequence,
- streamPartition.getPartitionId()
- );
+ shardResetMap.put(streamPartition, sequence);
+ }
+ }
+
+ if (!shardResetMap.isEmpty()) {
+ for (Map.Entry<StreamPartition<String>, String> partitionToReset : shardResetMap.entrySet()) {
+ log.warn("Starting sequence number [%s] is no longer available for partition [%s]",
+ partitionToReset.getValue(),
+ partitionToReset.getKey().getPartitionId()
+ );
+ }
+ if (task.getTuningConfig().isResetOffsetAutomatically()) {
+ log.info("Attempting to reset offsets for [%d] partitions.", shardResetMap.size());
+ try {
+ sendResetRequestAndWait(shardResetMap, toolbox);
+ }
+ catch (IOException e) {
+ throw new ISE(e, "Exception while attempting to automatically reset sequences");
Review Comment:
Same, perhaps include `shardResetMap` keys in the exception?
##########
extensions-core/kinesis-indexing-service/src/main/java/org/apache/druid/indexing/kinesis/KinesisIndexTaskRunner.java:
##########
@@ -125,28 +125,31 @@ protected void possiblyResetDataSourceMetadata(
{
if (!task.getTuningConfig().isSkipSequenceNumberAvailabilityCheck()) {
final ConcurrentMap<String, String> currOffsets = getCurrentOffsets();
+ final Map<StreamPartition<String>, String> shardResetMap = new HashMap<>();
for (final StreamPartition<String> streamPartition : assignment) {
String sequence = currOffsets.get(streamPartition.getPartitionId());
if (!recordSupplier.isOffsetAvailable(streamPartition, KinesisSequenceNumber.of(sequence))) {
- if (task.getTuningConfig().isResetOffsetAutomatically()) {
- log.info("Attempting to reset sequences automatically for all partitions");
- try {
- sendResetRequestAndWait(
- assignment.stream()
- .collect(Collectors.toMap(x -> x, x -> currOffsets.get(x.getPartitionId()))),
- toolbox
- );
- }
- catch (IOException e) {
- throw new ISE(e, "Exception while attempting to automatically reset sequences");
- }
- } else {
- throw new ISE(
- "Starting sequenceNumber [%s] is no longer available for partition [%s] and resetOffsetAutomatically is not enabled",
- sequence,
- streamPartition.getPartitionId()
- );
+ shardResetMap.put(streamPartition, sequence);
+ }
+ }
+
+ if (!shardResetMap.isEmpty()) {
+ for (Map.Entry<StreamPartition<String>, String> partitionToReset : shardResetMap.entrySet()) {
+ log.warn("Starting sequence number [%s] is no longer available for partition [%s]",
+ partitionToReset.getValue(),
+ partitionToReset.getKey().getPartitionId()
+ );
+ }
+ if (task.getTuningConfig().isResetOffsetAutomatically()) {
+ log.info("Attempting to reset offsets for [%d] partitions.", shardResetMap.size());
Review Comment:
Partitions that repeatedly fall off the stream and get reset automatically would indicate an underlying issue, so I think logging the partition keys `shardResetMap.keys()` would be useful
##########
extensions-core/kinesis-indexing-service/src/main/java/org/apache/druid/indexing/kinesis/KinesisIndexTaskRunner.java:
##########
@@ -125,28 +125,31 @@ protected void possiblyResetDataSourceMetadata(
{
if (!task.getTuningConfig().isSkipSequenceNumberAvailabilityCheck()) {
final ConcurrentMap<String, String> currOffsets = getCurrentOffsets();
+ final Map<StreamPartition<String>, String> shardResetMap = new HashMap<>();
for (final StreamPartition<String> streamPartition : assignment) {
String sequence = currOffsets.get(streamPartition.getPartitionId());
if (!recordSupplier.isOffsetAvailable(streamPartition, KinesisSequenceNumber.of(sequence))) {
- if (task.getTuningConfig().isResetOffsetAutomatically()) {
- log.info("Attempting to reset sequences automatically for all partitions");
- try {
- sendResetRequestAndWait(
- assignment.stream()
- .collect(Collectors.toMap(x -> x, x -> currOffsets.get(x.getPartitionId()))),
- toolbox
- );
- }
- catch (IOException e) {
- throw new ISE(e, "Exception while attempting to automatically reset sequences");
- }
- } else {
- throw new ISE(
- "Starting sequenceNumber [%s] is no longer available for partition [%s] and resetOffsetAutomatically is not enabled",
- sequence,
- streamPartition.getPartitionId()
- );
+ shardResetMap.put(streamPartition, sequence);
+ }
+ }
+
+ if (!shardResetMap.isEmpty()) {
+ for (Map.Entry<StreamPartition<String>, String> partitionToReset : shardResetMap.entrySet()) {
+ log.warn("Starting sequence number [%s] is no longer available for partition [%s]",
Review Comment:
```suggestion
log.warn("Starting sequenceNumber[%s] is no longer available for partition[%s]",
```
##########
extensions-core/kinesis-indexing-service/src/main/java/org/apache/druid/indexing/kinesis/KinesisIndexTaskRunner.java:
##########
@@ -125,28 +125,31 @@ protected void possiblyResetDataSourceMetadata(
{
if (!task.getTuningConfig().isSkipSequenceNumberAvailabilityCheck()) {
final ConcurrentMap<String, String> currOffsets = getCurrentOffsets();
+ final Map<StreamPartition<String>, String> shardResetMap = new HashMap<>();
for (final StreamPartition<String> streamPartition : assignment) {
String sequence = currOffsets.get(streamPartition.getPartitionId());
if (!recordSupplier.isOffsetAvailable(streamPartition, KinesisSequenceNumber.of(sequence))) {
- if (task.getTuningConfig().isResetOffsetAutomatically()) {
- log.info("Attempting to reset sequences automatically for all partitions");
- try {
- sendResetRequestAndWait(
- assignment.stream()
- .collect(Collectors.toMap(x -> x, x -> currOffsets.get(x.getPartitionId()))),
- toolbox
- );
- }
- catch (IOException e) {
- throw new ISE(e, "Exception while attempting to automatically reset sequences");
- }
- } else {
- throw new ISE(
- "Starting sequenceNumber [%s] is no longer available for partition [%s] and resetOffsetAutomatically is not enabled",
- sequence,
- streamPartition.getPartitionId()
- );
+ shardResetMap.put(streamPartition, sequence);
+ }
+ }
+
+ if (!shardResetMap.isEmpty()) {
+ for (Map.Entry<StreamPartition<String>, String> partitionToReset : shardResetMap.entrySet()) {
+ log.warn("Starting sequence number [%s] is no longer available for partition [%s]",
+ partitionToReset.getValue(),
+ partitionToReset.getKey().getPartitionId()
+ );
+ }
+ if (task.getTuningConfig().isResetOffsetAutomatically()) {
+ log.info("Attempting to reset offsets for [%d] partitions.", shardResetMap.size());
+ try {
+ sendResetRequestAndWait(shardResetMap, toolbox);
+ }
+ catch (IOException e) {
+ throw new ISE(e, "Exception while attempting to automatically reset sequences");
}
+ } else {
+ throw new ISE("Sequence numbers are unavailable but automatic offset reset is disabled.");
Review Comment:
Collect the unavailable partitions above and include them in the exception (instead of an end user having to dig up logs)?
--
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@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org