[jira] [Comment Edited] (HBASE-17149) Procedure v2 - Fix nonce submission

2016-12-28 Thread Stephen Yuan Jiang (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-17149?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15782652#comment-15782652
 ] 

Stephen Yuan Jiang edited comment on HBASE-17149 at 12/28/16 10:56 AM:
---

[~stack], Please review the {{HBASE-17149.v1-branch-1.patch}} for branch-1.  I 
tried to keep the core of the change while at the same time making some 
modification to fit the code base in branch-1.


was (Author: syuanjiang):
[~stack], Please review the 'HBASE-17149.v1-branch-1.patch' for branch-1.  I 
tried to keep the core of the change while at the same time making some 
modification to fit the code base in branch-1.

> Procedure v2 - Fix nonce submission
> ---
>
> Key: HBASE-17149
> URL: https://issues.apache.org/jira/browse/HBASE-17149
> Project: HBase
>  Issue Type: Sub-task
>  Components: proc-v2
>Affects Versions: 2.0.0, 1.3.0, 1.4.0, 1.1.7, 1.2.4
>Reporter: Matteo Bertozzi
>Assignee: Matteo Bertozzi
> Fix For: 2.0.0
>
> Attachments: 17149.branch-1.incomplete.txt, 
> HBASE-17149.master.001.patch, HBASE-17149.master.002.patch, 
> HBASE-17149.master.002.patch, HBASE-17149.master.002.patch, 
> HBASE-17149.master.003.patch, HBASE-17149.v1-branch-1.patch, nonce.patch
>
>
> instead of having all the logic in submitProcedure(), split in 
> registerNonce() + submitProcedure().
> In this case we can avoid calling the coprocessor twice and having a clean 
> submit logic knowing that there will only be one submission.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Comment Edited] (HBASE-17149) Procedure v2 - Fix nonce submission

2016-12-27 Thread Stephen Yuan Jiang (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-17149?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15781350#comment-15781350
 ] 

Stephen Yuan Jiang edited comment on HBASE-17149 at 12/27/16 10:01 PM:
---

The latch is already in branch-1 - the latch is for backwards compatible (if 
old client, client in 1.0 or less, calls new master, master in 1.1 and later, 
the old client expected some assurance of certain check, that is what the latch 
for).  Here is an example of latch code in branch-1.1:
{code}
  ProcedurePrepareLatch latch = ProcedurePrepareLatch.createLatch();
  procId = this.procedureExecutor.submitProcedure(
new CreateTableProcedure(
  procedureExecutor.getEnvironment(), hTableDescriptor, newRegions, 
latch),
nonceGroup,
nonce);
  latch.await();
{code}


was (Author: syuanjiang):
The latch is already in branch-1, just code is a little different - the latch 
is for backwards compatible (if old client, client in 1.0 or less, calls new 
master, master in 1.1 and later, the old client expected some assurance of 
certain check, that is what the latch for).  Here is an example of latch code 
in branch-1.1:
{code}
  ProcedurePrepareLatch latch = ProcedurePrepareLatch.createLatch();
  procId = this.procedureExecutor.submitProcedure(
new CreateTableProcedure(
  procedureExecutor.getEnvironment(), hTableDescriptor, newRegions, 
latch),
nonceGroup,
nonce);
  latch.await();
{code}

> Procedure v2 - Fix nonce submission
> ---
>
> Key: HBASE-17149
> URL: https://issues.apache.org/jira/browse/HBASE-17149
> Project: HBase
>  Issue Type: Sub-task
>  Components: proc-v2
>Affects Versions: 2.0.0, 1.3.0, 1.4.0, 1.1.7, 1.2.4
>Reporter: Matteo Bertozzi
>Assignee: Matteo Bertozzi
> Fix For: 2.0.0
>
> Attachments: 17149.branch-1.incomplete.txt, 
> HBASE-17149.master.001.patch, HBASE-17149.master.002.patch, 
> HBASE-17149.master.002.patch, HBASE-17149.master.002.patch, 
> HBASE-17149.master.003.patch, nonce.patch
>
>
> instead of having all the logic in submitProcedure(), split in 
> registerNonce() + submitProcedure().
> In this case we can avoid calling the coprocessor twice and having a clean 
> submit logic knowing that there will only be one submission.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Comment Edited] (HBASE-17149) Procedure v2 - Fix nonce submission

2016-12-15 Thread Stephen Yuan Jiang (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-17149?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15752365#comment-15752365
 ] 

Stephen Yuan Jiang edited comment on HBASE-17149 at 12/15/16 8:02 PM:
--

The UT failure is unrelated to this change.

The javadoc warning (basically, in the comments,@Override appears) - we can 
either ignore or make the comment simpler.  

I am not quite understand the FindBugs warning by looking at the code (maybe it 
complains that the 'completed' map is 100% sure that the key is missing when 
reaching to line 745): 
{code}
  public void setFailureResultForNonce(final NonceKey nonceKey, final String 
procName,

final User procOwner, final IOException exception) {

if (nonceKey == null) return;

final Long procId = nonceKeysToProcIdsMap.get(nonceKey);

if (procId == null || completed.containsKey(procId)) return;

final long currentTime = EnvironmentEdgeManager.currentTime();

final ProcedureInfo result = new ProcedureInfo(procId.longValue(),

  procName, procOwner != null ? procOwner.getShortName() : null,

  ProcedureUtil.convertToProcedureState(ProcedureState.ROLLEDBACK),

  -1, nonceKey, exception, currentTime, currentTime, null);

completed.putIfAbsent(procId.longValue(), result);  <== Line 745

  }
{code}

[~stack], any insight?  If you don't see issue either, then we can commit.


was (Author: syuanjiang):
The UT failure is unrelated to this change.

The javadoc warning (basically, in the comments,@Override appears) - we can 
either ignore or make the comment simpler.  

I am not quite understand the FindBugs warning by looking at the code (maybe it 
complains that the 'completed' map is 100% sure that the key is missing when 
reaching to line 745): 
{code}
  public void setFailureResultForNonce(final NonceKey nonceKey, final String 
procName,

final User procOwner, final IOException exception) {

if (nonceKey == null) return;

final Long procId = nonceKeysToProcIdsMap.get(nonceKey);

if (procId == null || completed.containsKey(procId)) return;

final long currentTime = EnvironmentEdgeManager.currentTime();

final ProcedureInfo result = new ProcedureInfo(procId.longValue(),

  procName, procOwner != null ? procOwner.getShortName() : null,

  ProcedureUtil.convertToProcedureState(ProcedureState.ROLLEDBACK),

  -1, nonceKey, exception, currentTime, currentTime, null);

completed.putIfAbsent(procId.longValue(), result);  <== Line 745

  }
{code}


> Procedure v2 - Fix nonce submission
> ---
>
> Key: HBASE-17149
> URL: https://issues.apache.org/jira/browse/HBASE-17149
> Project: HBase
>  Issue Type: Sub-task
>  Components: proc-v2
>Affects Versions: 2.0.0, 1.3.0, 1.4.0, 1.1.7, 1.2.4
>Reporter: Matteo Bertozzi
>Assignee: Matteo Bertozzi
> Attachments: nonce.patch
>
>
> instead of having all the logic in submitProcedure(), split in 
> registerNonce() + submitProcedure().
> In this case we can avoid calling the coprocessor twice and having a clean 
> submit logic knowing that there will only be one submission.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)