public void traceLock(ISchemaPage page) throws SegmentNotFoundException {
    refer(page);
    if (lockTraces.contains(page.getPageIndex())) {
      // FIXME rough resolve for reentrant write lock
      if (referredPages.get(page.getPageIndex()) != page) {
        logger.error("Duplicate page instances with identical index: {}", page.getPageIndex());
      }
      // it's exactly twice-locked
      if (((ReentrantReadWriteLock) page.getLock()).getWriteHoldCount() > 1) {
        logger.warn(
            "Page [{}] had been locked {} times.",
            ((ReentrantReadWriteLock) page.getLock()).getWriteHoldCount());
        // had already been locked twice
        page.getLock().writeLock().unlock();

        if (lockFaultTrigger) {
          logger.warn(
              "Reentrant write locks on page {}, content detail:{}",
              page.getPageIndex(),
              page.inspect());
          lockFaultTrigger = false;
        } else {
          logger.warn("Reentrant write locks on page:{}", page.getPageIndex());
        }
        return;
      }
    }
    lockTraces.add(page.getPageIndex());
  }
Thread local variables about write/update process.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/pagemgr/SchemaPageContext.java