Skip to content
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 @@ -89,8 +89,6 @@ public Result write(ConditionalMutation mutation) {

ServerConditionalMutation scm = new ServerConditionalMutation(tcm);

context.getZooCache().clear(RootTable.ZROOT_TABLET);

List<ServerConditionalMutation> okMutations = new ArrayList<>();
List<TCMResult> results = new ArrayList<>();

Expand Down Expand Up @@ -129,10 +127,7 @@ public Result write(ConditionalMutation mutation) {
} catch (Exception e) {
throw new RuntimeException(e);
}

// TODO this is racy...
context.getZooCache().clear(RootTable.ZROOT_TABLET);
Comment thread
Amemeda marked this conversation as resolved.

return getResult(okMutations, results, mutation);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,24 +97,17 @@ public void mutate() {
}

try {
context.getZooSession().asReaderWriter().mutateExisting(RootTable.ZROOT_TABLET, currVal -> {
String currJson = new String(currVal, UTF_8);
var rtm = new RootTabletMetadata(currJson);
rtm.update(mutation);
String newJson = rtm.toJson();
log.debug("mutation: from:[{}] to: [{}]", currJson, newJson);
return newJson.getBytes(UTF_8);
});

context.getZooCache().clear(RootTable.ZROOT_TABLET);

// TODO examine implementation of getZooReaderWriter().mutate()
// TODO for efficiency this should maybe call mutateExisting
context.getZooSession().asReaderWriter().mutateOrCreate(RootTable.ZROOT_TABLET, new byte[0],
currVal -> {
String currJson = new String(currVal, UTF_8);
var rtm = new RootTabletMetadata(currJson);
rtm.update(mutation);
String newJson = rtm.toJson();
log.debug("mutation: from:[{}] to: [{}]", currJson, newJson);
return newJson.getBytes(UTF_8);
});

// TODO this is racy...
context.getZooCache().clear(RootTable.ZROOT_TABLET);
Comment thread
Amemeda marked this conversation as resolved.

if (closeAfterMutate != null) {
closeAfterMutate.close();
}
Expand Down