@Override
        public void sync(boolean forceSync) throws IOException {
          if (throwSyncException) {
            throw new IOException("FAKE! Failed to replace a bad datanode...");
          }
          w.sync(forceSync);
        }
Testing sync/append failures. Copied from TestHRegion.
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestFailedAppendAndSync.java