Skip to content

ACCUMULO-4153: Update the getCodec method to no longer be synchronize…#106

Merged
asfgit merged 1 commit intoapache:1.6from
phrocker:ACC-4153
Jul 8, 2016
Merged

ACCUMULO-4153: Update the getCodec method to no longer be synchronize…#106
asfgit merged 1 commit intoapache:1.6from
phrocker:ACC-4153

Conversation

@phrocker
Copy link
Copy Markdown
Contributor

@phrocker phrocker commented Jun 1, 2016

…d using static initializer in enum

Targeting 1.6 as that is the branch we are currently using. I'd rather re-target than ask someone to cherry-pick back.

@phrocker
Copy link
Copy Markdown
Contributor Author

phrocker commented Jun 1, 2016

@madrob When are you cutting 1.7.2? I'd like to make an additional change per @keith-turner and get this into 1.7.2, but don't wanna to slow you down.

@phrocker
Copy link
Copy Markdown
Contributor Author

phrocker commented Jun 1, 2016

Made some change per Keith to avoid synchronization entirely. I initially didn't notice those two functions causing issues; however, I agree that the synchronization isn't necessary. Removing it by using a codec cache when we aren't using the default buffer size for that specific codec.

I'm kind of iffy on the design, but any input by those familiar with the code would be appreciated.


@Override
public Boolean call() throws Exception {
Assert.assertNotNull(Compression.Algorithm.GZ.getCodec());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If an assertion throws an exception in a background thread, will this fail the test?

@madrob
Copy link
Copy Markdown
Contributor

madrob commented Jun 3, 2016

I'm looking at branching after ACCUMULO-4157 makes it in, so there is still time.

@ctubbsii
Copy link
Copy Markdown
Member

ctubbsii commented Jun 3, 2016

@madrob FWIW, the build.sh branches for you, if it helps. Of course, you can still branch first, then let build.sh branch again. It's all local anyway.

* the default within the codec.
*
* There is a Guava cache defined within Algorithm that allows us to cache Codecs for re-use. Since they are immutable, there is no concern for using them
* concurrently; however, the Guava cache exists to ensure a maximal size of the cache and efficient and concurrent read/write access to the cache itself.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@phrocker a few days ago you told me offline that the Codecs maintain an internal reference to a Configuration object. This was why the old code would sync, change the config, then create the stream. When you explained this everything clicked for me. You did not find that w/o some spelunking, might be useful to work this insight into the comments.

@keith-turner
Copy link
Copy Markdown
Contributor

@phrocker I am finished looking at this. +1

@phrocker
Copy link
Copy Markdown
Contributor Author

phrocker commented Jun 7, 2016

Would anyone be opposed to me squashing this into a single commit?

}

@Override
CompressionCodec getCodec() throws IOException {
Copy link
Copy Markdown
Member

@mjwall mjwall Jun 7, 2016

Choose a reason for hiding this comment

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

Can this 'throws IOException' be removed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

They exist because in the codecs that aren't the default ( gz ), they will throw an IOException when the isSupported is false and getCodec is called (i.e. you called it even if a check to isSupported is false.

@keith-turner
Copy link
Copy Markdown
Contributor

Would anyone be opposed to me squashing this into a single commit?

I'm not.

Update the getCodec method to no longer be synchronized using static initializer in enum
Update so that we use a codec cache if we are not using the default buffer size for each specific codec. LZO does not need this change.
Update to improve comments and other readability concerns. Update tests to check
all codecs. Add checks for failures in executor. Instead of more unit
tests with Assume checks, we'll simply use a map and loop in existing
unit tests to check all codecs. A failure in one will cause a failure
@asfgit asfgit merged commit 8d7f04c into apache:1.6 Jul 8, 2016
@keith-turner
Copy link
Copy Markdown
Contributor

Unfortunately this slipped through the cracks and did not make it into 1.7.2. Bummer, I really wanted this in 1.7.2.

I merged this from 1.6 to master, running mvn clean verify -DskipITs at each step. The merge from 1.6 to 1.7 had some conflicts, checkstyle, and findbugs issues that I resolved in the merge commit.

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.

7 participants