You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "stefanvodita (via GitHub)" <gi...@apache.org> on 2023/07/22 10:27:58 UTC

[GitHub] [lucene] stefanvodita opened a new pull request, #12454: Clean up ordinal map in default SSDV reader state

stefanvodita opened a new pull request, #12454:
URL: https://github.com/apache/lucene/pull/12454

   `DefaultSortedSetDocValuesReaderState` has a cache of ordinal maps, but it only has one ordinal map in it at most.
   
   This PR preserves the functionality of the class, but removes `cachedOrdMaps`. We can't synchronise on the ordinal map itself, since it could be `null`, so we introduce an ordinal map lock instead.
   
   Overall, I like the previous code a bit better, it's cleaner and more concise, although `cachedOrdMaps` looks confusing at first. Maybe it just needs a comment explaining why using a map is convenient (we can synchronize on it, we can call `Accountables.namedAccountables` with it)? I'd like to hear what others think.


-- 
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: issues-unsubscribe@lucene.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


Re: [PR] Clean up ordinal map in default SSDV reader state [lucene]

Posted by "mikemccand (via GitHub)" <gi...@apache.org>.
mikemccand commented on PR #12454:
URL: https://github.com/apache/lucene/pull/12454#issuecomment-1803628190

   > Thanks Greg! I think the delay is partially my fault, I had mentioned a different G. Miller in my message 😄
   
   Seems to be common mistake recently!  See this [recent hilarious example](https://github.com/apache/lucene/pull/414#issuecomment-1793499490)!


-- 
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: issues-unsubscribe@lucene.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] stefanvodita commented on pull request #12454: Clean up ordinal map in default SSDV reader state

Posted by "stefanvodita (via GitHub)" <gi...@apache.org>.
stefanvodita commented on PR #12454:
URL: https://github.com/apache/lucene/pull/12454#issuecomment-1656692746

   Thanks Greg! I’ve kept the hash map and did some clean-up.


-- 
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: issues-unsubscribe@lucene.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


Re: [PR] Clean up ordinal map in default SSDV reader state [lucene]

Posted by "gsmiller (via GitHub)" <gi...@apache.org>.
gsmiller merged PR #12454:
URL: https://github.com/apache/lucene/pull/12454


-- 
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: issues-unsubscribe@lucene.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


Re: [PR] Clean up ordinal map in default SSDV reader state [lucene]

Posted by "stefanvodita (via GitHub)" <gi...@apache.org>.
stefanvodita commented on PR #12454:
URL: https://github.com/apache/lucene/pull/12454#issuecomment-1803605667

   Thanks Greg! I think the delay is partially my fault, I had mentioned a different G. Miller in my message 😄 


-- 
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: issues-unsubscribe@lucene.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] stefanvodita commented on a diff in pull request #12454: Clean up ordinal map in default SSDV reader state

Posted by "stefanvodita (via GitHub)" <gi...@apache.org>.
stefanvodita commented on code in PR #12454:
URL: https://github.com/apache/lucene/pull/12454#discussion_r1278280338


##########
lucene/facet/src/java/org/apache/lucene/facet/sortedset/DefaultSortedSetDocValuesReaderState.java:
##########
@@ -233,13 +239,13 @@ private int createOneFlatFacetDimState(SortedSetDocValues dv, int dimStartOrd)
   /** Return the memory usage of this object in bytes. Negative values are illegal. */
   @Override
   public long ramBytesUsed() {
-    synchronized (cachedOrdMaps) {
-      long bytes = 0;
-      for (OrdinalMap map : cachedOrdMaps.values()) {
-        bytes += map.ramBytesUsed();
+    synchronized (cachedOrdMap) {

Review Comment:
   We might not need this synchronization. Because the map has one entry at most and we're only writing it once, I don't think we can end up in an invalid state here, but it seemes wiser not to rely on that.



-- 
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: issues-unsubscribe@lucene.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


Re: [PR] Clean up ordinal map in default SSDV reader state [lucene]

Posted by "gsmiller (via GitHub)" <gi...@apache.org>.
gsmiller commented on PR #12454:
URL: https://github.com/apache/lucene/pull/12454#issuecomment-1802519348

   > @gsmiller, I think this PR is ready. Is there anything else you'd like to see changed?
   
   Gah! I'm sorry I missed this. I'll have a look here shortly. Apologies again.


-- 
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: issues-unsubscribe@lucene.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] stefanvodita commented on pull request #12454: Clean up ordinal map in default SSDV reader state

Posted by "stefanvodita (via GitHub)" <gi...@apache.org>.
stefanvodita commented on PR #12454:
URL: https://github.com/apache/lucene/pull/12454#issuecomment-1732315340

   @gmiller, I think this PR is ready. Is there anything else you'd like to see changed?


-- 
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: issues-unsubscribe@lucene.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] gsmiller commented on pull request #12454: Clean up ordinal map in default SSDV reader state

Posted by "gsmiller (via GitHub)" <gi...@apache.org>.
gsmiller commented on PR #12454:
URL: https://github.com/apache/lucene/pull/12454#issuecomment-1656481929

   > Overall, I like the previous code a bit better, it's cleaner and more concise, although cachedOrdMaps looks confusing at first. Maybe it just needs a comment explaining why using a map is convenient (we can synchronize on it, we can call Accountables.namedAccountables with it)? I'd like to hear what others think.
   
   Personally, I agree with this. Maybe we clean up the documentation and leave as-is?


-- 
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: issues-unsubscribe@lucene.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org