[
https://issues.apache.org/jira/browse/CASSANDRA-15012?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16766633#comment-16766633
]
Joseph Lynch commented on CASSANDRA-15012:
------------------------------------------
Indeed, didn't even know about the interactive mode! I've fixed that up as well:
||2.2||
|Cassandra patch:
[c1b6f529|https://github.com/apache/cassandra/commit/c1b6f529b7a1b75b6f6df338741b198696f32980]|
|Cassandra
[branch|https://github.com/apache/cassandra/compare/cassandra-2.2...jolynch:CASSANDRA-15012]|
|dtest patch [PR|https://github.com/apache/cassandra-dtest/pull/42]|
|dtest circleci run:
[!https://circleci.com/gh/jolynch/cassandra/tree/CASSANDRA-15012.png?circle-token=
1102a59698d04899ec971dd36e925928f7b521f5!|https://circleci.com/gh/jolynch/cassandra/tree/CASSANDRA-15012]|
Local interactive testing (I don't really want to do interactive stdout/stdin
testing using the dtests but if you think we need to I can do it):
*python tools/bin/token-generator --test*
{noformat}
$ python --version
Python 3.6.7
$ python tools/bin/token-generator --test
Test [1]
DC #1:
Node #1: -9223372036854775808
Test [1, 1]
DC #1:
Node #1: -9223372036854775808
DC #2:
Node #1: 9144875253562394737
Test [2, 2]
DC #1:
Node #1: -9223372036854775808
Node #2: 0
DC #2:
Node #1: -78496783292381071
Node #2: 9144875253562394737
Test [1, 2, 2]
DC #1:
Node #1: -9223372036854775808
DC #2:
Node #1: -78496783292381071
Node #2: 9144875253562394737
DC #3:
Node #1: -156993566584762142
Node #2: 9066378470270013666
Test [2, 2, 2]
DC #1:
Node #1: -9223372036854775808
Node #2: 0
DC #2:
Node #1: -78496783292381071
Node #2: 9144875253562394737
DC #3:
Node #1: -156993566584762142
Node #2: 9066378470270013666
Test [2, 0, 0]
DC #1:
Node #1: -9223372036854775808
Node #2: 0
DC #2:
DC #3:
Test [0, 2, 0]
DC #1:
DC #2:
Node #1: -78496783292381071
Node #2: 9144875253562394737
DC #3:
Test [0, 0, 2]
DC #1:
DC #2:
DC #3:
Node #1: -156993566584762142
Node #2: 9066378470270013666
Test [2, 2, 0]
DC #1:
Node #1: -9223372036854775808
Node #2: 0
DC #2:
Node #1: -78496783292381071
Node #2: 9144875253562394737
DC #3:
Test [2, 0, 2]
DC #1:
Node #1: -9223372036854775808
Node #2: 0
DC #2:
DC #3:
Node #1: -156993566584762142
Node #2: 9066378470270013666
Test [0, 2, 2]
DC #1:
DC #2:
Node #1: -78496783292381071
Node #2: 9144875253562394737
DC #3:
Node #1: -156993566584762142
Node #2: 9066378470270013666
Test [0, 0, 1, 1, 0, 1, 1]
DC #1:
DC #2:
DC #3:
Node #1: 9066378470270013666
DC #4:
Node #1: 8987881686977632595
DC #5:
DC #6:
Node #1: 8830888120392870453
DC #7:
Node #1: 8752391337100489382
Test [6]
DC #1:
Node #1: -9223372036854775808
Node #2: -6148914691236517206
Node #3: -3074457345618258604
Node #4: -2
Node #5: 3074457345618258600
Node #6: 6148914691236517202
Test [3, 3, 3]
DC #1:
Node #1: -9223372036854775808
Node #2: -3074457345618258603
Node #3: 3074457345618258602
DC #2:
Node #1: -3152954128910639674
Node #2: 2995960562325877531
Node #3: 9144875253562394737
DC #3:
Node #1: -3231450912203020745
Node #2: 2917463779033496460
Node #3: 9066378470270013666
Test [9]
DC #1:
Node #1: -9223372036854775808
Node #2: -7173733806442603407
Node #3: -5124095576030431006
Node #4: -3074457345618258605
Node #5: -1024819115206086204
Node #6: 1024819115206086197
Node #7: 3074457345618258598
Node #8: 5124095576030430999
Node #9: 7173733806442603400
Test [1, 1, 1, 1]
DC #1:
Node #1: -9223372036854775808
DC #2:
Node #1: 9144875253562394737
DC #3:
Node #1: 9066378470270013666
DC #4:
Node #1: 8987881686977632595
Test [4]
DC #1:
Node #1: -9223372036854775808
Node #2: -4611686018427387904
Node #3: 0
Node #4: 4611686018427387904
Test [3, 3, 6, 4, 2]
DC #1:
Node #1: -9223372036854775808
Node #2: -3074457345618258603
Node #3: 3074457345618258602
DC #2:
Node #1: -3152954128910639674
Node #2: 2995960562325877531
Node #3: 9144875253562394737
DC #3:
Node #1: -6305908257821279348
Node #2: -3231450912203020746
Node #3: -156993566584762144
Node #4: 2917463779033496458
Node #5: 5991921124651755060
Node #6: 9066378470270013666
DC #4:
Node #1: -4847176368304531117
Node #2: -235490349877143213
Node #3: 4376195668550244691
Node #4: 8987881686977632595
DC #5:
Node #1: -313987133169524284
Node #2: 8909384903685251524
{noformat}
*python tools/bin/token-generator --murmur3*
{noformat}
$ python tools/bin/token-generator --murmur3
Token Generator Interactive Mode
--------------------------------
How many datacenters will participate in this Cassandra cluster? 3
How many nodes are in datacenter #1? 12
How many nodes are in datacenter #2? 14
How many nodes are in datacenter #3? 8
DC #1:
Node #01: -9223372036854775808
Node #02: -7686143364045646507
Node #03: -6148914691236517206
Node #04: -4611686018427387905
Node #05: -3074457345618258604
Node #06: -1537228672809129303
Node #07: -2
Node #08: 1537228672809129299
Node #09: 3074457345618258600
Node #10: 4611686018427387901
Node #11: 6148914691236517202
Node #12: 7686143364045646503
DC #2:
Node #01: -7984244243453617478
Node #02: -6666619666760078077
Node #03: -5348995090066538676
Node #04: -4031370513372999275
Node #05: -2713745936679459874
Node #06: -1396121359985920473
Node #07: -78496783292381072
Node #08: 1239127793401158329
Node #09: 2556752370094697730
Node #10: 3874376946788237131
Node #11: 5192001523481776532
Node #12: 6509626100175315933
Node #13: 7827250676868855334
Node #14: 9144875253562394737
DC #3:
Node #1: -7074522594225843998
Node #2: -4768679585012150046
Node #3: -2462836575798456094
Node #4: -156993566584762142
Node #5: 2148849442628931810
Node #6: 4454692451842625762
Node #7: 6760535461056319714
Node #8: 9066378470270013666
{noformat}
*python tools/bin/token-generator --random*
{noformat}
python tools/bin/token-generator --random
Token Generator Interactive Mode
--------------------------------
How many datacenters will participate in this Cassandra cluster? 5
How many nodes are in datacenter #1? 2
How many nodes are in datacenter #2? 2
How many nodes are in datacenter #3? 2
How many nodes are in datacenter #4? 2
How many nodes are in datacenter #5? 2
DC #1:
Node #1: 0
Node #2: 85070591730234615865843651857942052864
DC #2:
Node #1: 84346586694232619135070514395321269435
Node #2: 169417178424467235000914166253263322299
DC #3:
Node #1: 83622581658230622404297376932700486006
Node #2: 168693173388465238270141028790642538870
DC #4:
Node #1: 82898576622228625673524239470079702577
Node #2: 167969168352463241539367891328021755441
DC #5:
Node #1: 82174571586226628942751102007458919148
Node #2: 167245163316461244808594753865400972012
{noformat}
*python tools/bin/token-generator --random --graph *
{noformat}
$ python tools/bin/token-generator --random --graph
Token Generator Interactive Mode
--------------------------------
How many datacenters will participate in this Cassandra cluster? 2
How many nodes are in datacenter #1? 2
How many nodes are in datacenter #2? 2
DC #1:
Node #1: 0
Node #2: 85070591730234615865843651857942052864
DC #2:
Node #1: 84346586694232619135070514395321269435
Node #2: 169417178424467235000914166253263322299
Opening in existing browser session.
{noformat}
Pretty html pictures attached, they look right to me?
> token_generator_test.TestTokenGenerator test fails on 2.2
> ---------------------------------------------------------
>
> Key: CASSANDRA-15012
> URL: https://issues.apache.org/jira/browse/CASSANDRA-15012
> Project: Cassandra
> Issue Type: Improvement
> Components: Test/dtest
> Reporter: Joseph Lynch
> Assignee: Joseph Lynch
> Priority: Minor
> Labels: beginner, dtest, test
> Fix For: 2.2.x
>
>
> While running tests for the 2.2.14 candidate I noticed that the
> {{TestTokenGenerator}} dtests are broken. I reproduced locally as well, the
> issue appears to be that we're running a python2 script with python3 (since
> dtests run python3 now).
> Should be a quick fix to make the token generator script py2/3 compatible.
> Example local run:
> {noformat}
> pytest --cassandra-dir=/home/josephl/pg/cassandra_2 -k TestTokenGenerator
>
> 1 ↵
> ===============================================================================================================
> test session starts
> ================================================================================================================
> platform linux -- Python 3.6.7, pytest-3.6.4, py-1.7.0, pluggy-0.7.1
> rootdir: /home/josephl/pg/cassandra-dtest, inifile: pytest.ini
> plugins: timeout-1.3.3, flaky-3.4.0
> timeout: 900.0s
> timeout method: signal
> timeout func_only: False
> collected 1028 items / 1025 deselected
>
>
>
> token_generator_test.py FFF
>
>
> [100%]
> =====================================================================================================================
> FAILURES
> =====================================================================================================================
> _________________________________________________________________________________________________
> TestTokenGenerator.test_multi_dc_tokens_default
> __________________________________________________________________________________________________
> self = <token_generator_test.TestTokenGenerator object at 0x7f5188c7cdd8>
> def test_multi_dc_tokens_default(self):
> > self._multi_dc_tokens()
> token_generator_test.py:167:
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _ _ _ _ _
> token_generator_test.py:153: in _multi_dc_tokens
> generated_tokens =
> self.call_token_generator(self.cluster.get_install_dir(), random, dc_nodes)
> token_generator_test.py:43: in call_token_generator
> token_gen_output = subprocess.check_output(args)
> /usr/lib/python3.6/subprocess.py:336: in check_output
> **kwargs).stdout
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _ _ _ _ _
> input = None, timeout = None, check = True, popenargs =
> (['/home/josephl/pg/cassandra_2/tools/bin/token-generator', '3', '5'],),
> kwargs = {'stdout': -1}, process = <subprocess.Popen object at
> 0x7f5188b80208>, stdout = b'', stderr = None
> retcode = 1
> def run(*popenargs, input=None, timeout=None, check=False, **kwargs):
> """Run command with arguments and return a CompletedProcess instance.
>
> The returned instance will have attributes args, returncode, stdout
> and
> stderr. By default, stdout and stderr are not captured, and those
> attributes
> will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture
> them.
>
> If check is True and the exit code was non-zero, it raises a
> CalledProcessError. The CalledProcessError object will have the
> return code
> in the returncode attribute, and output & stderr attributes if those
> streams
> were captured.
>
> If timeout is given, and the process takes too long, a TimeoutExpired
> exception will be raised.
>
> There is an optional argument "input", allowing you to
> pass a string to the subprocess's stdin. If you use this argument
> you may not also use the Popen constructor's "stdin" argument, as
> it will be used internally.
>
> The other arguments are the same as for the Popen constructor.
>
> If universal_newlines=True is passed, the "input" argument must be a
> string and stdout/stderr in the returned object will be strings
> rather than
> bytes.
> """
> if input is not None:
> if 'stdin' in kwargs:
> raise ValueError('stdin and input arguments may not both be
> used.')
> kwargs['stdin'] = PIPE
>
> with Popen(*popenargs, **kwargs) as process:
> try:
> stdout, stderr = process.communicate(input, timeout=timeout)
> except TimeoutExpired:
> process.kill()
> stdout, stderr = process.communicate()
> raise TimeoutExpired(process.args, timeout, output=stdout,
> stderr=stderr)
> except:
> process.kill()
> process.wait()
> raise
> retcode = process.poll()
> if check and retcode:
> raise CalledProcessError(retcode, process.args,
> > output=stdout, stderr=stderr)
> E subprocess.CalledProcessError: Command
> '['/home/josephl/pg/cassandra_2/tools/bin/token-generator', '3', '5']'
> returned non-zero exit status 1.
> /usr/lib/python3.6/subprocess.py:418: CalledProcessError
> --------------------------------------------------------------------------------------------------------------
> Captured stdout setup
> ---------------------------------------------------------------------------------------------------------------
> 10:03:31,457 ccm DEBUG Log-watching thread starting.
> ----------------------------------------------------------------------------------------------------------------
> Captured log setup
> ----------------------------------------------------------------------------------------------------------------
> 10:03:31,425 conftest INFO Starting execution of test_multi_dc_tokens_default
> at 2019-02-05 10:03:31.425612
> 10:03:31,426 dtest_setup INFO cluster ccm directory: /tmp/dtest-89rd87ne
> ---------------------------------------------------------------------------------------------------------------
> Captured stderr call
> ---------------------------------------------------------------------------------------------------------------
> File "/home/josephl/pg/cassandra_2/tools/bin/token-generator", line 160
> print "%sDC #%d:" % (indentstr, dcnum + 1)
> ^
> SyntaxError: invalid syntax
> -------------------------------------------------------------------------------------------------------------
> Captured stdout teardown
> -------------------------------------------------------------------------------------------------------------
> 10:03:31,708 ccm DEBUG Log-watching thread exiting.
> ...
> ...
> ...
> {noformat}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]