tkhurana commented on code in PR #1575:
URL: https://github.com/apache/phoenix/pull/1575#discussion_r1240106643
##########
phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java:
##########
@@ -2203,6 +2196,89 @@ public MetaDataResponse call(MetaDataService instance)
throws IOException {
return rpcCallback.get();
}
});
+
+ //For view creation, if SYSCAT rpc succeeds, mark child_link rows as
VERIFIED
+ if (!childLinkMutations.isEmpty()) {
+ try {
+ if (result.getMutationCode() == MutationCode.TABLE_NOT_FOUND) {
+ sendChildLinkMutations(childLinkMutations, true, false,
physicalTableNameBytes, schemaBytes);
+ } else {
+ sendChildLinkMutations(childLinkMutations, true, true,
physicalTableNameBytes, schemaBytes);
+ }
+ }
+ catch (SQLException e) {
+ //unverified rows will be repaired during read
+ LOGGER.debug("Exception in phase-3 of view creation: " +
e.getMessage());
+ addChildLinkScanTask();
+ }
+ }
+ return result;
+ }
+
+ /*
+ Helper method to send mutations to SYSTEM.CHILD_LINK using its endpoint
coprocessor
+ */
+ public void sendChildLinkMutations(List<Mutation> mutations, boolean
isVerified, boolean isDelete,
+ byte[] physicalTableNameBytes, byte[]
schemaBytes)
+ throws SQLException {
+
+ // get empty column information
+ PTable childLinkLogicalTable = getTable(null,
PhoenixDatabaseMetaData.SYSTEM_CHILD_LINK_NAME, HConstants.LATEST_TIMESTAMP);
+ byte[] emptyCF =
SchemaUtil.getEmptyColumnFamily(childLinkLogicalTable);
+ byte[] emptyCQ =
EncodedColumnsUtil.getEmptyKeyValueInfo(childLinkLogicalTable).getFirst();
+
+ // add empty column value to mutations or create delete mutations for
phase-3
+ List<Mutation> childLinkMutations = new ArrayList<>();
+ for (Mutation m : mutations) {
+ if (isDelete) {
+ Delete delete = new Delete(m.getRow());
+ childLinkMutations.add(delete);
+ }
+ else {
+ Put put = isVerified ? new Put(m.getRow()) : (Put)m;
+ byte[] emptyColumnValue = isVerified ? VERIFIED_BYTES :
UNVERIFIED_BYTES;
+ put.addColumn(emptyCF, emptyCQ, IndexUtil.getMaxTimestamp(m),
emptyColumnValue);
Review Comment:
When you are updating the empty column to verified shouldn't that be a
different timestamp. There should be two versions of the empty column cell. One
with unverified and other with verified and verified one should have a later
timestamp. Can you verify this ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]