Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-9963

Remove the ReentrantReadWriteLock in the MemStore

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.98.0, 0.96.0
    • 0.98.0, 0.96.1, 0.94.14
    • regionserver
    • None
    • Reviewed

    Description

      If I'm not wrong, the MemStore is always used from the HStore. The code in HStore puts a lock before calling MemStore. So the lock in Memstore is useless.

      For example, in HStore

        @Override
        public long upsert(Iterable<Cell> cells, long readpoint) throws IOException {
          this.lock.readLock().lock();
          try {
            return this.memstore.upsert(cells, readpoint);
          } finally {
            this.lock.readLock().unlock();
          }
        }
      

      With this in MemStore

        public long upsert(Iterable<Cell> cells, long readpoint) {
         this.lock.readLock().lock(); // <==========Am I useful?
          try {
            long size = 0;
            for (Cell cell : cells) {
              size += upsert(cell, readpoint);
            }
            return size;
          } finally {
            this.lock.readLock().unlock();
          }
        }
      

      I've checked, all the locks in MemStore are backed by a lock in HStore, the only exception beeing

        void snapshot() {
          this.memstore.snapshot();
        }
      

      And I would say it's a bug. If it's confirm (lhofhansl, what do you think?), I will add a lock there and remove all of them in MemStore. They do appear in the profiling.

      Attachments

        1. 9963.96.v3.patch
          21 kB
          Nicolas Liochon
        2. 9963.v1.patch
          17 kB
          Nicolas Liochon
        3. 9963.v2.patch
          19 kB
          Nicolas Liochon
        4. 9963.v3.patch
          20 kB
          Nicolas Liochon

        Activity

          People

            nkeywal Nicolas Liochon
            nkeywal Nicolas Liochon
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: