Mercurial Hosting > luan
comparison src/luan/modules/lucene/LuceneIndex.java @ 1447:851b9a48cc44
Luan.parse
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 18 Feb 2020 14:54:35 -0700 |
parents | 3aae37efbf40 |
children | 928be2a4d565 |
comparison
equal
deleted
inserted
replaced
1446:f2082e9aeaa9 | 1447:851b9a48cc44 |
---|---|
844 } | 844 } |
845 luanLogger.info("end rebuild_postgres_backup"); | 845 luanLogger.info("end rebuild_postgres_backup"); |
846 } | 846 } |
847 | 847 |
848 public void restore_from_postgres() | 848 public void restore_from_postgres() |
849 throws IOException, LuanException, SQLException | 849 throws IOException, LuanException, SQLException, ParseException |
850 { | 850 { |
851 if( postgresBackup!=null && wasCreated && !postgresBackup.wasCreated ) { | 851 if( postgresBackup!=null && wasCreated && !postgresBackup.wasCreated ) { |
852 luanLogger.error("restoring from postgres"); | 852 luanLogger.error("restoring from postgres"); |
853 force_restore_from_postgres(); | 853 force_restore_from_postgres(); |
854 } | 854 } |
855 } | 855 } |
856 | 856 |
857 public void force_restore_from_postgres() | 857 public void force_restore_from_postgres() |
858 throws IOException, LuanException, SQLException | 858 throws IOException, LuanException, SQLException, ParseException |
859 { | 859 { |
860 luanLogger.warn("start restore_from_postgres"); | 860 luanLogger.warn("start restore_from_postgres"); |
861 if( postgresBackup==null ) | 861 if( postgresBackup==null ) |
862 throw new NullPointerException(); | 862 throw new NullPointerException(); |
863 if( writeLock.isHeldByCurrentThread() ) | 863 if( writeLock.isHeldByCurrentThread() ) |
888 throws LuanException, IOException | 888 throws LuanException, IOException |
889 { | 889 { |
890 writer.addDocument(toLucene(doc,null)); | 890 writer.addDocument(toLucene(doc,null)); |
891 } | 891 } |
892 | 892 |
893 public void check(LuanFunction completer) throws IOException, SQLException, LuanException { | 893 public void check(LuanFunction completer) throws IOException, SQLException, LuanException, ParseException { |
894 boolean hasPostgres = postgresBackup != null; | 894 boolean hasPostgres = postgresBackup != null; |
895 String msg = "start check"; | 895 String msg = "start check"; |
896 if( hasPostgres ) | 896 if( hasPostgres ) |
897 msg += " with postgres"; | 897 msg += " with postgres"; |
898 luanLogger.info(msg); | 898 luanLogger.info(msg); |
903 checkPostgres(completer); | 903 checkPostgres(completer); |
904 luanLogger.info("end check"); | 904 luanLogger.info("end check"); |
905 } | 905 } |
906 | 906 |
907 private void checkPostgres(LuanFunction completer) | 907 private void checkPostgres(LuanFunction completer) |
908 throws IOException, SQLException, LuanException | 908 throws IOException, SQLException, LuanException, ParseException |
909 { | 909 { |
910 //luanLogger.info("start postgres check"); | 910 //luanLogger.info("start postgres check"); |
911 final PostgresBackup.Checker postgresChecker = postgresBackup.newChecker(); | 911 final PostgresBackup.Checker postgresChecker = postgresBackup.newChecker(); |
912 final IndexSearcher searcher = openSearcher(); | 912 final IndexSearcher searcher = openSearcher(); |
913 try { | 913 try { |
966 postgresChecker.close(); | 966 postgresChecker.close(); |
967 } | 967 } |
968 } | 968 } |
969 | 969 |
970 private void checkPostgres(LuanFunction completer,PostgresBackup.Checker postgresChecker,LuanToString lts,long id) | 970 private void checkPostgres(LuanFunction completer,PostgresBackup.Checker postgresChecker,LuanToString lts,long id) |
971 throws IOException, SQLException, LuanException | 971 throws IOException, SQLException, LuanException, ParseException |
972 { | 972 { |
973 //luanLogger.info("check id "+id); | 973 //luanLogger.info("check id "+id); |
974 writeLock.lock(); | 974 writeLock.lock(); |
975 try { | 975 try { |
976 final IndexSearcher searcher = openSearcher(); | 976 final IndexSearcher searcher = openSearcher(); |