Revert "ZEPPELIN-367 Sync with secondary storage when listing notebooks"

This reverts commit ae08e713e4.

Conflicts:
	zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/NotebookRepoSync.java
	zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/NotebookRepoSyncTest.java
This commit is contained in:
Mina Lee 2015-12-26 17:50:01 -08:00
parent 6a803041c9
commit 3fc9ad0dea
2 changed files with 1 additions and 42 deletions

View file

@ -41,7 +41,6 @@ public class NotebookRepoSync implements NotebookRepo {
private static final int maxRepoNum = 2;
private static final String pushKey = "pushNoteIDs";
private static final String pullKey = "pullNoteIDs";
private static ZeppelinConfiguration config;
private List<NotebookRepo> repos = new ArrayList<NotebookRepo>();
@ -51,8 +50,6 @@ public class NotebookRepoSync implements NotebookRepo {
* @throws - Exception
*/
public NotebookRepoSync(ZeppelinConfiguration conf) throws Exception {
config = conf;
String allStorageClassNames = conf.getString(ConfVars.ZEPPELIN_NOTEBOOK_STORAGE).trim();
if (allStorageClassNames.isEmpty()) {
throw new IOException("Empty ZEPPELIN_NOTEBOOK_STORAGE conf parameter");
@ -80,9 +77,6 @@ public class NotebookRepoSync implements NotebookRepo {
*/
@Override
public List<NoteInfo> list() throws IOException {
if (config.getBoolean(ConfVars.ZEPPELIN_NOTEBOOK_RELOAD_FROM_STORAGE) && getRepoCount() > 1) {
sync(0, 1);
}
return getRepo(0).list();
}

View file

@ -25,7 +25,6 @@ import java.io.File;
import java.io.IOException;
import java.util.Map;
import org.apache.commons.io.FileUtils;
import org.apache.zeppelin.conf.ZeppelinConfiguration;
import org.apache.zeppelin.conf.ZeppelinConfiguration.ConfVars;
import org.apache.zeppelin.interpreter.InterpreterFactory;
@ -185,40 +184,6 @@ public class NotebookRepoSyncTest implements JobListenerFactory {
notebookRepoSync.list(1).get(0).getId()).getLastParagraph().getId());
}
@Test
public void testSyncOnList() throws IOException {
/* check that both storage repos are empty */
assertTrue(notebookRepoSync.getRepoCount() > 1);
assertEquals(0, notebookRepoSync.list(0).size());
assertEquals(0, notebookRepoSync.list(1).size());
File srcDir = new File("src/test/resources/2A94M5J1Z");
File destDir = new File(secNotebookDir + "/2A94M5J1Z");
/* copy manually new notebook into secondary storage repo and check repos */
try {
FileUtils.copyDirectory(srcDir, destDir);
} catch (IOException e) {
e.printStackTrace();
}
assertEquals(0, notebookRepoSync.list(0).size());
assertEquals(1, notebookRepoSync.list(1).size());
/* Although new notebook is added to secondary storage it's not displayed
* on list() with ZEPPELIN_NOTEBOOK_RELOAD_FROM_STORAGE set to false
*/
System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_RELOAD_FROM_STORAGE.getVarName(), "false");
assertEquals(0, notebookRepoSync.list().size());
/* notebook is synced after ZEPPELIN_NOTEBOOK_RELOAD_FROM_STORAGE variable is set to true */
System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_RELOAD_FROM_STORAGE.getVarName(), "true");
assertEquals(1, notebookRepoSync.list().size());
assertEquals(1, notebookRepoSync.list(0).size());
assertEquals(1, notebookRepoSync.list(1).size());
}
static void delete(File file){
if(file.isFile()) file.delete();
else if(file.isDirectory()){
@ -230,8 +195,8 @@ public class NotebookRepoSyncTest implements JobListenerFactory {
}
file.delete();
}
}
@Override
public JobListener getParagraphJobListener(Note note) {
return new JobListener(){