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

fix: update subtree #299

Merged
merged 1 commit into from
Feb 25, 2021
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 @@ -58,6 +58,9 @@ public static Set<String> getRenameSet() {
}

private static void insertToDB() {
if (concurrentUpdateSet == null) {
return;
}
int i = 0;
final int num = 1024;
long updateSize = concurrentUpdateSet.size();
Expand Down Expand Up @@ -157,6 +160,9 @@ private static void insertToDB() {
}

private static void removeToDB() {
if (concurrentRemoveSet == null) {
return;
}
int i = 0;
final int num = 1024;
List<Long> removeIds = new ArrayList<>();
Expand Down Expand Up @@ -202,6 +208,9 @@ private static void removeToDB() {
}

private static void renameToDB() {
if (concurrentRenameSet == null) {
return;
}
int i = 0;
final int num = 1024;
long renameSize = concurrentRenameSet.size();
Expand Down
46 changes: 21 additions & 25 deletions voltdb/UpdateSubtree.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,21 @@ public long run(final long dir_id, final long dest_id, final String old_parent_n
for (int j = 0; j < res.length; ++j) {
for (int k = 0; k < res[j].getRowCount(); ++k) {
VoltTableRow row = res[j].fetchRow(k);
row.resetRowPosition();
while (row.advanceRow()) {
set.add(row.getLong(0));
}
set.add(row.getLong(0));
}
}
}

for (Long child : set) {
voltQueueSQL(sql2, child);
}
VoltTable[] res = voltExecuteSQL();

for (Long child : set) {
voltQueueSQL(sql4, child);
}
voltExecuteSQL();

Long id = null;
String name = null;
Long accessTime = null;
Expand All @@ -53,27 +56,24 @@ public long run(final long dir_id, final long dest_id, final String old_parent_n
for (int j = 0; j < res.length; ++j) {
for (i = 0; i < res[j].getRowCount(); ++i) {
VoltTableRow row = res[j].fetchRow(i);
row.resetRowPosition();
while (row.advanceRow()) {
id = row.getLong(0);
name = row.getString(1);
accessTime = row.getLong(2);
modificationTime = row.getLong(3);
permission = row.getLong(4);
header = row.getLong(5);
parent = row.getLong(6);
parentName = row.getString(7);
}
id = row.getLong(0);
name = row.getString(1);
accessTime = row.getLong(2);
modificationTime = row.getLong(3);
permission = row.getLong(4);
header = row.getLong(5);
parent = row.getLong(6);
parentName = row.getString(7);

if (id == dir_id) {
id += dest_id;
id += dest_id;
parent = new_parent;
parentName = new_parent_name;
parentName = new_parent_name;
} else {
id += dest_id;
id += dest_id;
parent += dest_id;
parentName = new_parent_name + parentName.substring(old_parent_name.length());
}

voltQueueSQL(sql3,
id,
name,
Expand All @@ -85,12 +85,8 @@ public long run(final long dir_id, final long dest_id, final String old_parent_n
parentName);
}
}
voltExecuteSQL();

for (Long child : set) {
voltQueueSQL(sql4, child);
}
voltExecuteSQL();

return 1;
}
}