You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "ackelcn (Jira)" <ji...@apache.org> on 2020/07/02 00:32:00 UTC

[jira] [Created] (DERBY-7082) A rotten comment in IndexStatisticsDaemonImpl.java

ackelcn created DERBY-7082:
------------------------------

             Summary: A rotten comment in IndexStatisticsDaemonImpl.java
                 Key: DERBY-7082
                 URL: https://issues.apache.org/jira/browse/DERBY-7082
             Project: Derby
          Issue Type: Bug
            Reporter: ackelcn


When I read the code of DataDictionaryImpl.java, I found a comment:

 
{code:java}
 private void setHeapRowEstimate(TransactionController tc, long tableId,
                                    long rowEstimate)
            throws StandardException {
        // DERBY-4116: If we know the row count, update the store estimated row
        // count for the table.
        ScanController sc = tc.openScan(
    ...
}{code}
The comment mentions DERBY-4116. I found that DERBY-4116 modified AlterTableConstantAction.java, and the patch is as follows:

 

 

 
{code:java}
@@ -779,6 +782,33 @@@@ -779,6 +782,33 @@  
  } // for each leading column (c1) (c1,c2)....   
} // for each index.
++ // DERBY-4116 if there were indexes we scanned, we now know the row count.
+ // Update statistics should update the store estimated row count for the table.
+ // If we didn't scan an index and don't know, numRows will still be -1 and
+ // we skip the estimatedRowCount update.
+ 
+ if (numRows == -1)
+ return;
+ 
+ ScanController heapSC = tc.openScan(td.getHeapConglomerateId(),
+ false,  // hold
+ 0,      // openMode: for read
+ TransactionController.MODE_RECORD, // locking
+ TransactionController.ISOLATION_READ_UNCOMMITTED, //isolation level
+ null,   // scancolumnlist-- want everything.
+ null,   // startkeyvalue-- start from the beginning.+ 0,
+ null,   // qualifiers, none!
+ null,   // stopkeyvalue,+ 0);
+ 
+ try { 
+ heapSC.setEstimatedRowCount(numRows);
+ } finally { 
+ heapSC.close();
+ }
+ }
{code}
The patch modified the updateStatistics method. However, the method is totaly rewritten by follow-up commits, and the method does not contain the above added lines any more.  

 

 

I am wondering whether IndexStatisticsDaemonImpl.java mentions a rotten issue report (DERBY-4116--), in that all the modifications of this issue do not appear in the latest version.

 

Would you please check the problem? If it is, the reference of DERBY-4116 shall be removed from the comment of  DataDictionaryImpl.java.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)