Skip to content

Conversation

@chtyim
Copy link
Contributor

@chtyim chtyim commented Oct 16, 2018

  • Big refactoring to consolidate highly duplicated code between
    Kafka 0.8 and Kafka 0.10 implementations
  • Introduced a common module for the common implementation

Copy link
Contributor

@albertshau albertshau left a comment

Choose a reason for hiding this comment

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

minor comments, thanks for removing all the code duplication

byte[] keyBytes = consumerRecord.key();
byte[] value = consumerRecord.value();
if (value == null) {
LOG.warn("Received message with null message.payload with topic {} and partition {}",
Copy link
Contributor

Choose a reason for hiding this comment

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

was in existing code, but this is better as:

Received message with null payload from partition {} of topic {}.

This also seems like an easy way to flood the log with thousands of warnings. Do you know if the value is ever expected to be null?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably not logging at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Apparently it could be null based on the Kafka source.

* @return a {@link KafkaPartitionOffsets} object decoded from the file
* @throws IOException if failed to read the file
*/
public static KafkaPartitionOffsets load(FileContext fc, Path offsetFile) throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

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

annotate offsetFile as nullable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually it never expected to be null and caller would make sure it is not null (if it is null, the caller shouldn't be able to construct the FileContext).

ETLStage sink = new ETLStage("sink", MockSink.getPlugin(outputName));

ETLBatchConfig pipelineConfig = ETLBatchConfig.builder()
.setTimeSchedule("* * * * *")
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this is not needed


WorkflowManager workflowManager = appManager.getWorkflowManager(SmartWorkflow.NAME);
workflowManager.start(Collections.singletonMap("maxNumberRecords", "-1"));
workflowManager.waitForRun(ProgramRunStatus.COMPLETED, 1, TimeUnit.MINUTES);
Copy link
Contributor

Choose a reason for hiding this comment

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

can use startAndWaitForRun() to simplify a little bit and protect against changes in the future if somebody runs the program before this line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, didn't know we have that.

"A file named with the pipeline name will be created under the given directory.")
@Macro
@Nullable
private String offsetDir;
Copy link
Contributor

Choose a reason for hiding this comment

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

widget files and reference docs need to be updated to include this new property.

Copy link
Contributor

@albertshau albertshau left a comment

Choose a reason for hiding this comment

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

lgtm

…f table

- Big refactoring to consolidate highly duplicated code between
  Kafka 0.8 and Kafka 0.10 implementations
- Introduced a common module for the common implementation
@chtyim chtyim force-pushed the feature/CDAP-14422-offset-file branch from 2987d5a to 59404de Compare October 17, 2018 20:33
@chtyim
Copy link
Contributor Author

chtyim commented Oct 17, 2018

Squashed and merging.

@chtyim chtyim merged commit fea4d79 into develop Oct 17, 2018
@chtyim chtyim deleted the feature/CDAP-14422-offset-file branch October 17, 2018 20:33
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.

2 participants