Source:
<code>public void importMapFiles(long tid, Map<FileRef,MapFileInfo> fileMap, boolean setTime) throws IOException { Map<FileRef,DataFileValue> entries = new HashMap<>(fileMap.size()); List<String> files = new ArrayList<>(); for (Entry<FileRef,MapFileInfo> entry : fileMap.entrySet()) { entries.put(entry.getKey(), new DataFileValue(entry.getValue().estimatedSize, 0L)); files.add(entry.getKey().path().toString()); } long now = System.currentTimeMillis(); synchronized (this) { if (isClosed()) { throw new IOException("tablet " + extent + " is closed"); } long lockWait = System.currentTimeMillis() - now; if (lockWait > getTabletServer().getConfiguration() .getTimeInMillis(Property.GENERAL_RPC_TIMEOUT)) { throw new IOException( "Timeout waiting " + (lockWait / 1000.) + " seconds to get tablet lock"); } List<FileRef> alreadyImported = bulkImported.getIfPresent(tid); if (alreadyImported != null) { for (FileRef entry : alreadyImported) { if (fileMap.remove(entry) != null) { log.trace("Ignoring import of bulk file already imported: {}", entry); } } } if (fileMap.isEmpty()) { return; } if (writesInProgress < 0) { throw new IllegalStateException("writesInProgress < 0 " + writesInProgress); } writesInProgress++; } tabletServer.updateBulkImportState(files, BulkImportState.LOADING); try { getDatafileManager().importMapFiles(tid, entries, setTime); lastMapFileImportTime = System.currentTimeMillis(); if (needsSplit()) { getTabletServer().executeSplit(this); } else { initiateMajorCompaction(MajorCompactionReason.NORMAL); } } finally { synchronized (this) { <START> writesInProgress--; <END> if (writesInProgress == 0) this.notifyAll(); try { bulkImported.get(tid, ArrayList::new).addAll(fileMap.keySet()); } catch (Exception ex) { log.info(ex.toString(), ex); } tabletServer.removeBulkImportState(files); } } }</code><technical_language>I checks left as-is. for current code result in this condition, changes in code assumptions violated. If nice checks</technical_language>

Target:
public void importMapFiles(long tid, Map<FileRef,MapFileInfo> fileMap, boolean setTime) throws IOException { Map<FileRef,DataFileValue> entries = new HashMap<>(fileMap.size()); List<String> files = new ArrayList<>(); for (Entry<FileRef,MapFileInfo> entry : fileMap.entrySet()) { entries.put(entry.getKey(), new DataFileValue(entry.getValue().estimatedSize, 0L)); files.add(entry.getKey().path().toString()); } long now = System.currentTimeMillis(); synchronized (this) { if (isClosed()) { throw new IOException("tablet " + extent + " is closed"); } long lockWait = System.currentTimeMillis() - now; if (lockWait > getTabletServer().getConfiguration() .getTimeInMillis(Property.GENERAL_RPC_TIMEOUT)) { throw new IOException( "Timeout waiting " + (lockWait / 1000.) + " seconds to get tablet lock"); } List<FileRef> alreadyImported = bulkImported.getIfPresent(tid); if (alreadyImported != null) { for (FileRef entry : alreadyImported) { if (fileMap.remove(entry) != null) { log.trace("Ignoring import of bulk file already imported: {}", entry); } } } if (fileMap.isEmpty()) { return; } if (writesInProgress < 0) { throw new IllegalStateException("writesInProgress < 0 " + writesInProgress); } writesInProgress++; } tabletServer.updateBulkImportState(files, BulkImportState.LOADING); try { getDatafileManager().importMapFiles(tid, entries, setTime); lastMapFileImportTime = System.currentTimeMillis(); if (needsSplit()) { getTabletServer().executeSplit(this); } else { initiateMajorCompaction(MajorCompactionReason.NORMAL); } } finally { synchronized (this) { if (writesInProgress < 1) throw new IllegalStateException("writesInProgress < 1 " + writesInProgress); writesInProgress--; if (writesInProgress == 0) this.notifyAll(); try { bulkImported.get(tid, ArrayList::new).addAll(fileMap.keySet()); } catch (Exception ex) { log.info(ex.toString(), ex); } tabletServer.removeBulkImportState(files); } } }