Project

General

Profile

« Previous | Next » 

Revision 3468

Added by Jing Tao about 17 years ago

Add debug information.

View differences:

src/edu/ucsb/nceas/metacat/DocumentImpl.java
2099 2099
                        .getOption("usexmlindex"))).booleanValue();
2100 2100
                if (useXMLIndex) {
2101 2101
                    logMetacat.info("before delete");
2102
                    double start = System.currentTimeMillis()/1000;
2102 2103
                    // Delete index for the old version of docid
2103 2104
                    // The new index is inserting on the next calls to DBSAXNode
2104 2105
                    pstmt = connection
2105 2106
                            .prepareStatement("DELETE FROM xml_index WHERE docid='"
2106 2107
                                    + this.docid + "'");
2107
                    logMetacat.info("after delete");
2108
                   
2108 2109
                    // Increase dbconnection usage count
2109 2110
                    connection.increaseUsageCount(1);
2110 2111
                  
2111 2112
                    pstmt.execute();
2112 2113
                  
2113 2114
                    pstmt.close();
2115
                    double end = System.currentTimeMillis()/1000;
2116
                    logMetacat.info("Time for deletindex xml_index in UPDATE is "+(end -start));
2114 2117
                }
2115 2118

  
2116 2119
                // Update the new document to reflect the new node tree
......
2838 2841
            }
2839 2842

  
2840 2843
            logMetacat.warn("Start deleting doc " + docid + "...");
2844
            double start = System.currentTimeMillis()/1000;
2841 2845
            // check for 'write' permission for 'user' to delete this document
2842 2846
            if (!hasAllPermission(user, groups, accnum)) {
2843 2847
                if(!MetaCatUtil.isAdministrator(user, groups)){
......
2851 2855
            conn.setAutoCommit(false);
2852 2856
            // Copy the record to the xml_revisions table
2853 2857
            DocumentImpl.archiveDocAndNodesRevision(conn, docid, user, null);
2854

  
2858
            double afterArchiveDocAndNode = System.currentTimeMillis()/1000;
2859
            logMetacat.info("The time for archiveDocAndNodesRevision is "+(afterArchiveDocAndNode - start));
2855 2860
            // Now delete it from the xml_index table
2856 2861
            boolean useXMLIndex = (new Boolean(MetaCatUtil
2857 2862
                    .getOption("usexmlindex"))).booleanValue();
......
2866 2871
            pstmt.close();
2867 2872
            conn.increaseUsageCount(1);
2868 2873
            //}
2869

  
2874
            double afterDeleteIndex = System.currentTimeMillis()/1000;
2875
            logMetacat.info("The deleting xml_index time is "+(afterDeleteIndex - afterArchiveDocAndNode ));
2870 2876
            // Now delete it from xml_access table
2871 2877
            pstmt = conn.prepareStatement(
2872 2878
                    "DELETE FROM xml_access WHERE accessfileid = ?");
......
2874 2880
            pstmt.execute();
2875 2881
            pstmt.close();
2876 2882
            conn.increaseUsageCount(1);
2877

  
2883
            double afterDeleteXmlAccess1 = System.currentTimeMillis()/1000;
2884
            logMetacat.info("The deleting xml_access base one accessfileid time is "+(afterDeleteXmlAccess1 - afterDeleteIndex ));
2878 2885
            pstmt = conn.prepareStatement(
2879 2886
                    "DELETE FROM xml_access WHERE docid = ?");
2880 2887
            pstmt.setString(1, docid);
2881 2888
            pstmt.execute();
2882 2889
            pstmt.close();
2883 2890
            conn.increaseUsageCount(1);
2884

  
2891
            double afterDeleteXmlAccess2 = System.currentTimeMillis()/1000;
2892
            logMetacat.info("The deleting xml_access base on docid time is "+(afterDeleteXmlAccess2 - afterDeleteXmlAccess1 ));
2885 2893
            // Delete enteries from xml_queryresult
2886 2894
            pstmt = conn.prepareStatement(
2887 2895
                    "DELETE FROM xml_queryresult WHERE docid = ?");
......
2889 2897
            pstmt.execute();
2890 2898
            pstmt.close();
2891 2899
            conn.increaseUsageCount(1);
2892

  
2900
            double afterDeleteQueryResult = System.currentTimeMillis()/1000;
2901
            logMetacat.info("The deleting xml_queryresult time is "+(afterDeleteQueryResult - afterDeleteXmlAccess2));
2893 2902
            // Delete it from relation table
2894 2903
            pstmt = conn.prepareStatement(
2895 2904
                    "DELETE FROM xml_relation WHERE docid = ?");
......
2898 2907
            pstmt.execute();
2899 2908
            pstmt.close();
2900 2909
            conn.increaseUsageCount(1);
2910
            double afterXMLRelation = System.currentTimeMillis()/1000;
2911
            logMetacat.info("The deleting time  relation is "+
2912
            		(afterXMLRelation - afterDeleteQueryResult) );
2901 2913

  
2902 2914
            // Delete it from xml_path_index table
2903 2915
            pstmt = conn.prepareStatement(
......
2926 2938
            pstmt.close();
2927 2939
            //Usaga count increase 1
2928 2940
            conn.increaseUsageCount(1);
2929

  
2941
            double afterDeleteDoc = System.currentTimeMillis()/1000;
2942
            logMetacat.info("the time to delete  xml_path_index,  xml_accesssubtree, xml_documents time is "+ 
2943
            		(afterDeleteDoc - afterXMLRelation ));
2930 2944
            // Delete the old nodes in xml_nodes table...
2931 2945
                   pstmt = conn.prepareStatement("DELETE FROM xml_nodes "
2932 2946
                                                   + "WHERE docid = ?");
......
2938 2952
                   pstmt.execute();
2939 2953
                   pstmt.close();
2940 2954

  
2941

  
2955
            double afterDeleteXMLNodes = System.currentTimeMillis()/1000;
2956
            logMetacat.info("Deleting xml_nodes time is "+(afterDeleteXMLNodes-afterDeleteDoc));
2942 2957
            conn.commit();
2943 2958
            conn.setAutoCommit(true);
2944 2959
        
......
2951 2966
              //System.out.println("the string stored into cache is "+ resultsetBuffer.toString());
2952 2967
         	   DBQuery.clearQueryResultCache();
2953 2968
            }
2954
          
2969
           double end = System.currentTimeMillis()/1000;
2970
           logMetacat.info("total delete time is ===== "+(end - start));
2955 2971

  
2956 2972
        } catch (Exception e) {
2957 2973
            logMetacat.error("error in DocumentImpl.delete: "
......
3216 3232
        moveNodesToNodesRevision(dbconn, rootNodeId);
3217 3233
        //archiveDocRevision(docid, user);
3218 3234
        //Move the document information to xml_revisions table...
3235
        double start = System.currentTimeMillis()/1000;
3219 3236
        pstmt = dbconn.prepareStatement("INSERT INTO xml_revisions "
3220 3237
                + "(docid, rootnodeid, docname, doctype, "
3221 3238
                + "user_owner, user_updated, date_created, date_updated, "
......
3233 3250
        pstmt.setString(3, docid);
3234 3251
        pstmt.execute();
3235 3252
        pstmt.close();
3253
        double end = System.currentTimeMillis()/1000;
3254
        logMetacat.info("moving docs from xml_documents to xml_revision takes "+(end -start));
3236 3255

  
3237 3256
      } catch (SQLException e) {
3238 3257
        logMetacat.error(
......
3263 3282
        logMetacat.info("the root node id is "+rootNodeId+
3264 3283
                " will be moved from xml_nodes to xml_node_revision table");
3265 3284
        PreparedStatement pstmt = null;
3285
        double start = System.currentTimeMillis()/1000;
3266 3286
        // Move the nodes from xml_nodes to xml_revisions table...
3267 3287
        pstmt = dbconn.prepareStatement("INSERT INTO xml_nodes_revisions "
3268 3288
                + "(nodeid, nodeindex, nodetype, nodename, nodeprefix, "
......
3279 3299
        pstmt.setLong(1, rootNodeId);
3280 3300
        pstmt.execute();
3281 3301
        pstmt.close();
3302
        double end = System.currentTimeMillis()/1000;
3303
        logMetacat.info("moving nodes from xml_nodes to xml_nodes_revision takes "+(end -start));
3282 3304
        
3283 3305

  
3284 3306
    }
......
3887 3909
        //MetaCatUtil util = new MetaCatUtil();
3888 3910
        AccessionNumber ac;
3889 3911
        PreparedStatement pstmt = null;
3912
        double start = System.currentTimeMillis()/1000;
3890 3913
        String sql = "DELETE FROM xml_nodes WHERE rootnodeid ="+ rootId;
3891 3914
        pstmt = dbconn.prepareStatement(sql);
3892 3915
        // Increase dbconnection usage count
3893 3916
        dbconn.increaseUsageCount(1);
3894 3917
        pstmt.execute();
3895 3918
        pstmt.close(); 
3919
        double end = System.currentTimeMillis()/1000;
3920
        logMetacat.info("The time to delete xml_nodes in UPDATE is "+(end -start));
3896 3921
     
3897 3922
    }
3898 3923
}

Also available in: Unified diff