cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paulo Motta (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-11875) Create sstableconvert tool with support to ma format
Date Mon, 06 Jun 2016 15:26:21 GMT

    [ https://issues.apache.org/jira/browse/CASSANDRA-11875?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15316642#comment-15316642
] 

Paulo Motta commented on CASSANDRA-11875:
-----------------------------------------

Thanks for the update! See follow-up comments below:

bq. Changed isCompatibleForWriting(String version) -> isCompatibleForWriting() since we
are dealing directly with versions so it would be redundant to pass it.

Good idea, that's probably better.

bq. DatabaseDescriptor.getSSTableFormat().info.getVersion(options.version).isCompatibleForWriting(),
or maybe there's some way to obtain it?

Maybe you can add a {{BigVersion.supportsWritingversion(version)}} that could wrap that.

bq. I modified Options access level to protected and parseArgs now varies on boolean isLatestVersion,
so now StandaloneUpgrader only contains the execution code which is identical than StandaloneConverter,
do you think we should abstract it into a common method SSTableConverter.execute(Option options)?

The idea is to abstract only the identical part, leaving specific parsing to each class (so
you can probably extract the {{parseArgs}} code from inside {{Options}}). The main class of
StandaloneUpgrader would look more or less like:

{code:java}
public static void main(String args[])
{
    Options opts = parseArgs(args);
    StandaloneConverter converter = new StandaloneConverter(opts)
    converter.convert()
}
{code}

With this approach {{StandaloneUpgrader}} doesn't need to be a subclass of {{StandaloneConverter}}.

On tests, it seems you're using {{assertNotSame}} to check objects are not equals, but {{assertNotSame}}
only compare object equality ({{obj1 != obj2}}), not if objects are effectively not equal
({{!obj1.equals(obj2)}}). You should probably use {{assertFalse(object.equals(other))}} to
assert non-equality;

The {{testUnsupportedVersionShouldFail}} is failing, you should generally use this format
to assert that exceptions are thrown while making the test pass:

{code:java}
try {
    methodThatShouldThrow();
    fail( "My method didn't throw when I expected it to" );
} catch (MyException expectedException) {
}
{code}

> Create sstableconvert tool with support to ma format
> ----------------------------------------------------
>
>                 Key: CASSANDRA-11875
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-11875
>             Project: Cassandra
>          Issue Type: Sub-task
>          Components: Tools
>            Reporter: Paulo Motta
>            Assignee: Kaide Mu
>            Priority: Minor
>         Attachments: trunk-11875-WIP-V1.patch
>
>
> Currently {{Upgrader}} receives an sstable in any readable format, and writes into {{BigFormat.getLatestVersion()}}.
We should generalize it by making it receive a {{target}} version and probably also rename
it to {{SSTableConverter}}. 
> Based on this we can create an {{StandaloneDowngrader}} tool which will perform downgrade
of specified sstables to a target version. To start with, we should support only downgrading
to {{ma}} format (from current format {{mb}}), downgrade to any other version should be forbidden.
Since we already support serializing to "ma" we will not need to do any data conversion.
> We should also create a test suite that creates an sstable with data in the current format,
perform the downgrade, and verify data in the new format is correct. This will be the base
tests suite for more advanced conversions in the future.



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

Mime
View raw message