Author: kturner Date: Tue Mar 6 15:38:53 2012 New Revision: 1297535 URL: http://svn.apache.org/viewvc?rev=1297535&view=rev Log: ACCUMULO-444 wait for MinC after log recovery before putting tablet online (merged from 1.4)
Modified: incubator/accumulo/trunk/ (props changed) incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java Propchange: incubator/accumulo/trunk/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Tue Mar 6 15:38:53 2012 @@ -1,3 +1,3 @@ /incubator/accumulo/branches/1.3:1190280,1190413,1190420,1190427,1190500,1195622,1195625,1195629,1195635,1196044,1196054,1196057,1196071-1196072,1196106,1197066,1198935,1199383,1203683,1204625,1205547,1205880,1206169,1208031,1209124,1209526,1209532,1209539,1209541,1209587,1209657,1210518,1210571,1210596,1210598,1213424,1214320,1225006,1227215,1227231,1227611,1228195,1230180,1230736,1231043,1236873,1245632 /incubator/accumulo/branches/1.3.5rc:1209938 -/incubator/accumulo/branches/1.4:1201902-1297273 +/incubator/accumulo/branches/1.4:1201902-1297533 Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java?rev=1297535&r1=1297534&r2=1297535&view=diff ============================================================================== --- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java (original) +++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java Tue Mar 6 15:38:53 2012 @@ -2409,17 +2409,21 @@ public class TabletServer extends Abstra // this opens the tablet file and fills in the endKey in the // extent tablet = new Tablet(TabletServer.this, locationToOpen, extentToOpen, trm, tabletsKeyValues); - if (!tablet.initiateMinorCompaction() && tablet.getNumEntriesInMemory() > 0) { - log.warn("Minor compaction after recovery fails for " + extentToOpen); - - // it is important to wait for minc in the case that the - // minor compaction finish - // event did not make it to the logs (the file will be - // in !METADATA, preventing replay of compacted data)... - // but do not want a majc to wipe the file out from - // !METADATA and then have another process failure... - // this could cause duplicate data to replay + if (tablet.initiateMinorCompaction()) { + /* + * If a minor compaction starts after a tablet opens, this indicates a log recovery occurred. This recovered data must be minor compacted. + * + * There are three reasons to wait for this minor compaction to finish before placing the tablet in online tablets. + * + * 1) The log recovery code does not handle data written to the tablet on multiple tablet servers. 2) The log recovery code does not block if memory + * is full. Therefore recovering lots of tablets that use a lot of memory could run out of memory. 3) The minor compaction finish event did not make + * it to the logs (the file will be in !METADATA, preventing replay of compacted data)... but do not want a majc to wipe the file out from !METADATA + * and then have another process failure... this could cause duplicate data to replay + */ + tablet.waitForMinC(); + } else if (tablet.getNumEntries() > 0) { + log.warn("Minor compaction after recovery fails for " + extentToOpen); } Assignment assignment = new Assignment(extentToOpen, getTabletSession());