[GitHub] [lucene-solr] andyvuong commented on a change in pull request #1208: SOLR-13101: Convert nanotime to ms
andyvuong commented on a change in pull request #1208: SOLR-13101: Convert nanotime to ms URL: https://github.com/apache/lucene-solr/pull/1208#discussion_r374839215 ## File path: solr/core/src/java/org/apache/solr/store/blob/util/BlobStoreUtils.java ## @@ -75,6 +76,16 @@ public static String generateMetadataSuffix() { return UUID.randomUUID().toString(); } + /** + * Returns current nano time in millisecond resolution for use in measuring elapsed time. + * + * Note: Do not combine this value with currentTimeMillis - currentTimeMillis will return ms relative to epoch + * while this method returns ms relative to some arbitrary time + */ + public static long getCurrentNanoTimeInMs() { Review comment: Why not just call it getCurrentTimeMs and let the javadoc make it clear it's not the same as System.currentTimeMillis(), the main reason being it was changed originally to fix ant precommit failures? 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org
[GitHub] [lucene-solr] andyvuong commented on a change in pull request #1208: SOLR-13101: Convert nanotime to ms
andyvuong commented on a change in pull request #1208: SOLR-13101: Convert nanotime to ms URL: https://github.com/apache/lucene-solr/pull/1208#discussion_r370891787 ## File path: solr/core/src/java/org/apache/solr/store/blob/metadata/CorePushPull.java ## @@ -499,7 +500,7 @@ void enqueueForHardDelete(BlobCoreMetadataBuilder bcmBuilder) throws Exception { @VisibleForTesting protected boolean okForHardDelete(BlobCoreMetadata.BlobFileToDelete file) { // For now we only check how long ago the file was marked for delete. - return System.nanoTime() - file.getDeletedAt() >= deleteManager.getDeleteDelayMs(); + return (System.nanoTime() / 100) - file.getDeletedAt() >= deleteManager.getDeleteDelayMs(); Review comment: It might be a good idea to update the BlobFileToDelete class to make it explicit via the javadoc (actually it doesn't have any) that the getDeletedAt() returns the timestamp in milliseconds 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org
[GitHub] [lucene-solr] andyvuong commented on a change in pull request #1208: SOLR-13101: Convert nanotime to ms
andyvuong commented on a change in pull request #1208: SOLR-13101: Convert nanotime to ms URL: https://github.com/apache/lucene-solr/pull/1208#discussion_r370891913 ## File path: solr/core/src/java/org/apache/solr/store/blob/metadata/CorePushPull.java ## @@ -114,7 +114,7 @@ protected CoreContainer getContainerFromServerMetadata(ServerSideMetadata solrSe * @param newMetadataSuffix suffix of the new core.metadata file to be created as part of this push */ public BlobCoreMetadata pushToBlobStore(String currentMetadataSuffix, String newMetadataSuffix) throws Exception { - long startTimeMs = System.nanoTime(); + long startTimeMs = System.nanoTime() / 100; Review comment: I'd consider making System.nanoTime() / 100 a util method in BlobStoreUtils 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org