Updated Branches: refs/heads/0.3.0-lucene-upgrade 3f6f7f332 -> 638d8088e
BLUR-273: Implement SnapshotDeletionPolicy to load old snapshots Signed-off-by: Aaron McCurry <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/638d8088 Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/638d8088 Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/638d8088 Branch: refs/heads/0.3.0-lucene-upgrade Commit: 638d8088e386e1a48840b8dbdfd155e02b895c4b Parents: 5cd6338 Author: Saurabh Gupta <[email protected]> Authored: Thu Dec 5 11:22:38 2013 +0530 Committer: Aaron McCurry <[email protected]> Committed: Tue Dec 10 08:10:28 2013 -0500 ---------------------------------------------------------------------- .../writer/BlurSnapshotDeletionPolicy.java | 26 +++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/638d8088/blur-core/src/main/java/org/apache/blur/manager/writer/BlurSnapshotDeletionPolicy.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/manager/writer/BlurSnapshotDeletionPolicy.java b/blur-core/src/main/java/org/apache/blur/manager/writer/BlurSnapshotDeletionPolicy.java index f19262f..c3b98b7 100644 --- a/blur-core/src/main/java/org/apache/blur/manager/writer/BlurSnapshotDeletionPolicy.java +++ b/blur-core/src/main/java/org/apache/blur/manager/writer/BlurSnapshotDeletionPolicy.java @@ -1,5 +1,21 @@ package org.apache.blur.manager.writer; +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import java.io.IOException; import java.util.HashMap; import java.util.Map; @@ -9,6 +25,10 @@ import org.apache.lucene.index.IndexDeletionPolicy; import org.apache.lucene.index.SnapshotDeletionPolicy; import org.apache.lucene.store.Directory; +/** + * This class extends {@link SnapshotDeletionPolicy}. It loads the old snapshots + * and also contain a map of snapshot file name and corresponding generation. + */ public class BlurSnapshotDeletionPolicy extends SnapshotDeletionPolicy { public static final String SNAPSHOTS_PREFIX = "_snapshot"; @@ -48,12 +68,6 @@ public class BlurSnapshotDeletionPolicy extends SnapshotDeletionPolicy { mapOfSnapshotNameGen.remove(snapshotName); } - /** - * Reads the snapshots information from the given {@link Directory}. This - * method can be used if the snapshots information is needed, however you - * cannot instantiate the deletion policy (because e.g., some other process - * keeps a lock on the snapshots directory). - */ private synchronized void loadPriorSnapshots() throws IOException { long genLoaded = -1; for (String file : dir.listAll()) {
