incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Cherkasov <michael.cherka...@gmail.com>
Subject how to cast traditional sql schema to nosql
Date Sun, 26 Feb 2012 22:32:56 GMT
Hi all,
I'm newbie in nosql and can't understand how to create nosql style schema.
First, I what describe my problem:
 I need to store results of tests. Each test consists of a list of
parameters(if tests have the same list of parameters that means, two tests
belong to the same testcase), tag or tags, and test result,
For exmaple:
Test1 :
 params:
   -user_role:admin
   -miss_captcha:true
   -test_name:login_test
   -locales:en,es,fr       -- as you can see, parameter can be the list.
testcase: testcase_1_id -- test case id formed as md5 of params.
tags:
   -aaa_site_test
   -smoke
 result:
   -passed
   -some_other_results_stuff( logs, errors' codes and so on )
 start_time: 1330287048  ( time stamp)
Test2 :
 params:
   -user_role:admin
   -miss_captcha:true
   -test_name:login_test
   -locales:en,es,fr       -- as you can see, parameter can be the list.
 testcase: testcase_1_id -- test case id formed as md5 of params.
 tags:
   -aaa_site_test
   -function_tests
 result:
   -failed
   -some_other_results_stuff( logs, errors' codes and so on )
 start_time: 1330290648
Test3 :
 params:
   -user_role:user
   -miss_captcha:true
   -test_name:change_password
   -locales:en
 testcase: testcase_2_id -- test case id formed as md5 of params.
 tags:
   -bbb_site_test
   -function_tests
 result:
   -failed
   -some_other_results_stuff( logs, errors' codes and so on )
 start_time: 1330290648

So, above you can see 3 tests, the first two belong to the same testcase,
but test 1 and test 2 are different test runs, also they have different
tags. Test 3 one more test case.
Usually I will need to execute the following queries:
1)Get latest result for specific tag/tags, for exmale:
Get latest result for aaa_site. Result should be:
Test2 result, because test 1 and test 2 is the same test case, but test 2
is newer.
2)Or get latest result for locale == es, result is test 2.
3)Get the latest results for each test case, result is: test 2, test 3.
4)Get get history for test case 1, result: test 1 and test 2.

I create the following schema:
TestRuns:
*test run id(key) | test case id  | start_time | result id*
test_1_id        | testcase_1_id | 1330287048 | result_1
test_2_id        | testcase_1_id | 1330290648 | result_2
test_3_id        | testcase_2_id | 1330290648  | result_3

Result:
*result id | result_value | other stuff...*
result_1  |  passed      | ...
result_2  |  failed      | ...
result_3  |  failed      | ...

ParamsAndTags:( for tags I put $tag for tagParamName, $ - for case if we
have parameter with name 'tag'  )
*key (not used, but required by cassandra)| test run id | tagParamName |
value*
some key                                 |test_1_id    | $tag         |
aaa_site_test
some key                                 |test_1_id    | $tag         |
smoke
some key                                 |test_1_id    | user_role    |
admin
some key                                 |test_1_id    | miss_captcha | true
some key                                 |test_1_id    | test_name        |
login_test
some key                                 |test_1_id    |  locales          |
en           --- list is splited
some key                                 |test_1_id    |  locales          |
es           --- list is splited
some key                                 |test_1_id    |  locales          |
fr           --- list is splited
and so on...


But it's look very heavy to perform queries.
To take latest result for tag aaa_site_test and with locale es I need
perform the following steps:
Fetch all rows from ParamsAndTags with tag aaa_site_test, then fetch all
rows for param locale == es.
Then find intersection of first and second result so I receive test runs
id, but this is not the end.
After that I should fetch test runs and in result find the latest results
only.
As you can see for that simple query I should perform 3 query to DB and a
lot of work inside my application to merge results and filter latests
results.
I'am afraid it will work too slowly.
Can someone advise more nosql solution for this task?

Mime
View raw message