Skip to content

removes mutable list constant from DefaultKeySizeConstraint#6163

Merged
keith-turner merged 5 commits intoapache:2.1from
keith-turner:remove-mutable-constant
Mar 4, 2026
Merged

removes mutable list constant from DefaultKeySizeConstraint#6163
keith-turner merged 5 commits intoapache:2.1from
keith-turner:remove-mutable-constant

Conversation

@keith-turner
Copy link
Contributor

No description provided.

@keith-turner keith-turner added this to the 2.1.5 milestone Mar 2, 2026
@keith-turner
Copy link
Contributor Author

Saw an odd test failure on #6162, not sure how it happened but suspect another unit test modified the mutable list constant that was in DefaultKeySizeConstraint

https://github.com/apache/accumulo/actions/runs/22591069279/job/65449119120

[ERROR] Failures: 
[ERROR]   DefaultKeySizeConstraintTest.testConstraint:42 expected: <[]> but was: <[2]>

@Override
public List<Short> check(Environment env, Mutation mutation) {

// fast size check
if (mutation.numBytes() < maxSize) {
return NO_VIOLATIONS;
return null;
Copy link
Member

Choose a reason for hiding this comment

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

This is a change in behavior, which I think we should probably try to avoid, unless... is null documented as a special case?

Alternatively, could replace this with an unmodifiable or immutable list.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, the javadoc for the super class says to return null when there are no violations.

* Checks a mutation for constraint violations. If the mutation contains no violations, returns
* null. Otherwise, returns a list of violation codes.

ctubbsii
ctubbsii previously approved these changes Mar 3, 2026
@ctubbsii ctubbsii dismissed their stale review March 3, 2026 20:55

This needs to be based on 2.1 to fix it there.

@keith-turner keith-turner changed the base branch from main to 2.1 March 3, 2026 21:45
@keith-turner keith-turner merged commit ce23b95 into apache:2.1 Mar 4, 2026
9 checks passed
@keith-turner keith-turner deleted the remove-mutable-constant branch March 4, 2026 00:17
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.

3 participants