Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-7741

Don't synchronize WriterImpl.addRow() when dynamic.partition is enabled

Log workAgile BoardRank to TopRank to BottomBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 0.13.1
    • None
    • File Formats
    • Loading into orc

    Description

      When loading into an un-paritioned ORC table WriterImpl$StructTreeWriter.write method is synchronized.

      When hive.optimize.sort.dynamic.partition is enabled the current thread will be the only writer and the synchronization is not needed.

      Also checking for memory per row is an over kill , this can be done per 1K rows or such

        public void addRow(Object row) throws IOException {
          synchronized (this) {
            treeWriter.write(row);
            rowsInStripe += 1;
            if (buildIndex) {
              rowsInIndex += 1;
      
              if (rowsInIndex >= rowIndexStride) {
                createRowIndexEntry();
              }
            }
          }
          memoryManager.addedRow();
        }
      

      This can improve ORC load performance by 7%

      Stack Trace	Sample Count	Percentage(%)
      WriterImpl.addRow(Object)	5,852	65.782
         WriterImpl$StructTreeWriter.write(Object)	5,163	58.037
         MemoryManager.addedRow()	666	7.487
            MemoryManager.notifyWriters()	648	7.284
               WriterImpl.checkMemory(double)	645	7.25
                  WriterImpl.flushStripe()	643	7.228
                     WriterImpl$StructTreeWriter.writeStripe(OrcProto$StripeFooter$Builder, int)	584	6.565
      

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            prasanth_j Prasanth Jayachandran Assign to me
            mmokhtar Mostafa Mokhtar
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment