Skip to content

Commit

Permalink
Minimized unneeded changes
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Nied <[email protected]>
  • Loading branch information
peternied committed Jun 28, 2024
1 parent e423390 commit 78a31ea
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 21 deletions.
5 changes: 3 additions & 2 deletions RFS/src/main/java/com/rfs/models/GlobalMetadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private JsonNode getJsonNode(SnapshotRepo.Provider repoDataProvider, String snap
String snapshotId = repoDataProvider.getSnapshotId(snapshotName);

if (snapshotId == null) {
throw new RuntimeException(snapshotName);
throw new CantFindSnapshotInRepo(snapshotName);
}

Path filePath = repoDataProvider.getRepo().getGlobalMetadataFilePath(snapshotId);
Expand All @@ -50,7 +50,7 @@ private JsonNode getJsonNode(SnapshotRepo.Provider repoDataProvider, String snap
ObjectMapper smileMapper = new ObjectMapper(smileFactory);
return smileMapper.readTree(bis);
} catch (Exception e) {
throw new RuntimeException(snapshotName, e);
throw new CantReadGlobalMetadataFromSnapshot(snapshotName, e);
}
}

Expand Down Expand Up @@ -82,4 +82,5 @@ public CantReadGlobalMetadataFromSnapshot(String snapshotName, Throwable cause)
super("Can't read the global metadata from snapshot: " + snapshotName, cause);
}
}

}
11 changes: 5 additions & 6 deletions RFS/src/main/java/com/rfs/models/ShardFileInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

import org.apache.lucene.util.BytesRef;

/**
* Defines the behavior expected of an object that will surface the metadata of an file stored in a snapshot
* See: https://github.com/elastic/elasticsearch/blob/7.10/server/src/main/java/org/elasticsearch/index/snapshots/blobstore/BlobStoreIndexShardSnapshot.java#L277
* See: https://github.com/elastic/elasticsearch/blob/6.8/server/src/main/java/org/elasticsearch/index/snapshots/blobstore/BlobStoreIndexShardSnapshot.java#L281
*/
public interface ShardFileInfo {

/*
* Defines the behavior expected of an object that will surface the metadata of an file stored in a snapshot
* See: https://github.com/elastic/elasticsearch/blob/7.10/server/src/main/java/org/elasticsearch/index/snapshots/blobstore/BlobStoreIndexShardSnapshot.java#L277
* See: https://github.com/elastic/elasticsearch/blob/6.8/server/src/main/java/org/elasticsearch/index/snapshots/blobstore/BlobStoreIndexShardSnapshot.java#L281
*/

public String getName();
public String getPhysicalName();
public long getLength();
Expand Down
10 changes: 5 additions & 5 deletions RFS/src/main/java/com/rfs/models/ShardMetadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
import com.rfs.common.RfsException;
import com.rfs.common.SnapshotRepo;

/**
* Defines the behavior expected of an object that will surface the metadata of an shard stored in a snapshot
* See: https://github.com/elastic/elasticsearch/blob/7.10/server/src/main/java/org/elasticsearch/index/snapshots/blobstore/BlobStoreIndexShardSnapshot.java#L510
* See: https://github.com/elastic/elasticsearch/blob/6.8/server/src/main/java/org/elasticsearch/index/snapshots/blobstore/BlobStoreIndexShardSnapshot.java#L508
*/
public interface ShardMetadata {

/*
* Defines the behavior expected of an object that will surface the metadata of an shard stored in a snapshot
* See: https://github.com/elastic/elasticsearch/blob/7.10/server/src/main/java/org/elasticsearch/index/snapshots/blobstore/BlobStoreIndexShardSnapshot.java#L510
* See: https://github.com/elastic/elasticsearch/blob/6.8/server/src/main/java/org/elasticsearch/index/snapshots/blobstore/BlobStoreIndexShardSnapshot.java#L508
*/
public String getSnapshotName();
public String getIndexName();
public String getIndexId();
Expand Down
11 changes: 5 additions & 6 deletions RFS/src/main/java/com/rfs/models/SnapshotMetadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@
import com.rfs.common.SnapshotRepo;
import com.rfs.common.SourceRepo;


/**
* Defines the behavior expected of an object that will surface the metadata of a snapshot
* See: https://github.com/elastic/elasticsearch/blob/7.10/server/src/main/java/org/elasticsearch/snapshots/SnapshotInfo.java#L615
* See: https://github.com/elastic/elasticsearch/blob/6.8/server/src/main/java/org/elasticsearch/snapshots/SnapshotInfo.java#L583
*/
public interface SnapshotMetadata {
// TODO: Turn into an ENUM when we know the other possible values
public static final String SNAPSHOT_SUCCEEDED = "SUCCESS";

/**
* Defines the behavior expected of an object that will surface the metadata of a snapshot
* See: https://github.com/elastic/elasticsearch/blob/7.10/server/src/main/java/org/elasticsearch/snapshots/SnapshotInfo.java#L615
* See: https://github.com/elastic/elasticsearch/blob/6.8/server/src/main/java/org/elasticsearch/snapshots/SnapshotInfo.java#L583
*/
public String getName();
public String getUuid();
public int getVersionId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public IndexMetadata transformIndexMetadata(IndexMetadata index) {
}

private void tranformIndex(Index index) {
logger.debug("Original Object: " + index.raw().toPrettyString());
logger.debug("Original Object: " + index.raw().toString());
var newRoot = index.raw();

indexTransformations.forEach(transformer -> transformer.applyTransformation(index));
Expand All @@ -76,6 +76,6 @@ private void tranformIndex(Index index) {
TransformFunctions.removeIntermediateIndexSettingsLevel(newRoot); // run before fixNumberOfReplicas
TransformFunctions.fixReplicasForDimensionality(newRoot, awarenessAttributeDimensionality);

logger.debug("Transformed Object: " + newRoot.toPrettyString());
logger.debug("Transformed Object: " + newRoot.toString());
}
}

0 comments on commit 78a31ea

Please sign in to comment.