Github user samarthjain commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/153#discussion_r58117686
  
    --- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
 ---
    @@ -3201,4 +3367,155 @@ private MetaDataMutationResult doDropFunction(long 
clientTimeStamp, List<byte[]>
             return new MetaDataMutationResult(MutationCode.FUNCTION_NOT_FOUND,
                     EnvironmentEdgeManager.currentTimeMillis(), null);
         }
    +
    +    @Override
    +    public void createSchema(RpcController controller, CreateSchemaRequest 
request,
    +            RpcCallback<MetaDataResponse> done) {
    +        MetaDataResponse.Builder builder = MetaDataResponse.newBuilder();
    +        String schemaName = null;
    +        try {
    +            List<Mutation> schemaMutations = 
ProtobufUtil.getMutations(request);
    +            schemaName = request.getSchemaName();
    +            Mutation m = 
MetaDataUtil.getPutOnlyTableHeaderRow(schemaMutations);
    +
    +            byte[] lockKey = m.getRow();
    +            Region region = env.getRegion();
    +            MetaDataMutationResult result = 
checkSchemaKeyInRegion(lockKey, region);
    +            if (result != null) {
    +                done.run(MetaDataMutationResult.toProto(result));
    +                return;
    +            }
    +            List<RowLock> locks = Lists.newArrayList();
    +            long clientTimeStamp = 
MetaDataUtil.getClientTimeStamp(schemaMutations);
    +            try {
    +                acquireLock(region, lockKey, locks);
    +                // Get as of latest timestamp so we can detect if we have a
    +                // newer function that already
    --- End diff --
    
    newer schema. Also, please format the comments.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to