Guest User

Untitled

a guest
Jul 18th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.74 KB | None | 0 0
  1. patch -p1 < 582.patch
  2. patching file src/java/org/apache/cassandra/service/StorageService.java
  3. Hunk #1 FAILED at 968.
  4. Hunk #2 FAILED at 1013.
  5. 2 out of 2 hunks FAILED -- saving rejects to file src/java/org/apache/cassandra/service/StorageService.java.rej
  6.  
  7.  
  8.  
  9.  
  10. cat src/java/org/apache/cassandra/service/StorageService.java.rej
  11. ***************
  12. *** 968,978 ****
  13. unbootstrap(finishLeaving);
  14. }
  15.  
  16. private void unbootstrap(final Runnable onFinish)
  17. {
  18. Multimap<Range, InetAddress> rangesMM = getChangedRangesForLeaving(FBUtilities.getLocalAddress());
  19. if (logger_.isDebugEnabled())
  20. logger_.debug("Ranges needing transfer are [" + StringUtils.join(rangesMM.keySet(), ",") + "]");
  21. final Set<Map.Entry<Range, InetAddress>> pending = new HashSet<Map.Entry<Range, InetAddress>>(rangesMM.entries());
  22. for (final Map.Entry<Range, InetAddress> entry : rangesMM.entries())
  23. {
  24. --- 968,1006 ----
  25. unbootstrap(finishLeaving);
  26. }
  27.  
  28. + private void leaveRing()
  29. + {
  30. + SystemTable.setBootstrapped(false);
  31. + tokenMetadata_.removeEndpoint(FBUtilities.getLocalAddress());
  32. + replicationStrategy_.removeObsoletePendingRanges();
  33. +
  34. + if (logger_.isDebugEnabled())
  35. + logger_.debug("");
  36. + Gossiper.instance().addApplicationState(STATE_LEFT, new ApplicationState(getLocalToken().toString()));
  37. + try
  38. + {
  39. + Thread.sleep(2 * Gossiper.intervalInMillis_);
  40. + }
  41. + catch (InterruptedException e)
  42. + {
  43. + throw new AssertionError(e);
  44. + }
  45. + }
  46. +
  47. private void unbootstrap(final Runnable onFinish)
  48. {
  49. Multimap<Range, InetAddress> rangesMM = getChangedRangesForLeaving(FBUtilities.getLocalAddress());
  50. if (logger_.isDebugEnabled())
  51. logger_.debug("Ranges needing transfer are [" + StringUtils.join(rangesMM.keySet(), ",") + "]");
  52. +
  53. + if (rangesMM.isEmpty())
  54. + {
  55. + // nothing needs transfer, so leave immediately. this can happen when replication factor == number of nodes.
  56. + leaveRing();
  57. + onFinish.run();
  58. + return;
  59. + }
  60. +
  61. final Set<Map.Entry<Range, InetAddress>> pending = new HashSet<Map.Entry<Range, InetAddress>>(rangesMM.entries());
  62. for (final Map.Entry<Range, InetAddress> entry : rangesMM.entries())
  63. {
  64. ***************
  65. *** 985,1006 ****
  66. pending.remove(entry);
  67. if (pending.isEmpty())
  68. {
  69. - SystemTable.setBootstrapped(false);
  70. - tokenMetadata_.removeEndpoint(FBUtilities.getLocalAddress());
  71. - replicationStrategy_.removeObsoletePendingRanges();
  72. -
  73. - if (logger_.isDebugEnabled())
  74. - logger_.debug("");
  75. - Gossiper.instance().addApplicationState(STATE_LEFT, new ApplicationState(getLocalToken().toString()));
  76. - try
  77. - {
  78. - Thread.sleep(2 * Gossiper.intervalInMillis_);
  79. - }
  80. - catch (InterruptedException e)
  81. - {
  82. - throw new AssertionError(e);
  83. - }
  84. -
  85. onFinish.run();
  86. }
  87. }
  88. --- 1013,1019 ----
  89. pending.remove(entry);
  90. if (pending.isEmpty())
  91. {
  92. + leaveRing();
  93. onFinish.run();
  94. }
  95. }
Add Comment
Please, Sign In to add comment