You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2022/02/11 09:55:50 UTC

[GitHub] [ignite-3] ibessonov opened a new pull request #654: IGNITE-16527 Reduced byte arrays allocation in usages of SearchRow interface.

ibessonov opened a new pull request #654:
URL: https://github.com/apache/ignite-3/pull/654


   https://issues.apache.org/jira/browse/IGNITE-16527


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] sashapolo commented on a change in pull request #654: IGNITE-16527 Reduced byte arrays allocation in usages of SearchRow interface.

Posted by GitBox <gi...@apache.org>.
sashapolo commented on a change in pull request #654:
URL: https://github.com/apache/ignite-3/pull/654#discussion_r804750415



##########
File path: modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbPartitionStorage.java
##########
@@ -494,16 +491,29 @@ protected DataRow decodeEntry(byte[] key, byte[] value) {
      * Creates a key used in this partition storage by prepending a partition ID (to distinguish between different partition data)
      * and the key's hash (an optimisation).
      */
-    private byte[] partitionKey(byte[] key) {
-        return ByteBuffer.allocate(PARTITION_KEY_PREFIX_SIZE + key.length)
+    private byte[] partitionKey(SearchRow key) {
+        ByteBuffer keyBuffer = key.key().rewind();
+
+        return ByteBuffer.allocate(PARTITION_KEY_PREFIX_SIZE + keyBuffer.capacity())

Review comment:
       I'm not sure that `capacity` is the correct method to use here, since buffer's `capacity` can be larger than its `limit`

##########
File path: modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbPartitionStorage.java
##########
@@ -494,16 +491,29 @@ protected DataRow decodeEntry(byte[] key, byte[] value) {
      * Creates a key used in this partition storage by prepending a partition ID (to distinguish between different partition data)
      * and the key's hash (an optimisation).
      */
-    private byte[] partitionKey(byte[] key) {
-        return ByteBuffer.allocate(PARTITION_KEY_PREFIX_SIZE + key.length)
+    private byte[] partitionKey(SearchRow key) {
+        ByteBuffer keyBuffer = key.key().rewind();

Review comment:
       I think that `rewind` should be called inside `key.key()`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] ibessonov commented on a change in pull request #654: IGNITE-16527 Reduced byte arrays allocation in usages of SearchRow interface.

Posted by GitBox <gi...@apache.org>.
ibessonov commented on a change in pull request #654:
URL: https://github.com/apache/ignite-3/pull/654#discussion_r805572317



##########
File path: modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbPartitionStorage.java
##########
@@ -494,16 +491,29 @@ protected DataRow decodeEntry(byte[] key, byte[] value) {
      * Creates a key used in this partition storage by prepending a partition ID (to distinguish between different partition data)
      * and the key's hash (an optimisation).
      */
-    private byte[] partitionKey(byte[] key) {
-        return ByteBuffer.allocate(PARTITION_KEY_PREFIX_SIZE + key.length)
+    private byte[] partitionKey(SearchRow key) {
+        ByteBuffer keyBuffer = key.key().rewind();
+
+        return ByteBuffer.allocate(PARTITION_KEY_PREFIX_SIZE + keyBuffer.capacity())

Review comment:
       Alright, I'll change it to limit




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] ibessonov merged pull request #654: IGNITE-16527 Reduced byte arrays allocation in usages of SearchRow interface.

Posted by GitBox <gi...@apache.org>.
ibessonov merged pull request #654:
URL: https://github.com/apache/ignite-3/pull/654


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] ibessonov merged pull request #654: IGNITE-16527 Reduced byte arrays allocation in usages of SearchRow interface.

Posted by GitBox <gi...@apache.org>.
ibessonov merged pull request #654:
URL: https://github.com/apache/ignite-3/pull/654


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] ibessonov commented on a change in pull request #654: IGNITE-16527 Reduced byte arrays allocation in usages of SearchRow interface.

Posted by GitBox <gi...@apache.org>.
ibessonov commented on a change in pull request #654:
URL: https://github.com/apache/ignite-3/pull/654#discussion_r805572432



##########
File path: modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbPartitionStorage.java
##########
@@ -494,16 +491,29 @@ protected DataRow decodeEntry(byte[] key, byte[] value) {
      * Creates a key used in this partition storage by prepending a partition ID (to distinguish between different partition data)
      * and the key's hash (an optimisation).
      */
-    private byte[] partitionKey(byte[] key) {
-        return ByteBuffer.allocate(PARTITION_KEY_PREFIX_SIZE + key.length)
+    private byte[] partitionKey(SearchRow key) {
+        ByteBuffer keyBuffer = key.key().rewind();

Review comment:
       Ok, I see your point




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org