Skip to content

Optimize delete op #177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ public static void removeChild(final long id) {
if (env.equals("VOLT")) {
// call a stored procedure
try {
obj.getVoltClient().callProcedure("RemoveChild", id);
obj.getVoltClient().callProcedure(new NullCallback(), "RemoveChild", id);
} catch (Exception e) {
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,7 @@ private static boolean unprotectedDelete(FSDirectory fsd, INodesInPath iip,

// ADD(gangliao): Remove inode from Postgres
DatabaseINode.removeChild(targetNode.getId());
if (targetNode.isDirectory()) {
List<Long> ids = DatabaseINode.getChildIds(targetNode.getId());
for (Long id : ids) {
INodeKeyedObjects.getCache().invalidateAllWithIndex(Long.class, id);
}
} else if (targetNode.isFile()) {
INodeKeyedObjects.getCache().invalidateAllWithIndex(Long.class, targetNode.getId());
}
INodeKeyedObjects.getCache().invalidateAllWithIndex(Long.class, targetNode.getId());

if (NameNode.stateChangeLog.isDebugEnabled()) {
NameNode.stateChangeLog.debug("DIR* FSDirectory.unprotectedDelete: "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -633,11 +633,17 @@ public boolean addChild(INode node, final String name,
if (node.isDirectory()) {
inode = node.asDirectory().copyINodeDirectory();
INodeKeyedObjects.getCache().invalidateAllWithIndex(Long.class, (Long)node.getId());
inode.asDirectory().updateINodeDirectory();
INodeKeyedObjects.getCache().put(new CompositeKey(inode.getId(),
new ImmutablePair<>(getId(), name)), inode.asDirectory());
} else {
inode = node.asFile().copyINodeFile();
INodeKeyedObjects.getCache().invalidateAllWithIndex(Long.class, (Long)node.getId());
inode.asFile().updateINodeFile();
FileUnderConstructionFeature uc = inode.asFile().getFileUnderConstructionFeature();
if (uc != null) {
uc.updateFileUnderConstruction(inode.getId());
}
INodeKeyedObjects.getCache().put(new CompositeKey(inode.getId(),
new ImmutablePair<>(getId(), name)), inode.asFile());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ public static IndexedCache<CompositeKey, INode> getCache() {
Caffeine.newBuilder()
.removalListener(
(Object keys, Object value, RemovalCause cause) -> {
if (cause == RemovalCause.EXPLICIT
|| cause == RemovalCause.COLLECTED
if (cause == RemovalCause.COLLECTED
|| cause == RemovalCause.EXPIRED
|| cause == RemovalCause.SIZE) {
if (LOG.isInfoEnabled()) {
Expand Down