You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2021/08/19 20:36:07 UTC
[GitHub] [geode] ringles opened a new pull request #6776: Create ThreadLocal instance, use to manage DeltaInfos
ringles opened a new pull request #6776:
URL: https://github.com/apache/geode/pull/6776
Using a static ThreadLocal in the RedisData class, we can avoid carrying around an object reference for all instances of RedisData. This saves 4-8 bytes of memory per instance.
--
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@geode.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [geode] dschneider-pivotal commented on a change in pull request #6776: Create ThreadLocal instance, use to manage DeltaInfos
Posted by GitBox <gi...@apache.org>.
dschneider-pivotal commented on a change in pull request #6776:
URL: https://github.com/apache/geode/pull/6776#discussion_r693031998
##########
File path: geode-apis-compatible-with-redis/src/main/java/org/apache/geode/redis/internal/data/AbstractRedisData.java
##########
@@ -168,18 +168,19 @@ public void fromData(DataInput in, DeserializationContext context)
expirationTimestamp = in.readLong();
}
- private void setDelta(DeltaInfo deltaInfo) {
- this.deltaInfo = deltaInfo;
+ private void setDelta(DeltaInfo newDeltaInfo) {
+ deltaInfo.set(newDeltaInfo);
}
@Override
public boolean hasDelta() {
- return deltaInfo != null;
+ return deltaInfo.get() != null;
}
@Override
public void toDelta(DataOutput out) throws IOException {
- deltaInfo.serializeTo(out);
+ deltaInfo.get().serializeTo(out);
+ deltaInfo.remove();
Review comment:
don't call remove here. It you look at storeChanges you will see it already calls setDelta(null) in a finally block. By calling ThreadLocal.remove here you just cause setDelta(null) to recreate an entry in the thread local map.
I think we should not call ThreadLocal.remove at all and the current call of setDelta(null) on storeChanges is all we need
--
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@geode.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [geode] DonalEvans commented on pull request #6776: Create ThreadLocal instance, use to manage DeltaInfos
Posted by GitBox <gi...@apache.org>.
DonalEvans commented on pull request #6776:
URL: https://github.com/apache/geode/pull/6776#issuecomment-902232843
Is there a JIRA ticket associated with this change? If so, please include it in the PR title, and if not, please open one.
--
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@geode.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [geode] ringles commented on pull request #6776: Create ThreadLocal instance, use to manage DeltaInfos
Posted by GitBox <gi...@apache.org>.
ringles commented on pull request #6776:
URL: https://github.com/apache/geode/pull/6776#issuecomment-904796786
Stores deltas for RedisData in a static ThreadLocal in the RedisData class, which avoids carrying around an object reference for all instances of RedisData. This saves 4-8 bytes of memory per RedisData instance.
--
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@geode.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [geode] ringles merged pull request #6776: Create ThreadLocal instance, use to manage DeltaInfos
Posted by GitBox <gi...@apache.org>.
ringles merged pull request #6776:
URL: https://github.com/apache/geode/pull/6776
--
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@geode.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [geode] ringles commented on a change in pull request #6776: Create ThreadLocal instance, use to manage DeltaInfos
Posted by GitBox <gi...@apache.org>.
ringles commented on a change in pull request #6776:
URL: https://github.com/apache/geode/pull/6776#discussion_r694927786
##########
File path: geode-apis-compatible-with-redis/src/main/java/org/apache/geode/redis/internal/data/AbstractRedisData.java
##########
@@ -168,18 +168,19 @@ public void fromData(DataInput in, DeserializationContext context)
expirationTimestamp = in.readLong();
}
- private void setDelta(DeltaInfo deltaInfo) {
- this.deltaInfo = deltaInfo;
+ private void setDelta(DeltaInfo newDeltaInfo) {
+ deltaInfo.set(newDeltaInfo);
}
@Override
public boolean hasDelta() {
- return deltaInfo != null;
+ return deltaInfo.get() != null;
}
@Override
public void toDelta(DataOutput out) throws IOException {
- deltaInfo.serializeTo(out);
+ deltaInfo.get().serializeTo(out);
+ deltaInfo.remove();
Review comment:
It's gone!
--
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@geode.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org