TBH, the syntax looks unnecessarily complex and confusing to me.

For example, for this command:

   nodetool tablehistograns -ks ks1 -i -tbs ks1.tb1 ks2.tb2

Which one of the following should it do?

1. all tables in the keyspace ks1,  except the table tb1; or
2. all tables in all keyspaces, except any table in the keyspace ks1
   and the table tb2 in the keyspace ks2


I personally would prefer the simplicity of this approach:

   nodetool tablehistograms ks1 tb1 tb2 tb3

   nodetool tablehistograms ks1.tb1 ks1.tb2 ks2.tb3

   nodetool tablehistograms -i ks1 -i ks2

   nodetool tablehistograms -i ks1.tb1 -i ks2.tb2

They are self-explanatory. You don't need to read comments to understand what do they do, as long as you know that "-i" means "exclude".

A more complex and possibly confusing option could be:

   nodetool tablehistograms ks1 -i ks1.tb1 -i ks1.tb2  # all tables in
   the keyspace ks1, except the table tb1 and tb2

   nodetool tablehistograms -i ks1.tb1 -i ks1.tb2 ks1  # identical as
   above, as -i takes only one parameter

To avoid the above confusion, the command could enforce that the "-i" option may only be used after any positional options, thus makes the 2nd command a syntax error.

Beyond that, I don't see why the user can't make multiple invocations of the nodetool tablehistograms command if they have more complex or specific need.

For example, in this case:

   /> 6.nodetool tablehistograns -i -tbs ks.tb1 ks.tb2 -ks ks1 // print
   out list tables' histograms except for table in ks.tb1 ks.tb2 and
   all tables in ks1/

The same result can be achieved by concatenating the outputs of the following two commands:

   nodetool tablehistograms -i ks -i ks1

   nodetool tablehistograms ks -i ks.tb1 -i ks.tb2


On 22/03/2023 05:12, guo Maxwell wrote:
Thanks everyone , So It seems that it is better to add new parameter options to meet our needs, while keeping the original parameter functions unaffected to achieve backward compatibility.
So the new options are :
1. nodetool tablehistograms ks.tb1 or ks tb1  ... //this is *one of the old way *of using tablehistogram. will print out the histograms of tabke ks.tb1 , we keep the old format to print out the table histograms,besides if more than two arguments is provied, suchu as nodetool tablehistograms system.local system_schema.columns system_schema.tables then all tables's histograms will be printed out (I think this is a bug that not as excepted in the document's decription, we should remind the user that this is an incorrenct usage)

2. nodetool tablehistograms -tbs ks.tb1 ks.tb2 .... //print out list of tables' histograms with format keyspace.table 3.nodetool tablehistograms -ks ks1 ks2 ks3 ... //print out list of keyspaces histograms 4.nodetool tablehistograms -i -ks ks1 ks2 .... //print out list of table histograms except for the keyspaces list behind the option -i 5.nodetool tablehistograns -i -tbs ks.tb1 ks.tb2 // print out list tables' histograms except for table in ks.tb1 ks.tb2 6.nodetool tablehistograns -i -tbs ks.tb1 ks.tb2 -ks ks1 // print out list tables' histograms except for table in ks.tb1 ks.tb2 and all tables in ks1 6.none option specified ,then all tables histograms will be print out.// this is *another one of the old way* of using tablehistogram.

So we add some more options like "-i", "-ks", "-tbs" , we can combine these options  and we can also use any of them individually, besides, we can also use the tool through old way if a table with format ks.tb is provied.


Jeremiah D Jordan <jeremiah.jor...@gmail.com> 于2023年3月16日周四 23:14写道:

    -1 on any change which breaks the previously documented usage.
    +1 any additions to what the tool can do without breaking
    previously documented behavior.

    On Mar 16, 2023, at 7:42 AM, Josh McKenzie <jmcken...@apache.org>
    wrote:

    We could also consider augmenting the tool with new named
    arguments with the functionality you described and leave the
    positional usage intact.

    On Thu, Mar 16, 2023, at 6:43 AM, Bowen Song via dev wrote:

    The documented command options are:

        nodetool tablehistograms [<keyspace> <table> | <keyspace.table>]



    That means one parameter will be treated as dot separated
    keyspace and table. Alternatively, two parameters will be
    treated as the keyspace and table respectively.

    To remain compatible with the documented behaviour, my
    suggestion is to change the command options to:

        nodetool tablehistograms [<keyspace> <table> [<table2>
        [...]] | <keyspace.table> [<keyspace2.table2>[...]]]

    Feel free to add the "all except ..." feature to the above.

    This doesn't break backward compatibility in documented ways. It
    only changes the undocumented behaviour. If someone is using the
    undocumented behaviour, they must know things may break when the
    software is upgraded. We can just add a line to the NEWS.txt and
    let them update their scripts.


    On 16/03/2023 08:53, guo Maxwell wrote:
    Hello everyone :
    The nodetool tablehistograms have one argument which you can
    fill with only one table name with the format
    "keyspace_name.table_name /keyspace_name table_name", so that
    you can get the table histograms of the specied table.

    And if none arguments is set, all the tables' histograms will
    be print out.And if more than 2 arguments (nomatter the format
    is right or wrong) are set , all the tables' histograms will
    also be print out too(Which is a bug In my mind).

    So the usage of nodetool tablehistograms has some usage
    restrictions, That is either output one , or all informations.

    As CASSANDRA-18296
    <https://issues.apache.org/jira/browse/CASSANDRA-18296> described
    , I will change the usage of nodetool tablehistograms, which
    support the feature below:
    1. nodetool tablehistograms ks.tb1 ks.tb2 .... //print out list
    of tables' histograms with format keyspace.table
    2.nodetool tablehistograms ks1 ks2 ks3 ... //print out list of
    keyspaces histograms
    3.nodetool tablehistograms -i ks1 ks2 .... //print out list of
    table histograms except for the keyspaces list behind the option -i
    4.nodetool tablehistograns -i ks ks.tb // print out list
    tables' histograms except for table in keyspace ks and ks.tb table.
    5.none option specified ,then all tables histograms will be
    print out.

    The usage will breaks compatibility with how it was done
    previously, and as this is a user facing tool.

    So, What do you think?

    Thanks~~~



--
you are the apple of my eye !

Reply via email to