日期:2014-05-16 浏览次数:20773 次
private void split(final HRegion parent, final byte [] midKey) throws IOException { final long startTime = System.currentTimeMillis(); SplitTransaction st = new SplitTransaction(parent, midKey); // If prepare does not return true, for some reason -- logged inside in // the prepare call -- we are not ready to split just now. Just return. if (!st.prepare()) return; try { st.execute(this.server, this.server);
createSplitDir(this.parent.getFilesystem(), this.splitdir); this.journal.add(JournalEntry.CREATE_SPLIT_DIR);
List<StoreFile> hstoreFilesToSplit; hstoreFilesToSplit = this.parent.close(false);
services.removeFromOnlineRegions(this.parent.getRegionInfo().getEncodedName()); this.journal.add(JournalEntry.OFFLINED_PARENT);
splitStoreFiles(this.splitdir, hstoreFilesToSplit); this.journal.add(JournalEntry.STARTED_REGION_A_CREATION);
this.journal.add(JournalEntry.STARTED_REGION_A_CREATION); HRegion a = createDaughterRegion(this.hri_a,this.parent.flushRequester, this.parent.rsServices); this.journal.add(JournalEntry.STARTED_REGION_B_CREATION); HRegion b = createDaughterRegion(this.hri_b, this.parent.flushRequester, this.parent.rsServices);
try{ if (!testing) { MetaEditor.offlineParentInMeta(server.getCatalogTracker(), this.parent.getRegionInfo(), a.getRegionInfo(), b.getRegionInfo()); } } catch(IOException e){ throw e; } finally{ this.journal.add(JournalEntry.PONR); }
DaughterOpener aOpener = new DaughterOpener(server, services, a); DaughterOpener bOpener = new DaughterOpener(server, services, b); aOpener.start(); bOpener.start(); try { aOpener.join(); bOpener.join(); } catch (InterruptedException e) { Thread.currentThread().interrupt();