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

[Issue 7347] Avoid the NPE occurs in method ManagedLedgerImpl.isOffloadedNeedsDelete #7389

Merged
merged 7 commits into from Jul 8, 2020

Conversation

gaoran10
Copy link
Contributor

@gaoran10 gaoran10 commented Jun 30, 2020

Fixes #7347

Motivation

The default value of the offload-deletion-lag is null, this will cause an NPE problem.

Modifications

Add null check in the method ManagedLedgerImpl.isOffloadedNeedsDelete.

Verifying this change

Add unit test for method ManagedLedgerImpl.isOffloadedNeedsDelete.

Does this pull request potentially affect one of the following parts:

If yes was chosen, please highlight the changes

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API: (no)
  • The schema: (no)
  • The default values of configurations: (yes)
  • The wire protocol: (no)
  • The rest endpoints: (no)
  • The admin cli options: (no)
  • Anything that affects deployment: (no)

Documentation

  • Does this pull request introduce a new feature? (no)

@gaoran10 gaoran10 changed the title [Offload] Set default value for offload-deletion-lag [Issue 7347] Set default value for offload-deletion-lag Jun 30, 2020
@@ -41,7 +41,7 @@
public final static String[] DRIVER_NAMES = {"S3", "aws-s3", "google-cloud-storage", "filesystem"};
public final static String DEFAULT_OFFLOADER_DIRECTORY = "./offloaders";
public final static long DEFAULT_OFFLOAD_THRESHOLD_IN_BYTES = -1;
public final static Long DEFAULT_OFFLOAD_DELETION_LAG_IN_MILLIS = null;
public final static long DEFAULT_OFFLOAD_DELETION_LAG_IN_MILLIS = -1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we also change managedLedgerOffloadDeletionLagInMillis to long?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This default is couldn't be Null, so I changed this field type to long.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, it's fine. I was just saying to also change the type for the managedLedgerOffloadDeletionLagInMillis field which is currently Long. If null is not a valid value, we should use long type instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I changed it. Thanks.

@gaoran10
Copy link
Contributor Author

gaoran10 commented Jul 1, 2020

/pulsarbot run-failure-checks

1 similar comment
@codelipenghui
Copy link
Contributor

/pulsarbot run-failure-checks

@sijie
Copy link
Member

sijie commented Jul 2, 2020

/pulsarbot run-failure-checks

@sijie
Copy link
Member

sijie commented Jul 2, 2020

/pulsarbot run-failure-checks

@gaoran10
Copy link
Contributor Author

gaoran10 commented Jul 6, 2020

/pulsarbot run-failure-checks

@gaoran10 gaoran10 changed the title [Issue 7347] Set default value for offload-deletion-lag [Issue 7347] Avoid the NPE occurs in method ManagedLedgerImpl.isOffloadedNeedsDelete Jul 6, 2020
@gaoran10
Copy link
Contributor Author

gaoran10 commented Jul 6, 2020

/pulsarbot run-failure-checks

2 similar comments
@gaoran10
Copy link
Contributor Author

gaoran10 commented Jul 6, 2020

/pulsarbot run-failure-checks

@gaoran10
Copy link
Contributor Author

gaoran10 commented Jul 7, 2020

/pulsarbot run-failure-checks

@sijie sijie merged commit eaf268c into apache:master Jul 8, 2020
codelipenghui pushed a commit to streamnative/pulsar-archived that referenced this pull request Jul 14, 2020
…oadedNeedsDelete` (apache#7389)

Fixes apache#7347 

### Motivation

The default value of the offload-deletion-lag is `null`, this will cause an NPE problem.

### Modifications

Add null check in the method `ManagedLedgerImpl.isOffloadedNeedsDelete`.

### Verifying this change

Add unit test for method `ManagedLedgerImpl.isOffloadedNeedsDelete`.

(cherry picked from commit eaf268c)
@lukestephenson-zendesk
Copy link
Contributor

I'm trying to work around this until 2.6.1 is released. Not sure what to do.

The default value of the offload-deletion-lag is null, this will cause an NPE problem

From the docs I thought the default value would be 14400000
image

Will explicitly setting a value for this setting help?

cdbartholomew pushed a commit to kafkaesque-io/pulsar that referenced this pull request Jul 21, 2020
…oadedNeedsDelete` (apache#7389)

Fixes apache#7347 

### Motivation

The default value of the offload-deletion-lag is `null`, this will cause an NPE problem.

### Modifications

Add null check in the method `ManagedLedgerImpl.isOffloadedNeedsDelete`.

### Verifying this change

Add unit test for method `ManagedLedgerImpl.isOffloadedNeedsDelete`.
cdbartholomew pushed a commit to kafkaesque-io/pulsar that referenced this pull request Jul 24, 2020
…oadedNeedsDelete` (apache#7389)

Fixes apache#7347 

### Motivation

The default value of the offload-deletion-lag is `null`, this will cause an NPE problem.

### Modifications

Add null check in the method `ManagedLedgerImpl.isOffloadedNeedsDelete`.

### Verifying this change

Add unit test for method `ManagedLedgerImpl.isOffloadedNeedsDelete`.
wolfstudy pushed a commit that referenced this pull request Jul 29, 2020
…oadedNeedsDelete` (#7389)

Fixes #7347 

### Motivation

The default value of the offload-deletion-lag is `null`, this will cause an NPE problem.

### Modifications

Add null check in the method `ManagedLedgerImpl.isOffloadedNeedsDelete`.

### Verifying this change

Add unit test for method `ManagedLedgerImpl.isOffloadedNeedsDelete`.

(cherry picked from commit eaf268c)
huangdx0726 pushed a commit to huangdx0726/pulsar that referenced this pull request Aug 24, 2020
…oadedNeedsDelete` (apache#7389)

Fixes apache#7347 

### Motivation

The default value of the offload-deletion-lag is `null`, this will cause an NPE problem.

### Modifications

Add null check in the method `ManagedLedgerImpl.isOffloadedNeedsDelete`.

### Verifying this change

Add unit test for method `ManagedLedgerImpl.isOffloadedNeedsDelete`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NPE occurs in the method ManagedLedgerImpl.isOffloadedNeedsDelete.
5 participants