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

Use BytesReference to write to translog files #5463

Closed
wants to merge 1 commit into from

Conversation

kimchy
Copy link
Member

@kimchy kimchy commented Mar 19, 2014

Instead of using byte arrays, pass the BytesReference to the actual translog file, and use the new copyTo(channel) method to write. This will improve by not potentially having to convert the data to a byte array

Instead of using byte arrays, pass the BytesReference to the actual translog file, and use the new copyTo(channel) method to write. This will improve by not potentially having to convert the data to a byte array
@@ -96,6 +97,11 @@ public static int bytesHashCode(BytesReference a) {
void writeTo(OutputStream os) throws IOException;

/**
* Writes the bytes directly to the channel.
*/
void writeTo(GatheringByteChannel channel) 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.

Should it be just WritableByteChannel instead of GatheringByteChannel?

Copy link
Member Author

Choose a reason for hiding this comment

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

netty channel buffer uses GatheringByteChannel for its getBytes version, and its nice to have the option to write ByteBuffer[]. All relevant actual implementations end up implementing GatheringByteChannel so I thought it just makes sense.

@jpountz
Copy link
Contributor

jpountz commented Mar 19, 2014

+1

@kimchy kimchy closed this in d246008 Mar 19, 2014
kimchy added a commit that referenced this pull request Mar 19, 2014
Instead of using byte arrays, pass the BytesReference to the actual translog file, and use the new copyTo(channel) method to write. This will improve by not potentially having to convert the data to a byte array
closes #5463
@kimchy kimchy deleted the bytes_reference_translog branch August 18, 2014 22:11
@clintongormley clintongormley added :Distributed/Distributed A catch all label for anything in the Distributed Area. If you aren't sure, use this one. :Distributed/Engine Anything around managing Lucene and the Translog in an open shard. and removed :Translog :Distributed/Distributed A catch all label for anything in the Distributed Area. If you aren't sure, use this one. labels Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed/Engine Anything around managing Lucene and the Translog in an open shard. >enhancement v1.1.0 v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants