Skip to content
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

revert back to avoid sync delete #179

Merged
merged 1 commit into from
Sep 21, 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 @@ -719,20 +719,14 @@ public static List<Long> getChildIdsByPath(final long id, final String[] compone
return res;
}

public static List<Long> removeChild(final long id) {
List<Long> childIds = new ArrayList<>();
public static void removeChild(final long id) {
try {
DatabaseConnection obj = Database.getInstance().getConnection();
String env = System.getenv("DATABASE");
if (env.equals("VOLT")) {
// call a stored procedure
try {
VoltTable[] results = obj.getVoltClient().callProcedure(new NullCallback(), "RemoveChild", id).getResults();
VoltTable result = results[0];
result.resetRowPosition();
while (result.advanceRow()) {
childIds.add(result.getLong(0));
}
obj.getVoltClient().callProcedure(new NullCallback(), "RemoveChild", id);
} catch (Exception e) {
e.printStackTrace();
}
Expand Down Expand Up @@ -761,7 +755,6 @@ public static List<Long> removeChild(final long id) {
if (LOG.isInfoEnabled()) {
LOG.info("removeChild: " + id);
}
return childIds;
}

public static List<String> getPathComponents(final long childId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,8 @@ private static boolean unprotectedDelete(FSDirectory fsd, INodesInPath iip,
}

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

if (NameNode.stateChangeLog.isDebugEnabled()) {
NameNode.stateChangeLog.debug("DIR* FSDirectory.unprotectedDelete: "
Expand Down
4 changes: 2 additions & 2 deletions voltdb/RemoveChild.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class RemoveChild extends VoltProcedure {
+ " SELECT id FROM cte;");
public final SQLStmt sql2 = new SQLStmt("DELETE FROM inodes WHERE id = ?;");

public VoltTable[] run(long id) throws VoltAbortException {
public long run(long id) throws VoltAbortException {
voltQueueSQL(sql1, id);
VoltTable[] results = voltExecuteSQL();

Expand All @@ -25,6 +25,6 @@ public VoltTable[] run(long id) throws VoltAbortException {
voltQueueSQL(sql2, results[0].fetchRow(i).getLong(0));
}
voltExecuteSQL();
return results;
return 1;
}
}