You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "sashapolo (via GitHub)" <gi...@apache.org> on 2024/07/22 10:37:10 UTC
[PR] IGNITE-22617 Implement RocksDbMvPartitionStorage#estimatedSize [ignite-3]
sashapolo opened a new pull request, #4118:
URL: https://github.com/apache/ignite-3/pull/4118
https://issues.apache.org/jira/browse/IGNITE-22617
Thank you for submitting the pull request.
To streamline the review process of the patch and ensure better code quality
we ask both an author and a reviewer to verify the following:
### The Review Checklist
- [ ] **Formal criteria:** TC status, codestyle, mandatory documentation. Also make sure to complete the following:
\- There is a single JIRA ticket related to the pull request.
\- The web-link to the pull request is attached to the JIRA ticket.
\- The JIRA ticket has the Patch Available state.
\- The description of the JIRA ticket explains WHAT was made, WHY and HOW.
\- The pull request title is treated as the final commit message. The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
- [ ] **Design:** new code conforms with the design principles of the components it is added to.
- [ ] **Patch quality:** patch cannot be split into smaller pieces, its size must be reasonable.
- [ ] **Code quality:** code is clean and readable, necessary developer documentation is added if needed.
- [ ] **Tests code quality:** test set covers positive/negative scenarios, happy/edge cases. Tests are effective in terms of execution time and resources.
### Notes
- [Apache Ignite Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Java+Code+Style+Guide)
--
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
Re: [PR] IGNITE-22617 Implement RocksDbMvPartitionStorage#estimatedSize [ignite-3]
Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo commented on code in PR #4118:
URL: https://github.com/apache/ignite-3/pull/4118#discussion_r1689390310
##########
modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorage.java:
##########
@@ -599,17 +615,38 @@ public void addWriteCommitted(RowId rowId, @Nullable BinaryRow row, HybridTimest
rowBytes = rowBuffer.array();
}
- try {
- writeBatch.put(helper.partCf, keyBuf.array(), rowBytes);
- } catch (RocksDBException e) {
- throw new StorageException("Failed to update a row in storage: " + createStorageInfo(), e);
- }
- }
+ ByteBuffer keyBuf = prepareHeapKeyBuf(rowId);
- return null;
+ putTimestampDesc(keyBuf, commitTimestamp);
+
+ writeBatch.put(helper.partCf, keyBuf.array(), rowBytes);
+
+ updateEstimatedSize(writeBatch, isNewValueTombstone, addResult);
+
+ return null;
+ } catch (RocksDBException e) {
+ throw new StorageException("Failed to update a row in storage: " + createStorageInfo(), e);
+ }
});
}
+ private void updateEstimatedSize(WriteBatchWithIndex writeBatch, boolean isNewValueTombstone, AddResult gcQueueAddResult)
+ throws RocksDBException {
+ if (isNewValueTombstone) {
+ if (gcQueueAddResult == AddResult.WAS_VALUE) {
+ long newSize = ESTIMATED_SIZE_UPDATER.decrementAndGet(this);
Review Comment:
Nice catch, fixed
--
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
Re: [PR] IGNITE-22617 Implement RocksDbMvPartitionStorage#estimatedSize [ignite-3]
Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo merged PR #4118:
URL: https://github.com/apache/ignite-3/pull/4118
--
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
Re: [PR] IGNITE-22617 Implement RocksDbMvPartitionStorage#estimatedSize [ignite-3]
Posted by "Phillippko (via GitHub)" <gi...@apache.org>.
Phillippko commented on code in PR #4118:
URL: https://github.com/apache/ignite-3/pull/4118#discussion_r1687856835
##########
modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorage.java:
##########
@@ -599,17 +615,38 @@ public void addWriteCommitted(RowId rowId, @Nullable BinaryRow row, HybridTimest
rowBytes = rowBuffer.array();
}
- try {
- writeBatch.put(helper.partCf, keyBuf.array(), rowBytes);
- } catch (RocksDBException e) {
- throw new StorageException("Failed to update a row in storage: " + createStorageInfo(), e);
- }
- }
+ ByteBuffer keyBuf = prepareHeapKeyBuf(rowId);
- return null;
+ putTimestampDesc(keyBuf, commitTimestamp);
+
+ writeBatch.put(helper.partCf, keyBuf.array(), rowBytes);
+
+ updateEstimatedSize(writeBatch, isNewValueTombstone, addResult);
+
+ return null;
+ } catch (RocksDBException e) {
+ throw new StorageException("Failed to update a row in storage: " + createStorageInfo(), e);
+ }
});
}
+ private void updateEstimatedSize(WriteBatchWithIndex writeBatch, boolean isNewValueTombstone, AddResult gcQueueAddResult)
+ throws RocksDBException {
+ if (isNewValueTombstone) {
+ if (gcQueueAddResult == AddResult.WAS_VALUE) {
+ long newSize = ESTIMATED_SIZE_UPDATER.decrementAndGet(this);
Review Comment:
Size was 2. First thread decremented size, got 1. Second thread decremented size, got 0. Second writes to DB 0, then first writes 1. So in DB we have 1. Or no?
--
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