http://git-wip-us.apache.org/repos/asf/hbase-site/blob/aa3fb87f/devapidocs/src-html/org/apache/hadoop/hbase/backup/impl/IncrementalBackupManager.html
----------------------------------------------------------------------
diff --git 
a/devapidocs/src-html/org/apache/hadoop/hbase/backup/impl/IncrementalBackupManager.html
 
b/devapidocs/src-html/org/apache/hadoop/hbase/backup/impl/IncrementalBackupManager.html
index 81fc69e..6c58b9a 100644
--- 
a/devapidocs/src-html/org/apache/hadoop/hbase/backup/impl/IncrementalBackupManager.html
+++ 
b/devapidocs/src-html/org/apache/hadoop/hbase/backup/impl/IncrementalBackupManager.html
@@ -47,7 +47,7 @@
 <span class="sourceLineNo">039</span>import 
org.apache.hadoop.hbase.client.Admin;<a name="line.39"></a>
 <span class="sourceLineNo">040</span>import 
org.apache.hadoop.hbase.client.Connection;<a name="line.40"></a>
 <span class="sourceLineNo">041</span>import 
org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore;<a 
name="line.41"></a>
-<span class="sourceLineNo">042</span>import 
org.apache.hadoop.hbase.util.FSUtils;<a name="line.42"></a>
+<span class="sourceLineNo">042</span>import 
org.apache.hadoop.hbase.util.CommonFSUtils;<a name="line.42"></a>
 <span class="sourceLineNo">043</span>import 
org.apache.hadoop.hbase.wal.AbstractFSWALProvider;<a name="line.43"></a>
 <span class="sourceLineNo">044</span>import 
org.apache.yetus.audience.InterfaceAudience;<a name="line.44"></a>
 <span class="sourceLineNo">045</span>import org.slf4j.Logger;<a 
name="line.45"></a>
@@ -251,156 +251,157 @@
 <span class="sourceLineNo">243</span>      throws IOException {<a 
name="line.243"></a>
 <span class="sourceLineNo">244</span>    LOG.debug("In 
getLogFilesForNewBackup()\n" + "olderTimestamps: " + olderTimestamps<a 
name="line.244"></a>
 <span class="sourceLineNo">245</span>        + "\n newestTimestamps: " + 
newestTimestamps);<a name="line.245"></a>
-<span class="sourceLineNo">246</span>    Path rootdir = 
FSUtils.getRootDir(conf);<a name="line.246"></a>
-<span class="sourceLineNo">247</span>    Path logDir = new Path(rootdir, 
HConstants.HREGION_LOGDIR_NAME);<a name="line.247"></a>
-<span class="sourceLineNo">248</span>    Path oldLogDir = new Path(rootdir, 
HConstants.HREGION_OLDLOGDIR_NAME);<a name="line.248"></a>
-<span class="sourceLineNo">249</span>    FileSystem fs = 
rootdir.getFileSystem(conf);<a name="line.249"></a>
-<span class="sourceLineNo">250</span>    NewestLogFilter pathFilter = new 
NewestLogFilter();<a name="line.250"></a>
-<span class="sourceLineNo">251</span><a name="line.251"></a>
-<span class="sourceLineNo">252</span>    List&lt;String&gt; resultLogFiles = 
new ArrayList&lt;&gt;();<a name="line.252"></a>
-<span class="sourceLineNo">253</span>    List&lt;String&gt; newestLogs = new 
ArrayList&lt;&gt;();<a name="line.253"></a>
-<span class="sourceLineNo">254</span><a name="line.254"></a>
-<span class="sourceLineNo">255</span>    /*<a name="line.255"></a>
-<span class="sourceLineNo">256</span>     * The old region servers and 
timestamps info we kept in backup system table may be out of sync<a 
name="line.256"></a>
-<span class="sourceLineNo">257</span>     * if new region server is added or 
existing one lost. We'll deal with it here when processing<a 
name="line.257"></a>
-<span class="sourceLineNo">258</span>     * the logs. If data in backup system 
table has more hosts, just ignore it. If the .logs<a name="line.258"></a>
-<span class="sourceLineNo">259</span>     * directory includes more hosts, the 
additional hosts will not have old timestamps to compare<a name="line.259"></a>
-<span class="sourceLineNo">260</span>     * with. We'll just use all the logs 
in that directory. We always write up-to-date region server<a 
name="line.260"></a>
-<span class="sourceLineNo">261</span>     * and timestamp info to backup 
system table at the end of successful backup.<a name="line.261"></a>
-<span class="sourceLineNo">262</span>     */<a name="line.262"></a>
-<span class="sourceLineNo">263</span>    FileStatus[] rss;<a 
name="line.263"></a>
-<span class="sourceLineNo">264</span>    Path p;<a name="line.264"></a>
-<span class="sourceLineNo">265</span>    String host;<a name="line.265"></a>
-<span class="sourceLineNo">266</span>    Long oldTimeStamp;<a 
name="line.266"></a>
-<span class="sourceLineNo">267</span>    String currentLogFile;<a 
name="line.267"></a>
-<span class="sourceLineNo">268</span>    long currentLogTS;<a 
name="line.268"></a>
-<span class="sourceLineNo">269</span><a name="line.269"></a>
-<span class="sourceLineNo">270</span>    // Get the files in .logs.<a 
name="line.270"></a>
-<span class="sourceLineNo">271</span>    rss = fs.listStatus(logDir);<a 
name="line.271"></a>
-<span class="sourceLineNo">272</span>    for (FileStatus rs : rss) {<a 
name="line.272"></a>
-<span class="sourceLineNo">273</span>      p = rs.getPath();<a 
name="line.273"></a>
-<span class="sourceLineNo">274</span>      host = 
BackupUtils.parseHostNameFromLogFile(p);<a name="line.274"></a>
-<span class="sourceLineNo">275</span>      if (host == null) {<a 
name="line.275"></a>
-<span class="sourceLineNo">276</span>        continue;<a name="line.276"></a>
-<span class="sourceLineNo">277</span>      }<a name="line.277"></a>
-<span class="sourceLineNo">278</span>      FileStatus[] logs;<a 
name="line.278"></a>
-<span class="sourceLineNo">279</span>      oldTimeStamp = 
olderTimestamps.get(host);<a name="line.279"></a>
-<span class="sourceLineNo">280</span>      // It is possible that there is no 
old timestamp in backup system table for this host if<a name="line.280"></a>
-<span class="sourceLineNo">281</span>      // this region server is newly 
added after our last backup.<a name="line.281"></a>
-<span class="sourceLineNo">282</span>      if (oldTimeStamp == null) {<a 
name="line.282"></a>
-<span class="sourceLineNo">283</span>        logs = fs.listStatus(p);<a 
name="line.283"></a>
-<span class="sourceLineNo">284</span>      } else {<a name="line.284"></a>
-<span class="sourceLineNo">285</span>        
pathFilter.setLastBackupTS(oldTimeStamp);<a name="line.285"></a>
-<span class="sourceLineNo">286</span>        logs = fs.listStatus(p, 
pathFilter);<a name="line.286"></a>
-<span class="sourceLineNo">287</span>      }<a name="line.287"></a>
-<span class="sourceLineNo">288</span>      for (FileStatus log : logs) {<a 
name="line.288"></a>
-<span class="sourceLineNo">289</span>        LOG.debug("currentLogFile: " + 
log.getPath().toString());<a name="line.289"></a>
-<span class="sourceLineNo">290</span>        if 
(AbstractFSWALProvider.isMetaFile(log.getPath())) {<a name="line.290"></a>
-<span class="sourceLineNo">291</span>          if (LOG.isDebugEnabled()) {<a 
name="line.291"></a>
-<span class="sourceLineNo">292</span>            LOG.debug("Skip hbase:meta 
log file: " + log.getPath().getName());<a name="line.292"></a>
-<span class="sourceLineNo">293</span>          }<a name="line.293"></a>
-<span class="sourceLineNo">294</span>          continue;<a name="line.294"></a>
-<span class="sourceLineNo">295</span>        }<a name="line.295"></a>
-<span class="sourceLineNo">296</span>        currentLogFile = 
log.getPath().toString();<a name="line.296"></a>
-<span class="sourceLineNo">297</span>        
resultLogFiles.add(currentLogFile);<a name="line.297"></a>
-<span class="sourceLineNo">298</span>        currentLogTS = 
BackupUtils.getCreationTime(log.getPath());<a name="line.298"></a>
-<span class="sourceLineNo">299</span><a name="line.299"></a>
-<span class="sourceLineNo">300</span>        // If newestTimestamps.get(host) 
is null, means that<a name="line.300"></a>
-<span class="sourceLineNo">301</span>        // either RS (host) has been 
restarted recently with different port number<a name="line.301"></a>
-<span class="sourceLineNo">302</span>        // or RS is down (was 
decommisioned). In any case, we treat this<a name="line.302"></a>
-<span class="sourceLineNo">303</span>        // log file as eligible for 
inclusion into incremental backup log list<a name="line.303"></a>
-<span class="sourceLineNo">304</span>        Long ts = 
newestTimestamps.get(host);<a name="line.304"></a>
-<span class="sourceLineNo">305</span>        if (ts ==  null) {<a 
name="line.305"></a>
-<span class="sourceLineNo">306</span>          LOG.warn("ORPHAN log found: " + 
log + " host=" + host);<a name="line.306"></a>
-<span class="sourceLineNo">307</span>          LOG.debug("Known hosts (from 
newestTimestamps):");<a name="line.307"></a>
-<span class="sourceLineNo">308</span>          for (String s: 
newestTimestamps.keySet()) {<a name="line.308"></a>
-<span class="sourceLineNo">309</span>            LOG.debug(s);<a 
name="line.309"></a>
-<span class="sourceLineNo">310</span>          }<a name="line.310"></a>
-<span class="sourceLineNo">311</span>        }<a name="line.311"></a>
-<span class="sourceLineNo">312</span>        if (ts == null || currentLogTS 
&gt; ts) {<a name="line.312"></a>
-<span class="sourceLineNo">313</span>          
newestLogs.add(currentLogFile);<a name="line.313"></a>
-<span class="sourceLineNo">314</span>        }<a name="line.314"></a>
-<span class="sourceLineNo">315</span>      }<a name="line.315"></a>
-<span class="sourceLineNo">316</span>    }<a name="line.316"></a>
-<span class="sourceLineNo">317</span><a name="line.317"></a>
-<span class="sourceLineNo">318</span>    // Include the .oldlogs files too.<a 
name="line.318"></a>
-<span class="sourceLineNo">319</span>    FileStatus[] oldlogs = 
fs.listStatus(oldLogDir);<a name="line.319"></a>
-<span class="sourceLineNo">320</span>    for (FileStatus oldlog : oldlogs) {<a 
name="line.320"></a>
-<span class="sourceLineNo">321</span>      p = oldlog.getPath();<a 
name="line.321"></a>
-<span class="sourceLineNo">322</span>      currentLogFile = p.toString();<a 
name="line.322"></a>
-<span class="sourceLineNo">323</span>      if 
(AbstractFSWALProvider.isMetaFile(p)) {<a name="line.323"></a>
-<span class="sourceLineNo">324</span>        if (LOG.isDebugEnabled()) {<a 
name="line.324"></a>
-<span class="sourceLineNo">325</span>          LOG.debug("Skip .meta log file: 
" + currentLogFile);<a name="line.325"></a>
-<span class="sourceLineNo">326</span>        }<a name="line.326"></a>
-<span class="sourceLineNo">327</span>        continue;<a name="line.327"></a>
-<span class="sourceLineNo">328</span>      }<a name="line.328"></a>
-<span class="sourceLineNo">329</span>      host = 
BackupUtils.parseHostFromOldLog(p);<a name="line.329"></a>
-<span class="sourceLineNo">330</span>      if (host == null) {<a 
name="line.330"></a>
-<span class="sourceLineNo">331</span>        continue;<a name="line.331"></a>
-<span class="sourceLineNo">332</span>      }<a name="line.332"></a>
-<span class="sourceLineNo">333</span>      currentLogTS = 
BackupUtils.getCreationTime(p);<a name="line.333"></a>
-<span class="sourceLineNo">334</span>      oldTimeStamp = 
olderTimestamps.get(host);<a name="line.334"></a>
-<span class="sourceLineNo">335</span>      /*<a name="line.335"></a>
-<span class="sourceLineNo">336</span>       * It is possible that there is no 
old timestamp in backup system table for this host. At the<a 
name="line.336"></a>
-<span class="sourceLineNo">337</span>       * time of our last backup 
operation, this rs did not exist. The reason can be one of the two:<a 
name="line.337"></a>
-<span class="sourceLineNo">338</span>       * 1. The rs already left/crashed. 
Its logs were moved to .oldlogs. 2. The rs was added after<a 
name="line.338"></a>
-<span class="sourceLineNo">339</span>       * our last backup.<a 
name="line.339"></a>
-<span class="sourceLineNo">340</span>       */<a name="line.340"></a>
-<span class="sourceLineNo">341</span>      if (oldTimeStamp == null) {<a 
name="line.341"></a>
-<span class="sourceLineNo">342</span>        if (currentLogTS &lt; 
Long.parseLong(savedStartCode)) {<a name="line.342"></a>
-<span class="sourceLineNo">343</span>          // This log file is really old, 
its region server was before our last backup.<a name="line.343"></a>
-<span class="sourceLineNo">344</span>          continue;<a name="line.344"></a>
-<span class="sourceLineNo">345</span>        } else {<a name="line.345"></a>
-<span class="sourceLineNo">346</span>          
resultLogFiles.add(currentLogFile);<a name="line.346"></a>
-<span class="sourceLineNo">347</span>        }<a name="line.347"></a>
-<span class="sourceLineNo">348</span>      } else if (currentLogTS &gt; 
oldTimeStamp) {<a name="line.348"></a>
-<span class="sourceLineNo">349</span>        
resultLogFiles.add(currentLogFile);<a name="line.349"></a>
-<span class="sourceLineNo">350</span>      }<a name="line.350"></a>
-<span class="sourceLineNo">351</span><a name="line.351"></a>
-<span class="sourceLineNo">352</span>      // It is possible that a host in 
.oldlogs is an obsolete region server<a name="line.352"></a>
-<span class="sourceLineNo">353</span>      // so newestTimestamps.get(host) 
here can be null.<a name="line.353"></a>
-<span class="sourceLineNo">354</span>      // Even if these logs belong to a 
obsolete region server, we still need<a name="line.354"></a>
-<span class="sourceLineNo">355</span>      // to include they to avoid loss of 
edits for backup.<a name="line.355"></a>
-<span class="sourceLineNo">356</span>      Long newTimestamp = 
newestTimestamps.get(host);<a name="line.356"></a>
-<span class="sourceLineNo">357</span>      if (newTimestamp == null || 
currentLogTS &gt; newTimestamp) {<a name="line.357"></a>
-<span class="sourceLineNo">358</span>        newestLogs.add(currentLogFile);<a 
name="line.358"></a>
-<span class="sourceLineNo">359</span>      }<a name="line.359"></a>
-<span class="sourceLineNo">360</span>    }<a name="line.360"></a>
-<span class="sourceLineNo">361</span>    // remove newest log per host because 
they are still in use<a name="line.361"></a>
-<span class="sourceLineNo">362</span>    
resultLogFiles.removeAll(newestLogs);<a name="line.362"></a>
-<span class="sourceLineNo">363</span>    return resultLogFiles;<a 
name="line.363"></a>
-<span class="sourceLineNo">364</span>  }<a name="line.364"></a>
-<span class="sourceLineNo">365</span><a name="line.365"></a>
-<span class="sourceLineNo">366</span>  static class NewestLogFilter implements 
PathFilter {<a name="line.366"></a>
-<span class="sourceLineNo">367</span>    private Long lastBackupTS = 0L;<a 
name="line.367"></a>
-<span class="sourceLineNo">368</span><a name="line.368"></a>
-<span class="sourceLineNo">369</span>    public NewestLogFilter() {<a 
name="line.369"></a>
-<span class="sourceLineNo">370</span>    }<a name="line.370"></a>
-<span class="sourceLineNo">371</span><a name="line.371"></a>
-<span class="sourceLineNo">372</span>    protected void setLastBackupTS(Long 
ts) {<a name="line.372"></a>
-<span class="sourceLineNo">373</span>      this.lastBackupTS = ts;<a 
name="line.373"></a>
-<span class="sourceLineNo">374</span>    }<a name="line.374"></a>
-<span class="sourceLineNo">375</span><a name="line.375"></a>
-<span class="sourceLineNo">376</span>    @Override<a name="line.376"></a>
-<span class="sourceLineNo">377</span>    public boolean accept(Path path) {<a 
name="line.377"></a>
-<span class="sourceLineNo">378</span>      // skip meta table log -- ts.meta 
file<a name="line.378"></a>
-<span class="sourceLineNo">379</span>      if 
(AbstractFSWALProvider.isMetaFile(path)) {<a name="line.379"></a>
-<span class="sourceLineNo">380</span>        if (LOG.isDebugEnabled()) {<a 
name="line.380"></a>
-<span class="sourceLineNo">381</span>          LOG.debug("Skip .meta log file: 
" + path.getName());<a name="line.381"></a>
-<span class="sourceLineNo">382</span>        }<a name="line.382"></a>
-<span class="sourceLineNo">383</span>        return false;<a 
name="line.383"></a>
-<span class="sourceLineNo">384</span>      }<a name="line.384"></a>
-<span class="sourceLineNo">385</span>      long timestamp;<a 
name="line.385"></a>
-<span class="sourceLineNo">386</span>      try {<a name="line.386"></a>
-<span class="sourceLineNo">387</span>        timestamp = 
BackupUtils.getCreationTime(path);<a name="line.387"></a>
-<span class="sourceLineNo">388</span>        return timestamp &gt; 
lastBackupTS;<a name="line.388"></a>
-<span class="sourceLineNo">389</span>      } catch (Exception e) {<a 
name="line.389"></a>
-<span class="sourceLineNo">390</span>        LOG.warn("Cannot read timestamp 
of log file " + path);<a name="line.390"></a>
-<span class="sourceLineNo">391</span>        return false;<a 
name="line.391"></a>
-<span class="sourceLineNo">392</span>      }<a name="line.392"></a>
-<span class="sourceLineNo">393</span>    }<a name="line.393"></a>
-<span class="sourceLineNo">394</span>  }<a name="line.394"></a>
-<span class="sourceLineNo">395</span>}<a name="line.395"></a>
+<span class="sourceLineNo">246</span><a name="line.246"></a>
+<span class="sourceLineNo">247</span>    Path walRootDir = 
CommonFSUtils.getWALRootDir(conf);<a name="line.247"></a>
+<span class="sourceLineNo">248</span>    Path logDir = new Path(walRootDir, 
HConstants.HREGION_LOGDIR_NAME);<a name="line.248"></a>
+<span class="sourceLineNo">249</span>    Path oldLogDir = new Path(walRootDir, 
HConstants.HREGION_OLDLOGDIR_NAME);<a name="line.249"></a>
+<span class="sourceLineNo">250</span>    FileSystem fs = 
walRootDir.getFileSystem(conf);<a name="line.250"></a>
+<span class="sourceLineNo">251</span>    NewestLogFilter pathFilter = new 
NewestLogFilter();<a name="line.251"></a>
+<span class="sourceLineNo">252</span><a name="line.252"></a>
+<span class="sourceLineNo">253</span>    List&lt;String&gt; resultLogFiles = 
new ArrayList&lt;&gt;();<a name="line.253"></a>
+<span class="sourceLineNo">254</span>    List&lt;String&gt; newestLogs = new 
ArrayList&lt;&gt;();<a name="line.254"></a>
+<span class="sourceLineNo">255</span><a name="line.255"></a>
+<span class="sourceLineNo">256</span>    /*<a name="line.256"></a>
+<span class="sourceLineNo">257</span>     * The old region servers and 
timestamps info we kept in backup system table may be out of sync<a 
name="line.257"></a>
+<span class="sourceLineNo">258</span>     * if new region server is added or 
existing one lost. We'll deal with it here when processing<a 
name="line.258"></a>
+<span class="sourceLineNo">259</span>     * the logs. If data in backup system 
table has more hosts, just ignore it. If the .logs<a name="line.259"></a>
+<span class="sourceLineNo">260</span>     * directory includes more hosts, the 
additional hosts will not have old timestamps to compare<a name="line.260"></a>
+<span class="sourceLineNo">261</span>     * with. We'll just use all the logs 
in that directory. We always write up-to-date region server<a 
name="line.261"></a>
+<span class="sourceLineNo">262</span>     * and timestamp info to backup 
system table at the end of successful backup.<a name="line.262"></a>
+<span class="sourceLineNo">263</span>     */<a name="line.263"></a>
+<span class="sourceLineNo">264</span>    FileStatus[] rss;<a 
name="line.264"></a>
+<span class="sourceLineNo">265</span>    Path p;<a name="line.265"></a>
+<span class="sourceLineNo">266</span>    String host;<a name="line.266"></a>
+<span class="sourceLineNo">267</span>    Long oldTimeStamp;<a 
name="line.267"></a>
+<span class="sourceLineNo">268</span>    String currentLogFile;<a 
name="line.268"></a>
+<span class="sourceLineNo">269</span>    long currentLogTS;<a 
name="line.269"></a>
+<span class="sourceLineNo">270</span><a name="line.270"></a>
+<span class="sourceLineNo">271</span>    // Get the files in .logs.<a 
name="line.271"></a>
+<span class="sourceLineNo">272</span>    rss = fs.listStatus(logDir);<a 
name="line.272"></a>
+<span class="sourceLineNo">273</span>    for (FileStatus rs : rss) {<a 
name="line.273"></a>
+<span class="sourceLineNo">274</span>      p = rs.getPath();<a 
name="line.274"></a>
+<span class="sourceLineNo">275</span>      host = 
BackupUtils.parseHostNameFromLogFile(p);<a name="line.275"></a>
+<span class="sourceLineNo">276</span>      if (host == null) {<a 
name="line.276"></a>
+<span class="sourceLineNo">277</span>        continue;<a name="line.277"></a>
+<span class="sourceLineNo">278</span>      }<a name="line.278"></a>
+<span class="sourceLineNo">279</span>      FileStatus[] logs;<a 
name="line.279"></a>
+<span class="sourceLineNo">280</span>      oldTimeStamp = 
olderTimestamps.get(host);<a name="line.280"></a>
+<span class="sourceLineNo">281</span>      // It is possible that there is no 
old timestamp in backup system table for this host if<a name="line.281"></a>
+<span class="sourceLineNo">282</span>      // this region server is newly 
added after our last backup.<a name="line.282"></a>
+<span class="sourceLineNo">283</span>      if (oldTimeStamp == null) {<a 
name="line.283"></a>
+<span class="sourceLineNo">284</span>        logs = fs.listStatus(p);<a 
name="line.284"></a>
+<span class="sourceLineNo">285</span>      } else {<a name="line.285"></a>
+<span class="sourceLineNo">286</span>        
pathFilter.setLastBackupTS(oldTimeStamp);<a name="line.286"></a>
+<span class="sourceLineNo">287</span>        logs = fs.listStatus(p, 
pathFilter);<a name="line.287"></a>
+<span class="sourceLineNo">288</span>      }<a name="line.288"></a>
+<span class="sourceLineNo">289</span>      for (FileStatus log : logs) {<a 
name="line.289"></a>
+<span class="sourceLineNo">290</span>        LOG.debug("currentLogFile: " + 
log.getPath().toString());<a name="line.290"></a>
+<span class="sourceLineNo">291</span>        if 
(AbstractFSWALProvider.isMetaFile(log.getPath())) {<a name="line.291"></a>
+<span class="sourceLineNo">292</span>          if (LOG.isDebugEnabled()) {<a 
name="line.292"></a>
+<span class="sourceLineNo">293</span>            LOG.debug("Skip hbase:meta 
log file: " + log.getPath().getName());<a name="line.293"></a>
+<span class="sourceLineNo">294</span>          }<a name="line.294"></a>
+<span class="sourceLineNo">295</span>          continue;<a name="line.295"></a>
+<span class="sourceLineNo">296</span>        }<a name="line.296"></a>
+<span class="sourceLineNo">297</span>        currentLogFile = 
log.getPath().toString();<a name="line.297"></a>
+<span class="sourceLineNo">298</span>        
resultLogFiles.add(currentLogFile);<a name="line.298"></a>
+<span class="sourceLineNo">299</span>        currentLogTS = 
BackupUtils.getCreationTime(log.getPath());<a name="line.299"></a>
+<span class="sourceLineNo">300</span><a name="line.300"></a>
+<span class="sourceLineNo">301</span>        // If newestTimestamps.get(host) 
is null, means that<a name="line.301"></a>
+<span class="sourceLineNo">302</span>        // either RS (host) has been 
restarted recently with different port number<a name="line.302"></a>
+<span class="sourceLineNo">303</span>        // or RS is down (was 
decommisioned). In any case, we treat this<a name="line.303"></a>
+<span class="sourceLineNo">304</span>        // log file as eligible for 
inclusion into incremental backup log list<a name="line.304"></a>
+<span class="sourceLineNo">305</span>        Long ts = 
newestTimestamps.get(host);<a name="line.305"></a>
+<span class="sourceLineNo">306</span>        if (ts ==  null) {<a 
name="line.306"></a>
+<span class="sourceLineNo">307</span>          LOG.warn("ORPHAN log found: " + 
log + " host=" + host);<a name="line.307"></a>
+<span class="sourceLineNo">308</span>          LOG.debug("Known hosts (from 
newestTimestamps):");<a name="line.308"></a>
+<span class="sourceLineNo">309</span>          for (String s: 
newestTimestamps.keySet()) {<a name="line.309"></a>
+<span class="sourceLineNo">310</span>            LOG.debug(s);<a 
name="line.310"></a>
+<span class="sourceLineNo">311</span>          }<a name="line.311"></a>
+<span class="sourceLineNo">312</span>        }<a name="line.312"></a>
+<span class="sourceLineNo">313</span>        if (ts == null || currentLogTS 
&gt; ts) {<a name="line.313"></a>
+<span class="sourceLineNo">314</span>          
newestLogs.add(currentLogFile);<a name="line.314"></a>
+<span class="sourceLineNo">315</span>        }<a name="line.315"></a>
+<span class="sourceLineNo">316</span>      }<a name="line.316"></a>
+<span class="sourceLineNo">317</span>    }<a name="line.317"></a>
+<span class="sourceLineNo">318</span><a name="line.318"></a>
+<span class="sourceLineNo">319</span>    // Include the .oldlogs files too.<a 
name="line.319"></a>
+<span class="sourceLineNo">320</span>    FileStatus[] oldlogs = 
fs.listStatus(oldLogDir);<a name="line.320"></a>
+<span class="sourceLineNo">321</span>    for (FileStatus oldlog : oldlogs) {<a 
name="line.321"></a>
+<span class="sourceLineNo">322</span>      p = oldlog.getPath();<a 
name="line.322"></a>
+<span class="sourceLineNo">323</span>      currentLogFile = p.toString();<a 
name="line.323"></a>
+<span class="sourceLineNo">324</span>      if 
(AbstractFSWALProvider.isMetaFile(p)) {<a name="line.324"></a>
+<span class="sourceLineNo">325</span>        if (LOG.isDebugEnabled()) {<a 
name="line.325"></a>
+<span class="sourceLineNo">326</span>          LOG.debug("Skip .meta log file: 
" + currentLogFile);<a name="line.326"></a>
+<span class="sourceLineNo">327</span>        }<a name="line.327"></a>
+<span class="sourceLineNo">328</span>        continue;<a name="line.328"></a>
+<span class="sourceLineNo">329</span>      }<a name="line.329"></a>
+<span class="sourceLineNo">330</span>      host = 
BackupUtils.parseHostFromOldLog(p);<a name="line.330"></a>
+<span class="sourceLineNo">331</span>      if (host == null) {<a 
name="line.331"></a>
+<span class="sourceLineNo">332</span>        continue;<a name="line.332"></a>
+<span class="sourceLineNo">333</span>      }<a name="line.333"></a>
+<span class="sourceLineNo">334</span>      currentLogTS = 
BackupUtils.getCreationTime(p);<a name="line.334"></a>
+<span class="sourceLineNo">335</span>      oldTimeStamp = 
olderTimestamps.get(host);<a name="line.335"></a>
+<span class="sourceLineNo">336</span>      /*<a name="line.336"></a>
+<span class="sourceLineNo">337</span>       * It is possible that there is no 
old timestamp in backup system table for this host. At the<a 
name="line.337"></a>
+<span class="sourceLineNo">338</span>       * time of our last backup 
operation, this rs did not exist. The reason can be one of the two:<a 
name="line.338"></a>
+<span class="sourceLineNo">339</span>       * 1. The rs already left/crashed. 
Its logs were moved to .oldlogs. 2. The rs was added after<a 
name="line.339"></a>
+<span class="sourceLineNo">340</span>       * our last backup.<a 
name="line.340"></a>
+<span class="sourceLineNo">341</span>       */<a name="line.341"></a>
+<span class="sourceLineNo">342</span>      if (oldTimeStamp == null) {<a 
name="line.342"></a>
+<span class="sourceLineNo">343</span>        if (currentLogTS &lt; 
Long.parseLong(savedStartCode)) {<a name="line.343"></a>
+<span class="sourceLineNo">344</span>          // This log file is really old, 
its region server was before our last backup.<a name="line.344"></a>
+<span class="sourceLineNo">345</span>          continue;<a name="line.345"></a>
+<span class="sourceLineNo">346</span>        } else {<a name="line.346"></a>
+<span class="sourceLineNo">347</span>          
resultLogFiles.add(currentLogFile);<a name="line.347"></a>
+<span class="sourceLineNo">348</span>        }<a name="line.348"></a>
+<span class="sourceLineNo">349</span>      } else if (currentLogTS &gt; 
oldTimeStamp) {<a name="line.349"></a>
+<span class="sourceLineNo">350</span>        
resultLogFiles.add(currentLogFile);<a name="line.350"></a>
+<span class="sourceLineNo">351</span>      }<a name="line.351"></a>
+<span class="sourceLineNo">352</span><a name="line.352"></a>
+<span class="sourceLineNo">353</span>      // It is possible that a host in 
.oldlogs is an obsolete region server<a name="line.353"></a>
+<span class="sourceLineNo">354</span>      // so newestTimestamps.get(host) 
here can be null.<a name="line.354"></a>
+<span class="sourceLineNo">355</span>      // Even if these logs belong to a 
obsolete region server, we still need<a name="line.355"></a>
+<span class="sourceLineNo">356</span>      // to include they to avoid loss of 
edits for backup.<a name="line.356"></a>
+<span class="sourceLineNo">357</span>      Long newTimestamp = 
newestTimestamps.get(host);<a name="line.357"></a>
+<span class="sourceLineNo">358</span>      if (newTimestamp == null || 
currentLogTS &gt; newTimestamp) {<a name="line.358"></a>
+<span class="sourceLineNo">359</span>        newestLogs.add(currentLogFile);<a 
name="line.359"></a>
+<span class="sourceLineNo">360</span>      }<a name="line.360"></a>
+<span class="sourceLineNo">361</span>    }<a name="line.361"></a>
+<span class="sourceLineNo">362</span>    // remove newest log per host because 
they are still in use<a name="line.362"></a>
+<span class="sourceLineNo">363</span>    
resultLogFiles.removeAll(newestLogs);<a name="line.363"></a>
+<span class="sourceLineNo">364</span>    return resultLogFiles;<a 
name="line.364"></a>
+<span class="sourceLineNo">365</span>  }<a name="line.365"></a>
+<span class="sourceLineNo">366</span><a name="line.366"></a>
+<span class="sourceLineNo">367</span>  static class NewestLogFilter implements 
PathFilter {<a name="line.367"></a>
+<span class="sourceLineNo">368</span>    private Long lastBackupTS = 0L;<a 
name="line.368"></a>
+<span class="sourceLineNo">369</span><a name="line.369"></a>
+<span class="sourceLineNo">370</span>    public NewestLogFilter() {<a 
name="line.370"></a>
+<span class="sourceLineNo">371</span>    }<a name="line.371"></a>
+<span class="sourceLineNo">372</span><a name="line.372"></a>
+<span class="sourceLineNo">373</span>    protected void setLastBackupTS(Long 
ts) {<a name="line.373"></a>
+<span class="sourceLineNo">374</span>      this.lastBackupTS = ts;<a 
name="line.374"></a>
+<span class="sourceLineNo">375</span>    }<a name="line.375"></a>
+<span class="sourceLineNo">376</span><a name="line.376"></a>
+<span class="sourceLineNo">377</span>    @Override<a name="line.377"></a>
+<span class="sourceLineNo">378</span>    public boolean accept(Path path) {<a 
name="line.378"></a>
+<span class="sourceLineNo">379</span>      // skip meta table log -- ts.meta 
file<a name="line.379"></a>
+<span class="sourceLineNo">380</span>      if 
(AbstractFSWALProvider.isMetaFile(path)) {<a name="line.380"></a>
+<span class="sourceLineNo">381</span>        if (LOG.isDebugEnabled()) {<a 
name="line.381"></a>
+<span class="sourceLineNo">382</span>          LOG.debug("Skip .meta log file: 
" + path.getName());<a name="line.382"></a>
+<span class="sourceLineNo">383</span>        }<a name="line.383"></a>
+<span class="sourceLineNo">384</span>        return false;<a 
name="line.384"></a>
+<span class="sourceLineNo">385</span>      }<a name="line.385"></a>
+<span class="sourceLineNo">386</span>      long timestamp;<a 
name="line.386"></a>
+<span class="sourceLineNo">387</span>      try {<a name="line.387"></a>
+<span class="sourceLineNo">388</span>        timestamp = 
BackupUtils.getCreationTime(path);<a name="line.388"></a>
+<span class="sourceLineNo">389</span>        return timestamp &gt; 
lastBackupTS;<a name="line.389"></a>
+<span class="sourceLineNo">390</span>      } catch (Exception e) {<a 
name="line.390"></a>
+<span class="sourceLineNo">391</span>        LOG.warn("Cannot read timestamp 
of log file " + path);<a name="line.391"></a>
+<span class="sourceLineNo">392</span>        return false;<a 
name="line.392"></a>
+<span class="sourceLineNo">393</span>      }<a name="line.393"></a>
+<span class="sourceLineNo">394</span>    }<a name="line.394"></a>
+<span class="sourceLineNo">395</span>  }<a name="line.395"></a>
+<span class="sourceLineNo">396</span>}<a name="line.396"></a>
 
 
 

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/aa3fb87f/devapidocs/src-html/org/apache/hadoop/hbase/client/replication/ReplicationPeerConfigUtil.html
----------------------------------------------------------------------
diff --git 
a/devapidocs/src-html/org/apache/hadoop/hbase/client/replication/ReplicationPeerConfigUtil.html
 
b/devapidocs/src-html/org/apache/hadoop/hbase/client/replication/ReplicationPeerConfigUtil.html
index 0e6eed4..9b95596 100644
--- 
a/devapidocs/src-html/org/apache/hadoop/hbase/client/replication/ReplicationPeerConfigUtil.html
+++ 
b/devapidocs/src-html/org/apache/hadoop/hbase/client/replication/ReplicationPeerConfigUtil.html
@@ -453,107 +453,171 @@
 <span class="sourceLineNo">445</span>    if (preTableCfs == null) {<a 
name="line.445"></a>
 <span class="sourceLineNo">446</span>      builder.setTableCFsMap(tableCfs);<a 
name="line.446"></a>
 <span class="sourceLineNo">447</span>    } else {<a name="line.447"></a>
-<span class="sourceLineNo">448</span>      Map&lt;TableName, 
List&lt;String&gt;&gt; newTableCfs = copyTableCFsMap(preTableCfs);<a 
name="line.448"></a>
-<span class="sourceLineNo">449</span>      for (Map.Entry&lt;TableName, ? 
extends Collection&lt;String&gt;&gt; entry : tableCfs.entrySet()) {<a 
name="line.449"></a>
-<span class="sourceLineNo">450</span>        TableName table = 
entry.getKey();<a name="line.450"></a>
-<span class="sourceLineNo">451</span>        Collection&lt;String&gt; 
appendCfs = entry.getValue();<a name="line.451"></a>
-<span class="sourceLineNo">452</span>        if 
(newTableCfs.containsKey(table)) {<a name="line.452"></a>
-<span class="sourceLineNo">453</span>          List&lt;String&gt; cfs = 
newTableCfs.get(table);<a name="line.453"></a>
-<span class="sourceLineNo">454</span>          if (cfs == null || appendCfs == 
null || appendCfs.isEmpty()) {<a name="line.454"></a>
-<span class="sourceLineNo">455</span>            newTableCfs.put(table, 
null);<a name="line.455"></a>
-<span class="sourceLineNo">456</span>          } else {<a name="line.456"></a>
-<span class="sourceLineNo">457</span>            Set&lt;String&gt; cfSet = new 
HashSet&lt;String&gt;(cfs);<a name="line.457"></a>
-<span class="sourceLineNo">458</span>            cfSet.addAll(appendCfs);<a 
name="line.458"></a>
-<span class="sourceLineNo">459</span>            newTableCfs.put(table, 
Lists.newArrayList(cfSet));<a name="line.459"></a>
-<span class="sourceLineNo">460</span>          }<a name="line.460"></a>
-<span class="sourceLineNo">461</span>        } else {<a name="line.461"></a>
-<span class="sourceLineNo">462</span>          if (appendCfs == null || 
appendCfs.isEmpty()) {<a name="line.462"></a>
-<span class="sourceLineNo">463</span>            newTableCfs.put(table, 
null);<a name="line.463"></a>
-<span class="sourceLineNo">464</span>          } else {<a name="line.464"></a>
-<span class="sourceLineNo">465</span>            newTableCfs.put(table, 
Lists.newArrayList(appendCfs));<a name="line.465"></a>
-<span class="sourceLineNo">466</span>          }<a name="line.466"></a>
-<span class="sourceLineNo">467</span>        }<a name="line.467"></a>
-<span class="sourceLineNo">468</span>      }<a name="line.468"></a>
-<span class="sourceLineNo">469</span>      
builder.setTableCFsMap(newTableCfs);<a name="line.469"></a>
-<span class="sourceLineNo">470</span>    }<a name="line.470"></a>
-<span class="sourceLineNo">471</span>    return builder.build();<a 
name="line.471"></a>
-<span class="sourceLineNo">472</span>  }<a name="line.472"></a>
-<span class="sourceLineNo">473</span><a name="line.473"></a>
-<span class="sourceLineNo">474</span>  private static Map&lt;TableName, 
List&lt;String&gt;&gt;<a name="line.474"></a>
-<span class="sourceLineNo">475</span>      copyTableCFsMap(Map&lt;TableName, 
List&lt;String&gt;&gt; preTableCfs) {<a name="line.475"></a>
-<span class="sourceLineNo">476</span>    Map&lt;TableName, 
List&lt;String&gt;&gt; newTableCfs = new HashMap&lt;&gt;();<a 
name="line.476"></a>
-<span class="sourceLineNo">477</span>    preTableCfs.forEach(<a 
name="line.477"></a>
-<span class="sourceLineNo">478</span>      (table, cfs) -&gt; 
newTableCfs.put(table, cfs != null ? Lists.newArrayList(cfs) : null));<a 
name="line.478"></a>
-<span class="sourceLineNo">479</span>    return newTableCfs;<a 
name="line.479"></a>
-<span class="sourceLineNo">480</span>  }<a name="line.480"></a>
-<span class="sourceLineNo">481</span><a name="line.481"></a>
-<span class="sourceLineNo">482</span>  public static ReplicationPeerConfig 
removeTableCFsFromReplicationPeerConfig(<a name="line.482"></a>
-<span class="sourceLineNo">483</span>      Map&lt;TableName, 
List&lt;String&gt;&gt; tableCfs, ReplicationPeerConfig peerConfig,<a 
name="line.483"></a>
-<span class="sourceLineNo">484</span>      String id) throws 
ReplicationException {<a name="line.484"></a>
-<span class="sourceLineNo">485</span>    Map&lt;TableName, 
List&lt;String&gt;&gt; preTableCfs = peerConfig.getTableCFsMap();<a 
name="line.485"></a>
-<span class="sourceLineNo">486</span>    if (preTableCfs == null) {<a 
name="line.486"></a>
-<span class="sourceLineNo">487</span>      throw new 
ReplicationException("Table-Cfs for peer: " + id + " is null");<a 
name="line.487"></a>
-<span class="sourceLineNo">488</span>    }<a name="line.488"></a>
-<span class="sourceLineNo">489</span>    Map&lt;TableName, 
List&lt;String&gt;&gt; newTableCfs = copyTableCFsMap(preTableCfs);<a 
name="line.489"></a>
-<span class="sourceLineNo">490</span>    for (Map.Entry&lt;TableName, ? 
extends Collection&lt;String&gt;&gt; entry : tableCfs.entrySet()) {<a 
name="line.490"></a>
-<span class="sourceLineNo">491</span>      TableName table = entry.getKey();<a 
name="line.491"></a>
-<span class="sourceLineNo">492</span>      Collection&lt;String&gt; removeCfs 
= entry.getValue();<a name="line.492"></a>
-<span class="sourceLineNo">493</span>      if (newTableCfs.containsKey(table)) 
{<a name="line.493"></a>
-<span class="sourceLineNo">494</span>        List&lt;String&gt; cfs = 
newTableCfs.get(table);<a name="line.494"></a>
-<span class="sourceLineNo">495</span>        if (cfs == null &amp;&amp; 
(removeCfs == null || removeCfs.isEmpty())) {<a name="line.495"></a>
-<span class="sourceLineNo">496</span>          newTableCfs.remove(table);<a 
name="line.496"></a>
-<span class="sourceLineNo">497</span>        } else if (cfs != null &amp;&amp; 
(removeCfs != null &amp;&amp; !removeCfs.isEmpty())) {<a name="line.497"></a>
-<span class="sourceLineNo">498</span>          Set&lt;String&gt; cfSet = new 
HashSet&lt;String&gt;(cfs);<a name="line.498"></a>
-<span class="sourceLineNo">499</span>          cfSet.removeAll(removeCfs);<a 
name="line.499"></a>
-<span class="sourceLineNo">500</span>          if (cfSet.isEmpty()) {<a 
name="line.500"></a>
-<span class="sourceLineNo">501</span>            newTableCfs.remove(table);<a 
name="line.501"></a>
-<span class="sourceLineNo">502</span>          } else {<a name="line.502"></a>
-<span class="sourceLineNo">503</span>            newTableCfs.put(table, 
Lists.newArrayList(cfSet));<a name="line.503"></a>
-<span class="sourceLineNo">504</span>          }<a name="line.504"></a>
-<span class="sourceLineNo">505</span>        } else if (cfs == null &amp;&amp; 
(removeCfs != null &amp;&amp; !removeCfs.isEmpty())) {<a name="line.505"></a>
-<span class="sourceLineNo">506</span>          throw new 
ReplicationException("Cannot remove cf of table: " + table<a 
name="line.506"></a>
-<span class="sourceLineNo">507</span>              + " which doesn't specify 
cfs from table-cfs config in peer: " + id);<a name="line.507"></a>
-<span class="sourceLineNo">508</span>        } else if (cfs != null &amp;&amp; 
(removeCfs == null || removeCfs.isEmpty())) {<a name="line.508"></a>
-<span class="sourceLineNo">509</span>          throw new 
ReplicationException("Cannot remove table: " + table<a name="line.509"></a>
-<span class="sourceLineNo">510</span>              + " which has specified cfs 
from table-cfs config in peer: " + id);<a name="line.510"></a>
-<span class="sourceLineNo">511</span>        }<a name="line.511"></a>
-<span class="sourceLineNo">512</span>      } else {<a name="line.512"></a>
-<span class="sourceLineNo">513</span>        throw new ReplicationException(<a 
name="line.513"></a>
-<span class="sourceLineNo">514</span>            "No table: " + table + " in 
table-cfs config of peer: " + id);<a name="line.514"></a>
-<span class="sourceLineNo">515</span>      }<a name="line.515"></a>
-<span class="sourceLineNo">516</span>    }<a name="line.516"></a>
-<span class="sourceLineNo">517</span>    ReplicationPeerConfigBuilder builder 
= ReplicationPeerConfig.newBuilder(peerConfig);<a name="line.517"></a>
-<span class="sourceLineNo">518</span>    
builder.setTableCFsMap(newTableCfs);<a name="line.518"></a>
-<span class="sourceLineNo">519</span>    return builder.build();<a 
name="line.519"></a>
-<span class="sourceLineNo">520</span>  }<a name="line.520"></a>
-<span class="sourceLineNo">521</span><a name="line.521"></a>
-<span class="sourceLineNo">522</span>  /**<a name="line.522"></a>
-<span class="sourceLineNo">523</span>   * Returns the configuration needed to 
talk to the remote slave cluster.<a name="line.523"></a>
-<span class="sourceLineNo">524</span>   * @param conf the base configuration<a 
name="line.524"></a>
-<span class="sourceLineNo">525</span>   * @param peer the description of 
replication peer<a name="line.525"></a>
-<span class="sourceLineNo">526</span>   * @return the configuration for the 
peer cluster, null if it was unable to get the configuration<a 
name="line.526"></a>
-<span class="sourceLineNo">527</span>   * @throws IOException when create peer 
cluster configuration failed<a name="line.527"></a>
-<span class="sourceLineNo">528</span>   */<a name="line.528"></a>
-<span class="sourceLineNo">529</span>  public static Configuration 
getPeerClusterConfiguration(Configuration conf,<a name="line.529"></a>
-<span class="sourceLineNo">530</span>      ReplicationPeerDescription peer) 
throws IOException {<a name="line.530"></a>
-<span class="sourceLineNo">531</span>    ReplicationPeerConfig peerConfig = 
peer.getPeerConfig();<a name="line.531"></a>
-<span class="sourceLineNo">532</span>    Configuration otherConf;<a 
name="line.532"></a>
-<span class="sourceLineNo">533</span>    try {<a name="line.533"></a>
-<span class="sourceLineNo">534</span>      otherConf = 
HBaseConfiguration.createClusterConf(conf, peerConfig.getClusterKey());<a 
name="line.534"></a>
-<span class="sourceLineNo">535</span>    } catch (IOException e) {<a 
name="line.535"></a>
-<span class="sourceLineNo">536</span>      throw new IOException("Can't get 
peer configuration for peerId=" + peer.getPeerId(), e);<a name="line.536"></a>
+<span class="sourceLineNo">448</span>      
builder.setTableCFsMap(mergeTableCFs(preTableCfs, tableCfs));<a 
name="line.448"></a>
+<span class="sourceLineNo">449</span>    }<a name="line.449"></a>
+<span class="sourceLineNo">450</span>    return builder.build();<a 
name="line.450"></a>
+<span class="sourceLineNo">451</span>  }<a name="line.451"></a>
+<span class="sourceLineNo">452</span><a name="line.452"></a>
+<span class="sourceLineNo">453</span>  public static ReplicationPeerConfig 
appendExcludeTableCFsToReplicationPeerConfig(<a name="line.453"></a>
+<span class="sourceLineNo">454</span>      Map&lt;TableName, 
List&lt;String&gt;&gt; excludeTableCfs, ReplicationPeerConfig peerConfig)<a 
name="line.454"></a>
+<span class="sourceLineNo">455</span>      throws ReplicationException {<a 
name="line.455"></a>
+<span class="sourceLineNo">456</span>    if (excludeTableCfs == null) {<a 
name="line.456"></a>
+<span class="sourceLineNo">457</span>      throw new 
ReplicationException("exclude tableCfs is null");<a name="line.457"></a>
+<span class="sourceLineNo">458</span>    }<a name="line.458"></a>
+<span class="sourceLineNo">459</span>    ReplicationPeerConfigBuilder builder 
= ReplicationPeerConfig.newBuilder(peerConfig);<a name="line.459"></a>
+<span class="sourceLineNo">460</span>    Map&lt;TableName, 
List&lt;String&gt;&gt; preExcludeTableCfs = 
peerConfig.getExcludeTableCFsMap();<a name="line.460"></a>
+<span class="sourceLineNo">461</span>    if (preExcludeTableCfs == null) {<a 
name="line.461"></a>
+<span class="sourceLineNo">462</span>      
builder.setExcludeTableCFsMap(excludeTableCfs);<a name="line.462"></a>
+<span class="sourceLineNo">463</span>    } else {<a name="line.463"></a>
+<span class="sourceLineNo">464</span>      
builder.setExcludeTableCFsMap(mergeTableCFs(preExcludeTableCfs, 
excludeTableCfs));<a name="line.464"></a>
+<span class="sourceLineNo">465</span>    }<a name="line.465"></a>
+<span class="sourceLineNo">466</span>    return builder.build();<a 
name="line.466"></a>
+<span class="sourceLineNo">467</span>  }<a name="line.467"></a>
+<span class="sourceLineNo">468</span><a name="line.468"></a>
+<span class="sourceLineNo">469</span>  private static Map&lt;TableName, 
List&lt;String&gt;&gt; mergeTableCFs(<a name="line.469"></a>
+<span class="sourceLineNo">470</span>      Map&lt;TableName, 
List&lt;String&gt;&gt; preTableCfs, Map&lt;TableName, List&lt;String&gt;&gt; 
tableCfs) {<a name="line.470"></a>
+<span class="sourceLineNo">471</span>    Map&lt;TableName, 
List&lt;String&gt;&gt; newTableCfs = copyTableCFsMap(preTableCfs);<a 
name="line.471"></a>
+<span class="sourceLineNo">472</span>    for (Map.Entry&lt;TableName, ? 
extends Collection&lt;String&gt;&gt; entry : tableCfs.entrySet()) {<a 
name="line.472"></a>
+<span class="sourceLineNo">473</span>      TableName table = entry.getKey();<a 
name="line.473"></a>
+<span class="sourceLineNo">474</span>      Collection&lt;String&gt; appendCfs 
= entry.getValue();<a name="line.474"></a>
+<span class="sourceLineNo">475</span>      if (newTableCfs.containsKey(table)) 
{<a name="line.475"></a>
+<span class="sourceLineNo">476</span>        List&lt;String&gt; cfs = 
newTableCfs.get(table);<a name="line.476"></a>
+<span class="sourceLineNo">477</span>        if (cfs == null || appendCfs == 
null || appendCfs.isEmpty()) {<a name="line.477"></a>
+<span class="sourceLineNo">478</span>          newTableCfs.put(table, null);<a 
name="line.478"></a>
+<span class="sourceLineNo">479</span>        } else {<a name="line.479"></a>
+<span class="sourceLineNo">480</span>          Set&lt;String&gt; cfSet = new 
HashSet&lt;String&gt;(cfs);<a name="line.480"></a>
+<span class="sourceLineNo">481</span>          cfSet.addAll(appendCfs);<a 
name="line.481"></a>
+<span class="sourceLineNo">482</span>          newTableCfs.put(table, 
Lists.newArrayList(cfSet));<a name="line.482"></a>
+<span class="sourceLineNo">483</span>        }<a name="line.483"></a>
+<span class="sourceLineNo">484</span>      } else {<a name="line.484"></a>
+<span class="sourceLineNo">485</span>        if (appendCfs == null || 
appendCfs.isEmpty()) {<a name="line.485"></a>
+<span class="sourceLineNo">486</span>          newTableCfs.put(table, null);<a 
name="line.486"></a>
+<span class="sourceLineNo">487</span>        } else {<a name="line.487"></a>
+<span class="sourceLineNo">488</span>          newTableCfs.put(table, 
Lists.newArrayList(appendCfs));<a name="line.488"></a>
+<span class="sourceLineNo">489</span>        }<a name="line.489"></a>
+<span class="sourceLineNo">490</span>      }<a name="line.490"></a>
+<span class="sourceLineNo">491</span>    }<a name="line.491"></a>
+<span class="sourceLineNo">492</span>    return newTableCfs;<a 
name="line.492"></a>
+<span class="sourceLineNo">493</span>  }<a name="line.493"></a>
+<span class="sourceLineNo">494</span><a name="line.494"></a>
+<span class="sourceLineNo">495</span>  private static Map&lt;TableName, 
List&lt;String&gt;&gt;<a name="line.495"></a>
+<span class="sourceLineNo">496</span>      copyTableCFsMap(Map&lt;TableName, 
List&lt;String&gt;&gt; preTableCfs) {<a name="line.496"></a>
+<span class="sourceLineNo">497</span>    Map&lt;TableName, 
List&lt;String&gt;&gt; newTableCfs = new HashMap&lt;&gt;();<a 
name="line.497"></a>
+<span class="sourceLineNo">498</span>    preTableCfs.forEach(<a 
name="line.498"></a>
+<span class="sourceLineNo">499</span>      (table, cfs) -&gt; 
newTableCfs.put(table, cfs != null ? Lists.newArrayList(cfs) : null));<a 
name="line.499"></a>
+<span class="sourceLineNo">500</span>    return newTableCfs;<a 
name="line.500"></a>
+<span class="sourceLineNo">501</span>  }<a name="line.501"></a>
+<span class="sourceLineNo">502</span><a name="line.502"></a>
+<span class="sourceLineNo">503</span>  public static ReplicationPeerConfig 
removeTableCFsFromReplicationPeerConfig(<a name="line.503"></a>
+<span class="sourceLineNo">504</span>      Map&lt;TableName, 
List&lt;String&gt;&gt; tableCfs, ReplicationPeerConfig peerConfig,<a 
name="line.504"></a>
+<span class="sourceLineNo">505</span>      String id) throws 
ReplicationException {<a name="line.505"></a>
+<span class="sourceLineNo">506</span>    Map&lt;TableName, 
List&lt;String&gt;&gt; preTableCfs = peerConfig.getTableCFsMap();<a 
name="line.506"></a>
+<span class="sourceLineNo">507</span>    if (preTableCfs == null) {<a 
name="line.507"></a>
+<span class="sourceLineNo">508</span>      throw new 
ReplicationException("Table-Cfs for peer: " + id + " is null");<a 
name="line.508"></a>
+<span class="sourceLineNo">509</span>    }<a name="line.509"></a>
+<span class="sourceLineNo">510</span>    Map&lt;TableName, 
List&lt;String&gt;&gt; newTableCfs = copyTableCFsMap(preTableCfs);<a 
name="line.510"></a>
+<span class="sourceLineNo">511</span>    for (Map.Entry&lt;TableName, ? 
extends Collection&lt;String&gt;&gt; entry : tableCfs.entrySet()) {<a 
name="line.511"></a>
+<span class="sourceLineNo">512</span>      TableName table = entry.getKey();<a 
name="line.512"></a>
+<span class="sourceLineNo">513</span>      Collection&lt;String&gt; removeCfs 
= entry.getValue();<a name="line.513"></a>
+<span class="sourceLineNo">514</span>      if (newTableCfs.containsKey(table)) 
{<a name="line.514"></a>
+<span class="sourceLineNo">515</span>        List&lt;String&gt; cfs = 
newTableCfs.get(table);<a name="line.515"></a>
+<span class="sourceLineNo">516</span>        if (cfs == null &amp;&amp; 
(removeCfs == null || removeCfs.isEmpty())) {<a name="line.516"></a>
+<span class="sourceLineNo">517</span>          newTableCfs.remove(table);<a 
name="line.517"></a>
+<span class="sourceLineNo">518</span>        } else if (cfs != null &amp;&amp; 
(removeCfs != null &amp;&amp; !removeCfs.isEmpty())) {<a name="line.518"></a>
+<span class="sourceLineNo">519</span>          Set&lt;String&gt; cfSet = new 
HashSet&lt;String&gt;(cfs);<a name="line.519"></a>
+<span class="sourceLineNo">520</span>          cfSet.removeAll(removeCfs);<a 
name="line.520"></a>
+<span class="sourceLineNo">521</span>          if (cfSet.isEmpty()) {<a 
name="line.521"></a>
+<span class="sourceLineNo">522</span>            newTableCfs.remove(table);<a 
name="line.522"></a>
+<span class="sourceLineNo">523</span>          } else {<a name="line.523"></a>
+<span class="sourceLineNo">524</span>            newTableCfs.put(table, 
Lists.newArrayList(cfSet));<a name="line.524"></a>
+<span class="sourceLineNo">525</span>          }<a name="line.525"></a>
+<span class="sourceLineNo">526</span>        } else if (cfs == null &amp;&amp; 
(removeCfs != null &amp;&amp; !removeCfs.isEmpty())) {<a name="line.526"></a>
+<span class="sourceLineNo">527</span>          throw new 
ReplicationException("Cannot remove cf of table: " + table<a 
name="line.527"></a>
+<span class="sourceLineNo">528</span>              + " which doesn't specify 
cfs from table-cfs config in peer: " + id);<a name="line.528"></a>
+<span class="sourceLineNo">529</span>        } else if (cfs != null &amp;&amp; 
(removeCfs == null || removeCfs.isEmpty())) {<a name="line.529"></a>
+<span class="sourceLineNo">530</span>          throw new 
ReplicationException("Cannot remove table: " + table<a name="line.530"></a>
+<span class="sourceLineNo">531</span>              + " which has specified cfs 
from table-cfs config in peer: " + id);<a name="line.531"></a>
+<span class="sourceLineNo">532</span>        }<a name="line.532"></a>
+<span class="sourceLineNo">533</span>      } else {<a name="line.533"></a>
+<span class="sourceLineNo">534</span>        throw new ReplicationException(<a 
name="line.534"></a>
+<span class="sourceLineNo">535</span>            "No table: " + table + " in 
table-cfs config of peer: " + id);<a name="line.535"></a>
+<span class="sourceLineNo">536</span>      }<a name="line.536"></a>
 <span class="sourceLineNo">537</span>    }<a name="line.537"></a>
-<span class="sourceLineNo">538</span><a name="line.538"></a>
-<span class="sourceLineNo">539</span>    if 
(!peerConfig.getConfiguration().isEmpty()) {<a name="line.539"></a>
-<span class="sourceLineNo">540</span>      CompoundConfiguration compound = 
new CompoundConfiguration();<a name="line.540"></a>
-<span class="sourceLineNo">541</span>      compound.add(otherConf);<a 
name="line.541"></a>
-<span class="sourceLineNo">542</span>      
compound.addStringMap(peerConfig.getConfiguration());<a name="line.542"></a>
-<span class="sourceLineNo">543</span>      return compound;<a 
name="line.543"></a>
-<span class="sourceLineNo">544</span>    }<a name="line.544"></a>
-<span class="sourceLineNo">545</span><a name="line.545"></a>
-<span class="sourceLineNo">546</span>    return otherConf;<a 
name="line.546"></a>
-<span class="sourceLineNo">547</span>  }<a name="line.547"></a>
-<span class="sourceLineNo">548</span>}<a name="line.548"></a>
+<span class="sourceLineNo">538</span>    ReplicationPeerConfigBuilder builder 
= ReplicationPeerConfig.newBuilder(peerConfig);<a name="line.538"></a>
+<span class="sourceLineNo">539</span>    
builder.setTableCFsMap(newTableCfs);<a name="line.539"></a>
+<span class="sourceLineNo">540</span>    return builder.build();<a 
name="line.540"></a>
+<span class="sourceLineNo">541</span>  }<a name="line.541"></a>
+<span class="sourceLineNo">542</span><a name="line.542"></a>
+<span class="sourceLineNo">543</span>  public static ReplicationPeerConfig 
removeExcludeTableCFsFromReplicationPeerConfig(<a name="line.543"></a>
+<span class="sourceLineNo">544</span>      Map&lt;TableName, 
List&lt;String&gt;&gt; excludeTableCfs, ReplicationPeerConfig peerConfig, 
String id)<a name="line.544"></a>
+<span class="sourceLineNo">545</span>      throws ReplicationException {<a 
name="line.545"></a>
+<span class="sourceLineNo">546</span>    if (excludeTableCfs == null) {<a 
name="line.546"></a>
+<span class="sourceLineNo">547</span>      throw new 
ReplicationException("exclude tableCfs is null");<a name="line.547"></a>
+<span class="sourceLineNo">548</span>    }<a name="line.548"></a>
+<span class="sourceLineNo">549</span>    Map&lt;TableName, 
List&lt;String&gt;&gt; preExcludeTableCfs = 
peerConfig.getExcludeTableCFsMap();<a name="line.549"></a>
+<span class="sourceLineNo">550</span>    if (preExcludeTableCfs == null) {<a 
name="line.550"></a>
+<span class="sourceLineNo">551</span>      throw new 
ReplicationException("exclude-Table-Cfs for peer: " + id + " is null");<a 
name="line.551"></a>
+<span class="sourceLineNo">552</span>    }<a name="line.552"></a>
+<span class="sourceLineNo">553</span>    Map&lt;TableName, 
List&lt;String&gt;&gt; newExcludeTableCfs = 
copyTableCFsMap(preExcludeTableCfs);<a name="line.553"></a>
+<span class="sourceLineNo">554</span>    for (Map.Entry&lt;TableName, ? 
extends Collection&lt;String&gt;&gt; entry : excludeTableCfs.entrySet()) {<a 
name="line.554"></a>
+<span class="sourceLineNo">555</span>      TableName table = entry.getKey();<a 
name="line.555"></a>
+<span class="sourceLineNo">556</span>      Collection&lt;String&gt; removeCfs 
= entry.getValue();<a name="line.556"></a>
+<span class="sourceLineNo">557</span>      if 
(newExcludeTableCfs.containsKey(table)) {<a name="line.557"></a>
+<span class="sourceLineNo">558</span>        List&lt;String&gt; cfs = 
newExcludeTableCfs.get(table);<a name="line.558"></a>
+<span class="sourceLineNo">559</span>        if (cfs == null &amp;&amp; 
(removeCfs == null || removeCfs.isEmpty())) {<a name="line.559"></a>
+<span class="sourceLineNo">560</span>          
newExcludeTableCfs.remove(table);<a name="line.560"></a>
+<span class="sourceLineNo">561</span>        } else if (cfs != null &amp;&amp; 
(removeCfs != null &amp;&amp; !removeCfs.isEmpty())) {<a name="line.561"></a>
+<span class="sourceLineNo">562</span>          Set&lt;String&gt; cfSet = new 
HashSet&lt;String&gt;(cfs);<a name="line.562"></a>
+<span class="sourceLineNo">563</span>          cfSet.removeAll(removeCfs);<a 
name="line.563"></a>
+<span class="sourceLineNo">564</span>          if (cfSet.isEmpty()) {<a 
name="line.564"></a>
+<span class="sourceLineNo">565</span>            
newExcludeTableCfs.remove(table);<a name="line.565"></a>
+<span class="sourceLineNo">566</span>          } else {<a name="line.566"></a>
+<span class="sourceLineNo">567</span>            newExcludeTableCfs.put(table, 
Lists.newArrayList(cfSet));<a name="line.567"></a>
+<span class="sourceLineNo">568</span>          }<a name="line.568"></a>
+<span class="sourceLineNo">569</span>        } else if (cfs == null &amp;&amp; 
(removeCfs != null &amp;&amp; !removeCfs.isEmpty())) {<a name="line.569"></a>
+<span class="sourceLineNo">570</span>          throw new 
ReplicationException("Cannot remove cf of table: " + table<a 
name="line.570"></a>
+<span class="sourceLineNo">571</span>              + " which doesn't specify 
cfs from exclude-table-cfs config in peer: " + id);<a name="line.571"></a>
+<span class="sourceLineNo">572</span>        } else if (cfs != null &amp;&amp; 
(removeCfs == null || removeCfs.isEmpty())) {<a name="line.572"></a>
+<span class="sourceLineNo">573</span>          throw new 
ReplicationException("Cannot remove table: " + table<a name="line.573"></a>
+<span class="sourceLineNo">574</span>              + " which has specified cfs 
from exclude-table-cfs config in peer: " + id);<a name="line.574"></a>
+<span class="sourceLineNo">575</span>        }<a name="line.575"></a>
+<span class="sourceLineNo">576</span>      } else {<a name="line.576"></a>
+<span class="sourceLineNo">577</span>        throw new ReplicationException(<a 
name="line.577"></a>
+<span class="sourceLineNo">578</span>            "No table: " + table + " in 
exclude-table-cfs config of peer: " + id);<a name="line.578"></a>
+<span class="sourceLineNo">579</span>      }<a name="line.579"></a>
+<span class="sourceLineNo">580</span>    }<a name="line.580"></a>
+<span class="sourceLineNo">581</span>    ReplicationPeerConfigBuilder builder 
= ReplicationPeerConfig.newBuilder(peerConfig);<a name="line.581"></a>
+<span class="sourceLineNo">582</span>    
builder.setExcludeTableCFsMap(newExcludeTableCfs);<a name="line.582"></a>
+<span class="sourceLineNo">583</span>    return builder.build();<a 
name="line.583"></a>
+<span class="sourceLineNo">584</span>  }<a name="line.584"></a>
+<span class="sourceLineNo">585</span><a name="line.585"></a>
+<span class="sourceLineNo">586</span>  /**<a name="line.586"></a>
+<span class="sourceLineNo">587</span>   * Returns the configuration needed to 
talk to the remote slave cluster.<a name="line.587"></a>
+<span class="sourceLineNo">588</span>   * @param conf the base configuration<a 
name="line.588"></a>
+<span class="sourceLineNo">589</span>   * @param peer the description of 
replication peer<a name="line.589"></a>
+<span class="sourceLineNo">590</span>   * @return the configuration for the 
peer cluster, null if it was unable to get the configuration<a 
name="line.590"></a>
+<span class="sourceLineNo">591</span>   * @throws IOException when create peer 
cluster configuration failed<a name="line.591"></a>
+<span class="sourceLineNo">592</span>   */<a name="line.592"></a>
+<span class="sourceLineNo">593</span>  public static Configuration 
getPeerClusterConfiguration(Configuration conf,<a name="line.593"></a>
+<span class="sourceLineNo">594</span>      ReplicationPeerDescription peer) 
throws IOException {<a name="line.594"></a>
+<span class="sourceLineNo">595</span>    ReplicationPeerConfig peerConfig = 
peer.getPeerConfig();<a name="line.595"></a>
+<span class="sourceLineNo">596</span>    Configuration otherConf;<a 
name="line.596"></a>
+<span class="sourceLineNo">597</span>    try {<a name="line.597"></a>
+<span class="sourceLineNo">598</span>      otherConf = 
HBaseConfiguration.createClusterConf(conf, peerConfig.getClusterKey());<a 
name="line.598"></a>
+<span class="sourceLineNo">599</span>    } catch (IOException e) {<a 
name="line.599"></a>
+<span class="sourceLineNo">600</span>      throw new IOException("Can't get 
peer configuration for peerId=" + peer.getPeerId(), e);<a name="line.600"></a>
+<span class="sourceLineNo">601</span>    }<a name="line.601"></a>
+<span class="sourceLineNo">602</span><a name="line.602"></a>
+<span class="sourceLineNo">603</span>    if 
(!peerConfig.getConfiguration().isEmpty()) {<a name="line.603"></a>
+<span class="sourceLineNo">604</span>      CompoundConfiguration compound = 
new CompoundConfiguration();<a name="line.604"></a>
+<span class="sourceLineNo">605</span>      compound.add(otherConf);<a 
name="line.605"></a>
+<span class="sourceLineNo">606</span>      
compound.addStringMap(peerConfig.getConfiguration());<a name="line.606"></a>
+<span class="sourceLineNo">607</span>      return compound;<a 
name="line.607"></a>
+<span class="sourceLineNo">608</span>    }<a name="line.608"></a>
+<span class="sourceLineNo">609</span><a name="line.609"></a>
+<span class="sourceLineNo">610</span>    return otherConf;<a 
name="line.610"></a>
+<span class="sourceLineNo">611</span>  }<a name="line.611"></a>
+<span class="sourceLineNo">612</span>}<a name="line.612"></a>
 
 
 

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/aa3fb87f/devapidocs/src-html/org/apache/hadoop/hbase/io/WALLink.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/io/WALLink.html 
b/devapidocs/src-html/org/apache/hadoop/hbase/io/WALLink.html
index cbdfc8a..d5b1c00 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/io/WALLink.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/io/WALLink.html
@@ -32,7 +32,7 @@
 <span class="sourceLineNo">024</span>import 
org.apache.hadoop.conf.Configuration;<a name="line.24"></a>
 <span class="sourceLineNo">025</span>import org.apache.hadoop.fs.Path;<a 
name="line.25"></a>
 <span class="sourceLineNo">026</span>import 
org.apache.hadoop.hbase.HConstants;<a name="line.26"></a>
-<span class="sourceLineNo">027</span>import 
org.apache.hadoop.hbase.util.FSUtils;<a name="line.27"></a>
+<span class="sourceLineNo">027</span>import 
org.apache.hadoop.hbase.util.CommonFSUtils;<a name="line.27"></a>
 <span class="sourceLineNo">028</span><a name="line.28"></a>
 <span class="sourceLineNo">029</span>/**<a name="line.29"></a>
 <span class="sourceLineNo">030</span> * WALLink describes a link to a WAL.<a 
name="line.30"></a>
@@ -53,7 +53,7 @@
 <span class="sourceLineNo">045</span>   */<a name="line.45"></a>
 <span class="sourceLineNo">046</span>  public WALLink(final Configuration 
conf,<a name="line.46"></a>
 <span class="sourceLineNo">047</span>      final String serverName, final 
String logName) throws IOException {<a name="line.47"></a>
-<span class="sourceLineNo">048</span>    this(FSUtils.getWALRootDir(conf), 
serverName, logName);<a name="line.48"></a>
+<span class="sourceLineNo">048</span>    
this(CommonFSUtils.getWALRootDir(conf), serverName, logName);<a 
name="line.48"></a>
 <span class="sourceLineNo">049</span>  }<a name="line.49"></a>
 <span class="sourceLineNo">050</span><a name="line.50"></a>
 <span class="sourceLineNo">051</span>  /**<a name="line.51"></a>

Reply via email to