Compare commits
228 Commits
branch-1.1
...
branch-1.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5edfa98a6 | ||
|
|
972a6701b4 | ||
|
|
745ee206bf | ||
|
|
890988c7e5 | ||
|
|
906ddc16b2 | ||
|
|
be0b7336d5 | ||
|
|
58d92b304b | ||
|
|
cc8ab6de2e | ||
|
|
5dca11087e | ||
|
|
5971f7f4fa | ||
|
|
b6d2a73c56 | ||
|
|
2db8626dbf | ||
|
|
ba5d52c94e | ||
|
|
ffed8a5603 | ||
|
|
ec51c8e1b8 | ||
|
|
50056a6df6 | ||
|
|
184b62d790 | ||
|
|
f5a1f402f5 | ||
|
|
9f09812733 | ||
|
|
e9b7352adb | ||
|
|
2461a85c0f | ||
|
|
9503145e38 | ||
|
|
9d99dd46cb | ||
|
|
c9dfbf7913 | ||
|
|
4f02a5f4b3 | ||
|
|
7457ed982d | ||
|
|
16a5be622c | ||
|
|
caab57bb24 | ||
|
|
3efa1211ec | ||
|
|
3898216831 | ||
|
|
0af39f2d0c | ||
|
|
e296fef581 | ||
|
|
5ee6a00b0f | ||
|
|
64df5f3f38 | ||
|
|
259b2592d4 | ||
|
|
51eba96c14 | ||
|
|
66e8204c79 | ||
|
|
7f1c63afa3 | ||
|
|
8547f34d60 | ||
|
|
a3078c9b9d | ||
|
|
00692d891e | ||
|
|
94aa879d19 | ||
|
|
8361b01b9d | ||
|
|
67e80fd595 | ||
|
|
b3915e0363 | ||
|
|
985c4ffcc6 | ||
|
|
c56fc99b7f | ||
|
|
85d33e2ee4 | ||
|
|
ffeef2f072 | ||
|
|
d3ffa00eb2 | ||
|
|
ad50d83302 | ||
|
|
c6a9844dfe | ||
|
|
dececbc0b9 | ||
|
|
f2031bf3db | ||
|
|
da77b8885f | ||
|
|
86434378d1 | ||
|
|
e5d24d5940 | ||
|
|
0a2d4204bd | ||
|
|
74b8f63e8f | ||
|
|
9b764b726b | ||
|
|
07ba03ce7b | ||
|
|
de690a6997 | ||
|
|
7b53e969d2 | ||
|
|
c384b23112 | ||
|
|
3688542323 | ||
|
|
7916182cfa | ||
|
|
ec1fd3945f | ||
|
|
653e250d04 | ||
|
|
6255076c20 | ||
|
|
420ebe28fd | ||
|
|
a6179476c5 | ||
|
|
342726a23c | ||
|
|
e9946032f4 | ||
|
|
5e0b113732 | ||
|
|
c70faa4f23 | ||
|
|
15ad4c9033 | ||
|
|
d094329b6e | ||
|
|
dcab915f21 | ||
|
|
b3ed55be1d | ||
|
|
e515933c70 | ||
|
|
e8e00338d1 | ||
|
|
b50cb3eca8 | ||
|
|
e580ac5dae | ||
|
|
3f6ecb9f28 | ||
|
|
2efbccc901 | ||
|
|
d4123ba613 | ||
|
|
32c9a06faf | ||
|
|
0ebd8b18b7 | ||
|
|
30d54cef38 | ||
|
|
8e124b31aa | ||
|
|
f613dabf53 | ||
|
|
4684b8ecbb | ||
|
|
422f244172 | ||
|
|
fab4cc8d6d | ||
|
|
b3011c9039 | ||
|
|
8c0e2e05b7 | ||
|
|
b7e79b72d5 | ||
|
|
26c0d86401 | ||
|
|
136b8148d2 | ||
|
|
d7f36a093f | ||
|
|
f0c2b1d161 | ||
|
|
f1b3cb4a08 | ||
|
|
fed1e65e1e | ||
|
|
46f60f52d9 | ||
|
|
2d4d6c9c92 | ||
|
|
ceb29f9d32 | ||
|
|
7f6b12c97a | ||
|
|
d7d8c76fe5 | ||
|
|
53cebb4a5e | ||
|
|
12cf60c302 | ||
|
|
1e6f64f4ab | ||
|
|
5fef0717cc | ||
|
|
9637c2232c | ||
|
|
c2fa3b796d | ||
|
|
5d5d525a14 | ||
|
|
8a7197e390 | ||
|
|
2be4ec4e06 | ||
|
|
5e5317b228 | ||
|
|
5bb1255da1 | ||
|
|
e26002d581 | ||
|
|
e5f0314afd | ||
|
|
70b793e4d3 | ||
|
|
74c8a87777 | ||
|
|
94e7e61cd0 | ||
|
|
7a54b5ebbb | ||
|
|
03a762bb0b | ||
|
|
88fde0a91e | ||
|
|
898243929f | ||
|
|
f84b7b094f | ||
|
|
49cdd0b786 | ||
|
|
46fa80a5a6 | ||
|
|
4eff07d773 | ||
|
|
eb9ac9ab91 | ||
|
|
6ec0000df8 | ||
|
|
cbc2e96a58 | ||
|
|
ee0f66eef6 | ||
|
|
76e0eb426e | ||
|
|
4413176051 | ||
|
|
089734474b | ||
|
|
ee0585cee9 | ||
|
|
ad34f80e6f | ||
|
|
b33ed48527 | ||
|
|
20a48b0f20 | ||
|
|
750f30cf07 | ||
|
|
468bcfbf1f | ||
|
|
64e0c8cd1b | ||
|
|
f6a5a4e3da | ||
|
|
8ef25ceb05 | ||
|
|
17b9203719 | ||
|
|
2ff6d38d0c | ||
|
|
8fede5b98e | ||
|
|
4981362f57 | ||
|
|
4972a72380 | ||
|
|
9c450f673c | ||
|
|
217c1ffa95 | ||
|
|
a3b23d75b9 | ||
|
|
868ff5107c | ||
|
|
272e89846d | ||
|
|
dcba6f5c45 | ||
|
|
a68671e247 | ||
|
|
80037aa95b | ||
|
|
adfb4d7bbd | ||
|
|
8552f222f5 | ||
|
|
23c23abe53 | ||
|
|
484d2ecd0a | ||
|
|
8307681975 | ||
|
|
7e07d97e4b | ||
|
|
17765b6c06 | ||
|
|
de7952a8db | ||
|
|
1eabe9b840 | ||
|
|
7207cc8b1a | ||
|
|
b5d9aa866d | ||
|
|
7dbeef3c39 | ||
|
|
13d8cd0ae9 | ||
|
|
90c31701e3 | ||
|
|
443e5aef5a | ||
|
|
8703136a4f | ||
|
|
8503600e30 | ||
|
|
152bd82a05 | ||
|
|
5604fb8aa3 | ||
|
|
c38b5fbb3d | ||
|
|
53820393da | ||
|
|
d93d46e721 | ||
|
|
a73924b4e0 | ||
|
|
9ff2efb28b | ||
|
|
43cc77d1b8 | ||
|
|
147aa81177 | ||
|
|
5c36d2e09e | ||
|
|
240a185727 | ||
|
|
63b6c6bb5a | ||
|
|
8cdf4e37fb | ||
|
|
6ef7885ae3 | ||
|
|
d80d194873 | ||
|
|
28cc6f97af | ||
|
|
917bf850fa | ||
|
|
437ebe7128 | ||
|
|
58f7edb04f | ||
|
|
29e103a2ae | ||
|
|
1ca5ceadff | ||
|
|
dada385826 | ||
|
|
f7d41ba07a | ||
|
|
4b34152870 | ||
|
|
3ac22bc0d7 | ||
|
|
ee7225a9cb | ||
|
|
80302d98dd | ||
|
|
43221fc7e2 | ||
|
|
709dd82d59 | ||
|
|
bf18025937 | ||
|
|
d8ea85cd90 | ||
|
|
b8277979ef | ||
|
|
3aefa4f1d2 | ||
|
|
f1cd52ff3f | ||
|
|
b75475de80 | ||
|
|
2a00c06dd5 | ||
|
|
5aeeb0b3e8 | ||
|
|
6d2caedafd | ||
|
|
24f90b087f | ||
|
|
3039e4c7de | ||
|
|
db322d8f74 | ||
|
|
41c586313a | ||
|
|
c364ab9121 | ||
|
|
751ba2f0bf | ||
|
|
ae95ce1bd7 | ||
|
|
dc69999fd8 | ||
|
|
122330a5eb | ||
|
|
cc74b6ff5f | ||
|
|
434db0bc8b | ||
|
|
6723978891 |
2
.gitmodules
vendored
2
.gitmodules
vendored
@@ -1,6 +1,6 @@
|
||||
[submodule "seastar"]
|
||||
path = seastar
|
||||
url = ../seastar
|
||||
url = ../scylla-seastar
|
||||
ignore = dirty
|
||||
[submodule "swagger-ui"]
|
||||
path = swagger-ui
|
||||
|
||||
@@ -15,7 +15,7 @@ git submodule update --recursive
|
||||
* Installing required packages:
|
||||
|
||||
```
|
||||
sudo yum install yaml-cpp-devel lz4-devel zlib-devel snappy-devel jsoncpp-devel thrift-devel antlr3-tool antlr3-C++-devel libasan libubsan gcc-c++ gnutls-devel ninja-build ragel libaio-devel cryptopp-devel xfsprogs-devel numactl-devel hwloc-devel libpciaccess-devel libxml2-devel python3-pyparsing
|
||||
sudo yum install yaml-cpp-devel lz4-devel zlib-devel snappy-devel jsoncpp-devel thrift-devel antlr3-tool antlr3-C++-devel libasan libubsan gcc-c++ gnutls-devel ninja-build ragel libaio-devel cryptopp-devel xfsprogs-devel numactl-devel hwloc-devel libpciaccess-devel libxml2-devel python3-pyparsing lksctp-tools-devel
|
||||
```
|
||||
|
||||
* Build Scylla
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
VERSION=666.development
|
||||
VERSION=1.2.6
|
||||
|
||||
if test -f version
|
||||
then
|
||||
|
||||
@@ -487,6 +487,36 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/cache_service/metrics/row/hits_moving_avrage",
|
||||
"operations": [
|
||||
{
|
||||
"method": "GET",
|
||||
"summary": "Get row hits moving avrage",
|
||||
"type": "#/utils/rate_moving_average",
|
||||
"nickname": "get_row_hits_moving_avrage",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"parameters": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/cache_service/metrics/row/requests_moving_avrage",
|
||||
"operations": [
|
||||
{
|
||||
"method": "GET",
|
||||
"summary": "Get row requests moving avrage",
|
||||
"type": "#/utils/rate_moving_average",
|
||||
"nickname": "get_row_requests_moving_avrage",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"parameters": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/cache_service/metrics/row/size",
|
||||
"operations": [
|
||||
|
||||
@@ -1094,7 +1094,7 @@
|
||||
"method":"GET",
|
||||
"summary":"Get read latency histogram",
|
||||
"$ref": "#/utils/histogram",
|
||||
"nickname":"get_read_latency_histogram",
|
||||
"nickname":"get_read_latency_histogram_depricated",
|
||||
"produces":[
|
||||
"application/json"
|
||||
],
|
||||
@@ -1121,6 +1121,49 @@
|
||||
"items":{
|
||||
"$ref": "#/utils/histogram"
|
||||
},
|
||||
"nickname":"get_all_read_latency_histogram_depricated",
|
||||
"produces":[
|
||||
"application/json"
|
||||
],
|
||||
"parameters":[
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path":"/column_family/metrics/read_latency/moving_average_histogram/{name}",
|
||||
"operations":[
|
||||
{
|
||||
"method":"GET",
|
||||
"summary":"Get read latency moving avrage histogram",
|
||||
"$ref": "#/utils/rate_moving_average_and_histogram",
|
||||
"nickname":"get_read_latency_histogram",
|
||||
"produces":[
|
||||
"application/json"
|
||||
],
|
||||
"parameters":[
|
||||
{
|
||||
"name":"name",
|
||||
"description":"The column family name in keysspace:name format",
|
||||
"required":true,
|
||||
"allowMultiple":false,
|
||||
"type":"string",
|
||||
"paramType":"path"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path":"/column_family/metrics/read_latency/moving_average_histogram/",
|
||||
"operations":[
|
||||
{
|
||||
"method":"GET",
|
||||
"summary":"Get read latency moving avrage histogram from all column family",
|
||||
"type":"array",
|
||||
"items":{
|
||||
"$ref": "#/utils/rate_moving_average_and_histogram"
|
||||
},
|
||||
"nickname":"get_all_read_latency_histogram",
|
||||
"produces":[
|
||||
"application/json"
|
||||
@@ -1260,7 +1303,7 @@
|
||||
"method":"GET",
|
||||
"summary":"Get write latency histogram",
|
||||
"$ref": "#/utils/histogram",
|
||||
"nickname":"get_write_latency_histogram",
|
||||
"nickname":"get_write_latency_histogram_depricated",
|
||||
"produces":[
|
||||
"application/json"
|
||||
],
|
||||
@@ -1287,6 +1330,49 @@
|
||||
"items":{
|
||||
"$ref": "#/utils/histogram"
|
||||
},
|
||||
"nickname":"get_all_write_latency_histogram_depricated",
|
||||
"produces":[
|
||||
"application/json"
|
||||
],
|
||||
"parameters":[
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path":"/column_family/metrics/write_latency/moving_average_histogram/{name}",
|
||||
"operations":[
|
||||
{
|
||||
"method":"GET",
|
||||
"summary":"Get write latency moving average histogram",
|
||||
"$ref": "#/utils/rate_moving_average_and_histogram",
|
||||
"nickname":"get_write_latency_histogram",
|
||||
"produces":[
|
||||
"application/json"
|
||||
],
|
||||
"parameters":[
|
||||
{
|
||||
"name":"name",
|
||||
"description":"The column family name in keysspace:name format",
|
||||
"required":true,
|
||||
"allowMultiple":false,
|
||||
"type":"string",
|
||||
"paramType":"path"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path":"/column_family/metrics/write_latency/moving_average_histogram/",
|
||||
"operations":[
|
||||
{
|
||||
"method":"GET",
|
||||
"summary":"Get write latency moving average histogram of all column family",
|
||||
"type":"array",
|
||||
"items":{
|
||||
"$ref": "#/utils/rate_moving_average_and_histogram"
|
||||
},
|
||||
"nickname":"get_all_write_latency_histogram",
|
||||
"produces":[
|
||||
"application/json"
|
||||
|
||||
@@ -716,6 +716,36 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/storage_proxy/metrics/read/timeouts_rates",
|
||||
"operations": [
|
||||
{
|
||||
"method": "GET",
|
||||
"summary": "Get read metrics rates",
|
||||
"type": "#/utils/rate_moving_average",
|
||||
"nickname": "get_read_metrics_timeouts_rates",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"parameters": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/storage_proxy/metrics/read/unavailables_rates",
|
||||
"operations": [
|
||||
{
|
||||
"method": "GET",
|
||||
"summary": "Get read metrics rates",
|
||||
"type": "#/utils/rate_moving_average",
|
||||
"nickname": "get_read_metrics_unavailables_rates",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"parameters": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/storage_proxy/metrics/read/histogram",
|
||||
"operations": [
|
||||
@@ -723,7 +753,7 @@
|
||||
"method": "GET",
|
||||
"summary": "Get read metrics",
|
||||
"$ref": "#/utils/histogram",
|
||||
"nickname": "get_read_metrics_latency_histogram",
|
||||
"nickname": "get_read_metrics_latency_histogram_depricated",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -738,6 +768,36 @@
|
||||
"method": "GET",
|
||||
"summary": "Get range metrics",
|
||||
"$ref": "#/utils/histogram",
|
||||
"nickname": "get_range_metrics_latency_histogram_depricated",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"parameters": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/storage_proxy/metrics/read/moving_avrage_histogram",
|
||||
"operations": [
|
||||
{
|
||||
"method": "GET",
|
||||
"summary": "Get read metrics",
|
||||
"$ref": "#/utils/rate_moving_average_and_histogram",
|
||||
"nickname": "get_read_metrics_latency_histogram",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"parameters": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/storage_proxy/metrics/range/moving_avrage_histogram",
|
||||
"operations": [
|
||||
{
|
||||
"method": "GET",
|
||||
"summary": "Get range metrics rate and histogram",
|
||||
"$ref": "#/utils/rate_moving_average_and_histogram",
|
||||
"nickname": "get_range_metrics_latency_histogram",
|
||||
"produces": [
|
||||
"application/json"
|
||||
@@ -776,6 +836,36 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/storage_proxy/metrics/range/timeouts_rates",
|
||||
"operations": [
|
||||
{
|
||||
"method": "GET",
|
||||
"summary": "Get range metrics rates",
|
||||
"type": "#/utils/rate_moving_average",
|
||||
"nickname": "get_range_metrics_timeouts_rates",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"parameters": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/storage_proxy/metrics/range/unavailables_rates",
|
||||
"operations": [
|
||||
{
|
||||
"method": "GET",
|
||||
"summary": "Get range metrics rates",
|
||||
"type": "#/utils/rate_moving_average",
|
||||
"nickname": "get_range_metrics_unavailables_rates",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"parameters": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/storage_proxy/metrics/write/timeouts",
|
||||
"operations": [
|
||||
@@ -806,6 +896,36 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/storage_proxy/metrics/write/timeouts_rates",
|
||||
"operations": [
|
||||
{
|
||||
"method": "GET",
|
||||
"summary": "Get write metrics rates",
|
||||
"type": "#/utils/rate_moving_average",
|
||||
"nickname": "get_write_metrics_timeouts_rates",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"parameters": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/storage_proxy/metrics/write/unavailables_rates",
|
||||
"operations": [
|
||||
{
|
||||
"method": "GET",
|
||||
"summary": "Get write metrics rates",
|
||||
"type": "#/utils/rate_moving_average",
|
||||
"nickname": "get_write_metrics_unavailables_rates",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"parameters": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/storage_proxy/metrics/write/histogram",
|
||||
"operations": [
|
||||
@@ -813,6 +933,21 @@
|
||||
"method": "GET",
|
||||
"summary": "Get write metrics",
|
||||
"$ref": "#/utils/histogram",
|
||||
"nickname": "get_write_metrics_latency_histogram_depricated",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"parameters": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/storage_proxy/metrics/write/moving_avrage_histogram",
|
||||
"operations": [
|
||||
{
|
||||
"method": "GET",
|
||||
"summary": "Get write metrics",
|
||||
"$ref": "#/utils/rate_moving_average_and_histogram",
|
||||
"nickname": "get_write_metrics_latency_histogram",
|
||||
"produces": [
|
||||
"application/json"
|
||||
|
||||
@@ -65,6 +65,41 @@
|
||||
"description":"The series of values to which the counts in `buckets` correspond"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"rate_moving_average": {
|
||||
"id":"rate_moving_average",
|
||||
"description":"A meter metric which measures mean throughput and one, five, and fifteen-minute exponentially-weighted moving average throughputs",
|
||||
"properties":{
|
||||
"rates": {
|
||||
"type":"array",
|
||||
"items":{
|
||||
"type":"double"
|
||||
},
|
||||
"description":"One, five and fifteen mintues rates"
|
||||
},
|
||||
"mean_rate": {
|
||||
"type":"double",
|
||||
"description":"The mean rate from startup"
|
||||
},
|
||||
"count": {
|
||||
"type":"long",
|
||||
"description":"Total number of events from startup"
|
||||
}
|
||||
}
|
||||
},
|
||||
"rate_moving_average_and_histogram": {
|
||||
"id":"rate_moving_average_and_histogram",
|
||||
"description":"A timer metric which aggregates timing durations and provides duration statistics, plus throughput statistics",
|
||||
"properties":{
|
||||
"meter": {
|
||||
"type":"rate_moving_average",
|
||||
"description":"The metric rate moving average"
|
||||
},
|
||||
"hist": {
|
||||
"type":"histogram",
|
||||
"description":"The metric histogram"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +83,10 @@ future<> set_server_storage_service(http_context& ctx) {
|
||||
return register_api(ctx, "storage_service", "The storage service API", set_storage_service);
|
||||
}
|
||||
|
||||
future<> set_server_snitch(http_context& ctx) {
|
||||
return register_api(ctx, "endpoint_snitch_info", "The endpoint snitch info API", set_endpoint_snitch);
|
||||
}
|
||||
|
||||
future<> set_server_gossip(http_context& ctx) {
|
||||
return register_api(ctx, "gossiper",
|
||||
"The gossiper API", set_gossiper);
|
||||
@@ -118,10 +122,6 @@ future<> set_server_gossip_settle(http_context& ctx) {
|
||||
rb->register_function(r, "cache_service",
|
||||
"The cache service API");
|
||||
set_cache_service(ctx,r);
|
||||
|
||||
rb->register_function(r, "endpoint_snitch_info",
|
||||
"The endpoint snitch info API");
|
||||
set_endpoint_snitch(ctx, r);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
69
api/api.hh
69
api/api.hh
@@ -110,44 +110,7 @@ future<json::json_return_type> sum_stats(distributed<T>& d, V F::*f) {
|
||||
});
|
||||
}
|
||||
|
||||
inline double pow2(double a) {
|
||||
return a * a;
|
||||
}
|
||||
|
||||
// FIXME: Move to utils::ihistogram::operator+=()
|
||||
inline utils::ihistogram add_histogram(utils::ihistogram res,
|
||||
const utils::ihistogram& val) {
|
||||
if (res.count == 0) {
|
||||
return val;
|
||||
}
|
||||
if (val.count == 0) {
|
||||
return std::move(res);
|
||||
}
|
||||
if (res.min > val.min) {
|
||||
res.min = val.min;
|
||||
}
|
||||
if (res.max < val.max) {
|
||||
res.max = val.max;
|
||||
}
|
||||
double ncount = res.count + val.count;
|
||||
// To get an estimated sum we take the estimated mean
|
||||
// and multiply it by the true count
|
||||
res.sum = res.sum + val.mean * val.count;
|
||||
double a = res.count/ncount;
|
||||
double b = val.count/ncount;
|
||||
|
||||
double mean = a * res.mean + b * val.mean;
|
||||
|
||||
res.variance = (res.variance + pow2(res.mean - mean) )* a +
|
||||
(val.variance + pow2(val.mean -mean))* b;
|
||||
|
||||
res.mean = mean;
|
||||
res.count = res.count + val.count;
|
||||
for (auto i : val.sample) {
|
||||
res.sample.push_back(i);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
inline
|
||||
httpd::utils_json::histogram to_json(const utils::ihistogram& val) {
|
||||
@@ -156,15 +119,39 @@ httpd::utils_json::histogram to_json(const utils::ihistogram& val) {
|
||||
return h;
|
||||
}
|
||||
|
||||
template<class T, class F>
|
||||
future<json::json_return_type> sum_histogram_stats(distributed<T>& d, utils::ihistogram F::*f) {
|
||||
inline
|
||||
httpd::utils_json::rate_moving_average meter_to_json(const utils::rate_moving_average& val) {
|
||||
httpd::utils_json::rate_moving_average m;
|
||||
m = val;
|
||||
return m;
|
||||
}
|
||||
|
||||
return d.map_reduce0([f](const T& p) {return p.get_stats().*f;}, utils::ihistogram(),
|
||||
add_histogram).then([](const utils::ihistogram& val) {
|
||||
inline
|
||||
httpd::utils_json::rate_moving_average_and_histogram timer_to_json(const utils::rate_moving_average_and_histogram& val) {
|
||||
httpd::utils_json::rate_moving_average_and_histogram h;
|
||||
h.hist = val.hist;
|
||||
h.meter = meter_to_json(val.rate);
|
||||
return h;
|
||||
}
|
||||
|
||||
template<class T, class F>
|
||||
future<json::json_return_type> sum_histogram_stats(distributed<T>& d, utils::timed_rate_moving_average_and_histogram F::*f) {
|
||||
|
||||
return d.map_reduce0([f](const T& p) {return (p.get_stats().*f).hist;}, utils::ihistogram(),
|
||||
std::plus<utils::ihistogram>()).then([](const utils::ihistogram& val) {
|
||||
return make_ready_future<json::json_return_type>(to_json(val));
|
||||
});
|
||||
}
|
||||
|
||||
template<class T, class F>
|
||||
future<json::json_return_type> sum_timer_stats(distributed<T>& d, utils::timed_rate_moving_average_and_histogram F::*f) {
|
||||
|
||||
return d.map_reduce0([f](const T& p) {return (p.get_stats().*f).rate();}, utils::rate_moving_average_and_histogram(),
|
||||
std::plus<utils::rate_moving_average_and_histogram>()).then([](const utils::rate_moving_average_and_histogram& val) {
|
||||
return make_ready_future<json::json_return_type>(timer_to_json(val));
|
||||
});
|
||||
}
|
||||
|
||||
inline int64_t min_int64(int64_t a, int64_t b) {
|
||||
return std::min(a,b);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ struct http_context {
|
||||
};
|
||||
|
||||
future<> set_server_init(http_context& ctx);
|
||||
future<> set_server_snitch(http_context& ctx);
|
||||
future<> set_server_storage_service(http_context& ctx);
|
||||
future<> set_server_gossip(http_context& ctx);
|
||||
future<> set_server_load_sstable(http_context& ctx);
|
||||
|
||||
@@ -200,24 +200,40 @@ void set_cache_service(http_context& ctx, routes& r) {
|
||||
});
|
||||
|
||||
cs::get_row_hits.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
return map_reduce_cf(ctx, 0, [](const column_family& cf) {
|
||||
return cf.get_row_cache().stats().hits;
|
||||
}, std::plus<int64_t>());
|
||||
return map_reduce_cf(ctx, uint64_t(0), [](const column_family& cf) {
|
||||
return cf.get_row_cache().stats().hits.count();
|
||||
}, std::plus<uint64_t>());
|
||||
});
|
||||
|
||||
cs::get_row_requests.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
return map_reduce_cf(ctx, 0, [](const column_family& cf) {
|
||||
return cf.get_row_cache().stats().hits + cf.get_row_cache().stats().misses;
|
||||
}, std::plus<int64_t>());
|
||||
return map_reduce_cf(ctx, uint64_t(0), [](const column_family& cf) {
|
||||
return cf.get_row_cache().stats().hits.count() + cf.get_row_cache().stats().misses.count();
|
||||
}, std::plus<uint64_t>());
|
||||
});
|
||||
|
||||
cs::get_row_hit_rate.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
return map_reduce_cf(ctx, ratio_holder(), [](const column_family& cf) {
|
||||
return ratio_holder(cf.get_row_cache().stats().hits + cf.get_row_cache().stats().misses,
|
||||
cf.get_row_cache().stats().hits);
|
||||
return ratio_holder(cf.get_row_cache().stats().hits.count() + cf.get_row_cache().stats().misses.count(),
|
||||
cf.get_row_cache().stats().hits.count());
|
||||
}, std::plus<ratio_holder>());
|
||||
});
|
||||
|
||||
cs::get_row_hits_moving_avrage.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
return map_reduce_cf_raw(ctx, utils::rate_moving_average(), [](const column_family& cf) {
|
||||
return cf.get_row_cache().stats().hits.rate();
|
||||
}, std::plus<utils::rate_moving_average>()).then([](const utils::rate_moving_average& m) {
|
||||
return make_ready_future<json::json_return_type>(meter_to_json(m));
|
||||
});
|
||||
});
|
||||
|
||||
cs::get_row_requests_moving_avrage.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
return map_reduce_cf_raw(ctx, utils::rate_moving_average(), [](const column_family& cf) {
|
||||
return cf.get_row_cache().stats().hits.rate() + cf.get_row_cache().stats().misses.rate();
|
||||
}, std::plus<utils::rate_moving_average>()).then([](const utils::rate_moving_average& m) {
|
||||
return make_ready_future<json::json_return_type>(meter_to_json(m));
|
||||
});
|
||||
});
|
||||
|
||||
cs::get_row_size.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
// In origin row size is the weighted size.
|
||||
// We currently do not support weights, so we use num entries instead
|
||||
|
||||
@@ -77,14 +77,14 @@ future<json::json_return_type> get_cf_stats(http_context& ctx,
|
||||
}
|
||||
|
||||
static future<json::json_return_type> get_cf_stats_count(http_context& ctx, const sstring& name,
|
||||
utils::ihistogram column_family::stats::*f) {
|
||||
utils::timed_rate_moving_average_and_histogram column_family::stats::*f) {
|
||||
return map_reduce_cf(ctx, name, int64_t(0), [f](const column_family& cf) {
|
||||
return (cf.get_stats().*f).count;
|
||||
return (cf.get_stats().*f).hist.count;
|
||||
}, std::plus<int64_t>());
|
||||
}
|
||||
|
||||
static future<json::json_return_type> get_cf_stats_sum(http_context& ctx, const sstring& name,
|
||||
utils::ihistogram column_family::stats::*f) {
|
||||
utils::timed_rate_moving_average_and_histogram column_family::stats::*f) {
|
||||
auto uuid = get_uuid(name, ctx.db.local());
|
||||
return ctx.db.map_reduce0([uuid, f](database& db) {
|
||||
// Histograms information is sample of the actual load
|
||||
@@ -92,7 +92,7 @@ static future<json::json_return_type> get_cf_stats_sum(http_context& ctx, const
|
||||
// with count. The information is gather in nano second,
|
||||
// but reported in micro
|
||||
column_family& cf = db.find_column_family(uuid);
|
||||
return ((cf.get_stats().*f).count/1000.0) * (cf.get_stats().*f).mean;
|
||||
return ((cf.get_stats().*f).hist.count/1000.0) * (cf.get_stats().*f).hist.mean;
|
||||
}, 0.0, std::plus<double>()).then([](double res) {
|
||||
return make_ready_future<json::json_return_type>((int64_t)res);
|
||||
});
|
||||
@@ -100,28 +100,29 @@ static future<json::json_return_type> get_cf_stats_sum(http_context& ctx, const
|
||||
|
||||
|
||||
static future<json::json_return_type> get_cf_stats_count(http_context& ctx,
|
||||
utils::ihistogram column_family::stats::*f) {
|
||||
utils::timed_rate_moving_average_and_histogram column_family::stats::*f) {
|
||||
return map_reduce_cf(ctx, int64_t(0), [f](const column_family& cf) {
|
||||
return (cf.get_stats().*f).count;
|
||||
return (cf.get_stats().*f).hist.count;
|
||||
}, std::plus<int64_t>());
|
||||
}
|
||||
|
||||
static future<json::json_return_type> get_cf_histogram(http_context& ctx, const sstring& name,
|
||||
utils::ihistogram column_family::stats::*f) {
|
||||
utils::timed_rate_moving_average_and_histogram column_family::stats::*f) {
|
||||
utils::UUID uuid = get_uuid(name, ctx.db.local());
|
||||
return ctx.db.map_reduce0([f, uuid](const database& p) {return p.find_column_family(uuid).get_stats().*f;},
|
||||
return ctx.db.map_reduce0([f, uuid](const database& p) {
|
||||
return (p.find_column_family(uuid).get_stats().*f).hist;},
|
||||
utils::ihistogram(),
|
||||
add_histogram)
|
||||
std::plus<utils::ihistogram>())
|
||||
.then([](const utils::ihistogram& val) {
|
||||
return make_ready_future<json::json_return_type>(to_json(val));
|
||||
});
|
||||
}
|
||||
|
||||
static future<json::json_return_type> get_cf_histogram(http_context& ctx, utils::ihistogram column_family::stats::*f) {
|
||||
static future<json::json_return_type> get_cf_histogram(http_context& ctx, utils::timed_rate_moving_average_and_histogram column_family::stats::*f) {
|
||||
std::function<utils::ihistogram(const database&)> fun = [f] (const database& db) {
|
||||
utils::ihistogram res;
|
||||
for (auto i : db.get_column_families()) {
|
||||
res = add_histogram(res, i.second->get_stats().*f);
|
||||
res += (i.second->get_stats().*f).hist;
|
||||
}
|
||||
return res;
|
||||
};
|
||||
@@ -132,6 +133,33 @@ static future<json::json_return_type> get_cf_histogram(http_context& ctx, utils:
|
||||
});
|
||||
}
|
||||
|
||||
static future<json::json_return_type> get_cf_rate_and_histogram(http_context& ctx, const sstring& name,
|
||||
utils::timed_rate_moving_average_and_histogram column_family::stats::*f) {
|
||||
utils::UUID uuid = get_uuid(name, ctx.db.local());
|
||||
return ctx.db.map_reduce0([f, uuid](const database& p) {
|
||||
return (p.find_column_family(uuid).get_stats().*f).rate();},
|
||||
utils::rate_moving_average_and_histogram(),
|
||||
std::plus<utils::rate_moving_average_and_histogram>())
|
||||
.then([](const utils::rate_moving_average_and_histogram& val) {
|
||||
return make_ready_future<json::json_return_type>(timer_to_json(val));
|
||||
});
|
||||
}
|
||||
|
||||
static future<json::json_return_type> get_cf_rate_and_histogram(http_context& ctx, utils::timed_rate_moving_average_and_histogram column_family::stats::*f) {
|
||||
std::function<utils::rate_moving_average_and_histogram(const database&)> fun = [f] (const database& db) {
|
||||
utils::rate_moving_average_and_histogram res;
|
||||
for (auto i : db.get_column_families()) {
|
||||
res += (i.second->get_stats().*f).rate();
|
||||
}
|
||||
return res;
|
||||
};
|
||||
return ctx.db.map(fun).then([](const std::vector<utils::rate_moving_average_and_histogram> &res) {
|
||||
std::vector<httpd::utils_json::rate_moving_average_and_histogram> r;
|
||||
boost::copy(res | boost::adaptors::transformed(timer_to_json), std::back_inserter(r));
|
||||
return make_ready_future<json::json_return_type>(r);
|
||||
});
|
||||
}
|
||||
|
||||
static future<json::json_return_type> get_cf_unleveled_sstables(http_context& ctx, const sstring& name) {
|
||||
return map_reduce_cf(ctx, name, int64_t(0), [](const column_family& cf) {
|
||||
return cf.get_unleveled_sstables();
|
||||
@@ -173,6 +201,51 @@ static ratio_holder mean_row_size(column_family& cf) {
|
||||
return res;
|
||||
}
|
||||
|
||||
static std::unordered_map<sstring, uint64_t> merge_maps(std::unordered_map<sstring, uint64_t> a,
|
||||
const std::unordered_map<sstring, uint64_t>& b) {
|
||||
a.insert(b.begin(), b.end());
|
||||
return a;
|
||||
}
|
||||
|
||||
static json::json_return_type sum_map(const std::unordered_map<sstring, uint64_t>& val) {
|
||||
uint64_t res = 0;
|
||||
for (auto i : val) {
|
||||
res += i.second;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static future<json::json_return_type> sum_sstable(http_context& ctx, const sstring name, bool total) {
|
||||
auto uuid = get_uuid(name, ctx.db.local());
|
||||
return ctx.db.map_reduce0([uuid, total](database& db) {
|
||||
std::unordered_map<sstring, uint64_t> m;
|
||||
auto sstables = (total) ? db.find_column_family(uuid).get_sstables_including_compacted_undeleted() :
|
||||
db.find_column_family(uuid).get_sstables();
|
||||
for (auto t : *sstables) {
|
||||
m[t.second->get_filename()] = t.second->bytes_on_disk();
|
||||
}
|
||||
return m;
|
||||
}, std::unordered_map<sstring, uint64_t>(), merge_maps).
|
||||
then([](const std::unordered_map<sstring, uint64_t>& val) {
|
||||
return sum_map(val);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
static future<json::json_return_type> sum_sstable(http_context& ctx, bool total) {
|
||||
return map_reduce_cf_raw(ctx, std::unordered_map<sstring, uint64_t>(), [total](column_family& cf) {
|
||||
std::unordered_map<sstring, uint64_t> m;
|
||||
auto sstables = (total) ? cf.get_sstables_including_compacted_undeleted() :
|
||||
cf.get_sstables();
|
||||
for (auto t : *sstables) {
|
||||
m[t.second->get_filename()] = t.second->bytes_on_disk();
|
||||
}
|
||||
return m;
|
||||
},merge_maps).then([](const std::unordered_map<sstring, uint64_t>& val) {
|
||||
return sum_map(val);
|
||||
});
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
class sum_ratio {
|
||||
uint64_t _n = 0;
|
||||
@@ -384,10 +457,14 @@ void set_column_family(http_context& ctx, routes& r) {
|
||||
return get_cf_stats_count(ctx, &column_family::stats::writes);
|
||||
});
|
||||
|
||||
cf::get_read_latency_histogram.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
cf::get_read_latency_histogram_depricated.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
return get_cf_histogram(ctx, req->param["name"], &column_family::stats::reads);
|
||||
});
|
||||
|
||||
cf::get_read_latency_histogram.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
return get_cf_rate_and_histogram(ctx, req->param["name"], &column_family::stats::reads);
|
||||
});
|
||||
|
||||
cf::get_read_latency.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
return get_cf_stats_sum(ctx,req->param["name"] ,&column_family::stats::reads);
|
||||
});
|
||||
@@ -396,18 +473,30 @@ void set_column_family(http_context& ctx, routes& r) {
|
||||
return get_cf_stats_sum(ctx, req->param["name"] ,&column_family::stats::writes);
|
||||
});
|
||||
|
||||
cf::get_all_read_latency_histogram.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
cf::get_all_read_latency_histogram_depricated.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
return get_cf_histogram(ctx, &column_family::stats::writes);
|
||||
});
|
||||
|
||||
cf::get_write_latency_histogram.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
cf::get_all_read_latency_histogram.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
return get_cf_rate_and_histogram(ctx, &column_family::stats::writes);
|
||||
});
|
||||
|
||||
cf::get_write_latency_histogram_depricated.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
return get_cf_histogram(ctx, req->param["name"], &column_family::stats::writes);
|
||||
});
|
||||
|
||||
cf::get_all_write_latency_histogram.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
cf::get_write_latency_histogram.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
return get_cf_rate_and_histogram(ctx, req->param["name"], &column_family::stats::writes);
|
||||
});
|
||||
|
||||
cf::get_all_write_latency_histogram_depricated.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
return get_cf_histogram(ctx, &column_family::stats::writes);
|
||||
});
|
||||
|
||||
cf::get_all_write_latency_histogram.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
return get_cf_rate_and_histogram(ctx, &column_family::stats::writes);
|
||||
});
|
||||
|
||||
cf::get_pending_compactions.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
return get_cf_stats(ctx, req->param["name"], &column_family::stats::pending_compactions);
|
||||
});
|
||||
@@ -429,19 +518,19 @@ void set_column_family(http_context& ctx, routes& r) {
|
||||
});
|
||||
|
||||
cf::get_live_disk_space_used.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
return get_cf_stats(ctx, req->param["name"], &column_family::stats::live_disk_space_used);
|
||||
return sum_sstable(ctx, req->param["name"], false);
|
||||
});
|
||||
|
||||
cf::get_all_live_disk_space_used.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
return get_cf_stats(ctx, &column_family::stats::live_disk_space_used);
|
||||
return sum_sstable(ctx, false);
|
||||
});
|
||||
|
||||
cf::get_total_disk_space_used.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
return get_cf_stats(ctx, req->param["name"], &column_family::stats::total_disk_space_used);
|
||||
return sum_sstable(ctx, req->param["name"], true);
|
||||
});
|
||||
|
||||
cf::get_all_total_disk_space_used.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
return get_cf_stats(ctx, &column_family::stats::total_disk_space_used);
|
||||
return sum_sstable(ctx, true);
|
||||
});
|
||||
|
||||
cf::get_min_row_size.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
@@ -652,27 +741,35 @@ void set_column_family(http_context& ctx, routes& r) {
|
||||
});
|
||||
|
||||
cf::get_row_cache_hit.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
return map_reduce_cf(ctx, req->param["name"], int64_t(0), [](const column_family& cf) {
|
||||
return cf.get_row_cache().stats().hits;
|
||||
}, std::plus<int64_t>());
|
||||
return map_reduce_cf_raw(ctx, req->param["name"], utils::rate_moving_average(), [](const column_family& cf) {
|
||||
return cf.get_row_cache().stats().hits.rate();
|
||||
}, std::plus<utils::rate_moving_average>()).then([](const utils::rate_moving_average& m) {
|
||||
return make_ready_future<json::json_return_type>(meter_to_json(m));
|
||||
});
|
||||
});
|
||||
|
||||
cf::get_all_row_cache_hit.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
return map_reduce_cf(ctx, int64_t(0), [](const column_family& cf) {
|
||||
return cf.get_row_cache().stats().hits;
|
||||
}, std::plus<int64_t>());
|
||||
return map_reduce_cf_raw(ctx, utils::rate_moving_average(), [](const column_family& cf) {
|
||||
return cf.get_row_cache().stats().hits.rate();
|
||||
}, std::plus<utils::rate_moving_average>()).then([](const utils::rate_moving_average& m) {
|
||||
return make_ready_future<json::json_return_type>(meter_to_json(m));
|
||||
});
|
||||
});
|
||||
|
||||
cf::get_row_cache_miss.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
return map_reduce_cf(ctx, req->param["name"], int64_t(0), [](const column_family& cf) {
|
||||
return cf.get_row_cache().stats().misses;
|
||||
}, std::plus<int64_t>());
|
||||
return map_reduce_cf_raw(ctx, req->param["name"], utils::rate_moving_average(), [](const column_family& cf) {
|
||||
return cf.get_row_cache().stats().misses.rate();
|
||||
}, std::plus<utils::rate_moving_average>()).then([](const utils::rate_moving_average& m) {
|
||||
return make_ready_future<json::json_return_type>(meter_to_json(m));
|
||||
});
|
||||
});
|
||||
|
||||
cf::get_all_row_cache_miss.set(r, [&ctx] (std::unique_ptr<request> req) {
|
||||
return map_reduce_cf(ctx, int64_t(0), [](const column_family& cf) {
|
||||
return cf.get_row_cache().stats().misses;
|
||||
}, std::plus<int64_t>());
|
||||
return map_reduce_cf_raw(ctx, utils::rate_moving_average(), [](const column_family& cf) {
|
||||
return cf.get_row_cache().stats().misses.rate();
|
||||
}, std::plus<utils::rate_moving_average>()).then([](const utils::rate_moving_average& m) {
|
||||
return make_ready_future<json::json_return_type>(meter_to_json(m));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -34,31 +34,44 @@ future<> foreach_column_family(http_context& ctx, const sstring& name, std::func
|
||||
|
||||
|
||||
template<class Mapper, class I, class Reducer>
|
||||
future<json::json_return_type> map_reduce_cf(http_context& ctx, const sstring& name, I init,
|
||||
future<I> map_reduce_cf_raw(http_context& ctx, const sstring& name, I init,
|
||||
Mapper mapper, Reducer reducer) {
|
||||
auto uuid = get_uuid(name, ctx.db.local());
|
||||
return ctx.db.map_reduce0([mapper, uuid](database& db) {
|
||||
return mapper(db.find_column_family(uuid));
|
||||
}, init, reducer).then([](const I& res) {
|
||||
}, init, reducer);
|
||||
}
|
||||
|
||||
|
||||
template<class Mapper, class I, class Reducer>
|
||||
future<json::json_return_type> map_reduce_cf(http_context& ctx, const sstring& name, I init,
|
||||
Mapper mapper, Reducer reducer) {
|
||||
return map_reduce_cf_raw(ctx, name, init, mapper, reducer).then([](const I& res) {
|
||||
return make_ready_future<json::json_return_type>(res);
|
||||
});
|
||||
}
|
||||
|
||||
template<class Mapper, class I, class Reducer, class Result>
|
||||
future<json::json_return_type> map_reduce_cf(http_context& ctx, const sstring& name, I init,
|
||||
future<I> map_reduce_cf_raw(http_context& ctx, const sstring& name, I init,
|
||||
Mapper mapper, Reducer reducer, Result result) {
|
||||
auto uuid = get_uuid(name, ctx.db.local());
|
||||
return ctx.db.map_reduce0([mapper, uuid](database& db) {
|
||||
return mapper(db.find_column_family(uuid));
|
||||
}, init, reducer).then([result](const I& res) mutable {
|
||||
}, init, reducer);
|
||||
}
|
||||
|
||||
|
||||
template<class Mapper, class I, class Reducer, class Result>
|
||||
future<json::json_return_type> map_reduce_cf(http_context& ctx, const sstring& name, I init,
|
||||
Mapper mapper, Reducer reducer, Result result) {
|
||||
return map_reduce_cf_raw(ctx, name, init, mapper, reducer, result).then([result](const I& res) mutable {
|
||||
result = res;
|
||||
return make_ready_future<json::json_return_type>(result);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
template<class Mapper, class I, class Reducer>
|
||||
future<json::json_return_type> map_reduce_cf(http_context& ctx, I init,
|
||||
future<I> map_reduce_cf_raw(http_context& ctx, I init,
|
||||
Mapper mapper, Reducer reducer) {
|
||||
return ctx.db.map_reduce0([mapper, init, reducer](database& db) {
|
||||
auto res = init;
|
||||
@@ -66,10 +79,18 @@ future<json::json_return_type> map_reduce_cf(http_context& ctx, I init,
|
||||
res = reducer(res, mapper(*i.second.get()));
|
||||
}
|
||||
return res;
|
||||
}, init, reducer).then([](const I& res) {
|
||||
}, init, reducer);
|
||||
}
|
||||
|
||||
|
||||
template<class Mapper, class I, class Reducer>
|
||||
future<json::json_return_type> map_reduce_cf(http_context& ctx, I init,
|
||||
Mapper mapper, Reducer reducer) {
|
||||
return map_reduce_cf_raw(ctx, init, mapper, reducer).then([](const I& res) {
|
||||
return make_ready_future<json::json_return_type>(res);
|
||||
});
|
||||
}
|
||||
|
||||
future<json::json_return_type> get_cf_stats(http_context& ctx, const sstring& name,
|
||||
int64_t column_family::stats::*f);
|
||||
|
||||
|
||||
@@ -33,6 +33,25 @@ namespace sp = httpd::storage_proxy_json;
|
||||
using proxy = service::storage_proxy;
|
||||
using namespace json;
|
||||
|
||||
static future<utils::rate_moving_average> sum_timed_rate(distributed<proxy>& d, utils::timed_rate_moving_average proxy::stats::*f) {
|
||||
return d.map_reduce0([f](const proxy& p) {return (p.get_stats().*f).rate();}, utils::rate_moving_average(),
|
||||
std::plus<utils::rate_moving_average>());
|
||||
}
|
||||
|
||||
static future<json::json_return_type> sum_timed_rate_as_obj(distributed<proxy>& d, utils::timed_rate_moving_average proxy::stats::*f) {
|
||||
return sum_timed_rate(d, f).then([](const utils::rate_moving_average& val) {
|
||||
httpd::utils_json::rate_moving_average m;
|
||||
m = val;
|
||||
return make_ready_future<json::json_return_type>(m);
|
||||
});
|
||||
}
|
||||
|
||||
static future<json::json_return_type> sum_timed_rate_as_long(distributed<proxy>& d, utils::timed_rate_moving_average proxy::stats::*f) {
|
||||
return sum_timed_rate(d, f).then([](const utils::rate_moving_average& val) {
|
||||
return make_ready_future<json::json_return_type>(val.count);
|
||||
});
|
||||
}
|
||||
|
||||
static future<json::json_return_type> sum_estimated_histogram(http_context& ctx, sstables::estimated_histogram proxy::stats::*f) {
|
||||
return ctx.sp.map_reduce0([f](const proxy& p) {return p.get_stats().*f;}, sstables::estimated_histogram(),
|
||||
sstables::merge).then([](const sstables::estimated_histogram& val) {
|
||||
@@ -42,8 +61,8 @@ static future<json::json_return_type> sum_estimated_histogram(http_context& ctx
|
||||
});
|
||||
}
|
||||
|
||||
static future<json::json_return_type> total_latency(http_context& ctx, utils::ihistogram proxy::stats::*f) {
|
||||
return ctx.sp.map_reduce0([f](const proxy& p) {return (p.get_stats().*f).mean * (p.get_stats().*f).count;}, 0.0,
|
||||
static future<json::json_return_type> total_latency(http_context& ctx, utils::timed_rate_moving_average_and_histogram proxy::stats::*f) {
|
||||
return ctx.sp.map_reduce0([f](const proxy& p) {return (p.get_stats().*f).hist.mean * (p.get_stats().*f).hist.count;}, 0.0,
|
||||
std::plus<double>()).then([](double val) {
|
||||
int64_t res = val;
|
||||
return make_ready_future<json::json_return_type>(res);
|
||||
@@ -291,41 +310,77 @@ void set_storage_proxy(http_context& ctx, routes& r) {
|
||||
});
|
||||
|
||||
sp::get_read_metrics_timeouts.set(r, [&ctx](std::unique_ptr<request> req) {
|
||||
return sum_stats(ctx.sp, &proxy::stats::read_timeouts);
|
||||
return sum_timed_rate_as_long(ctx.sp, &proxy::stats::read_timeouts);
|
||||
});
|
||||
|
||||
sp::get_read_metrics_unavailables.set(r, [&ctx](std::unique_ptr<request> req) {
|
||||
return sum_stats(ctx.sp, &proxy::stats::read_unavailables);
|
||||
return sum_timed_rate_as_long(ctx.sp, &proxy::stats::read_unavailables);
|
||||
});
|
||||
|
||||
sp::get_range_metrics_timeouts.set(r, [&ctx](std::unique_ptr<request> req) {
|
||||
return sum_stats(ctx.sp, &proxy::stats::range_slice_timeouts);
|
||||
return sum_timed_rate_as_long(ctx.sp, &proxy::stats::range_slice_timeouts);
|
||||
});
|
||||
|
||||
sp::get_range_metrics_unavailables.set(r, [&ctx](std::unique_ptr<request> req) {
|
||||
return sum_stats(ctx.sp, &proxy::stats::range_slice_unavailables);
|
||||
return sum_timed_rate_as_long(ctx.sp, &proxy::stats::range_slice_unavailables);
|
||||
});
|
||||
|
||||
sp::get_write_metrics_timeouts.set(r, [&ctx](std::unique_ptr<request> req) {
|
||||
return sum_stats(ctx.sp, &proxy::stats::write_timeouts);
|
||||
return sum_timed_rate_as_long(ctx.sp, &proxy::stats::write_timeouts);
|
||||
});
|
||||
|
||||
sp::get_write_metrics_unavailables.set(r, [&ctx](std::unique_ptr<request> req) {
|
||||
return sum_stats(ctx.sp, &proxy::stats::write_unavailables);
|
||||
return sum_timed_rate_as_long(ctx.sp, &proxy::stats::write_unavailables);
|
||||
});
|
||||
|
||||
sp::get_range_metrics_latency_histogram.set(r, [&ctx](std::unique_ptr<request> req) {
|
||||
sp::get_read_metrics_timeouts_rates.set(r, [&ctx](std::unique_ptr<request> req) {
|
||||
return sum_timed_rate_as_obj(ctx.sp, &proxy::stats::read_timeouts);
|
||||
});
|
||||
|
||||
sp::get_read_metrics_unavailables_rates.set(r, [&ctx](std::unique_ptr<request> req) {
|
||||
return sum_timed_rate_as_obj(ctx.sp, &proxy::stats::read_unavailables);
|
||||
});
|
||||
|
||||
sp::get_range_metrics_timeouts_rates.set(r, [&ctx](std::unique_ptr<request> req) {
|
||||
return sum_timed_rate_as_obj(ctx.sp, &proxy::stats::range_slice_timeouts);
|
||||
});
|
||||
|
||||
sp::get_range_metrics_unavailables_rates.set(r, [&ctx](std::unique_ptr<request> req) {
|
||||
return sum_timed_rate_as_obj(ctx.sp, &proxy::stats::range_slice_unavailables);
|
||||
});
|
||||
|
||||
sp::get_write_metrics_timeouts_rates.set(r, [&ctx](std::unique_ptr<request> req) {
|
||||
return sum_timed_rate_as_obj(ctx.sp, &proxy::stats::write_timeouts);
|
||||
});
|
||||
|
||||
sp::get_write_metrics_unavailables_rates.set(r, [&ctx](std::unique_ptr<request> req) {
|
||||
return sum_timed_rate_as_obj(ctx.sp, &proxy::stats::write_unavailables);
|
||||
});
|
||||
|
||||
sp::get_range_metrics_latency_histogram_depricated.set(r, [&ctx](std::unique_ptr<request> req) {
|
||||
return sum_histogram_stats(ctx.sp, &proxy::stats::range);
|
||||
});
|
||||
|
||||
sp::get_write_metrics_latency_histogram.set(r, [&ctx](std::unique_ptr<request> req) {
|
||||
sp::get_write_metrics_latency_histogram_depricated.set(r, [&ctx](std::unique_ptr<request> req) {
|
||||
return sum_histogram_stats(ctx.sp, &proxy::stats::write);
|
||||
});
|
||||
|
||||
sp::get_read_metrics_latency_histogram.set(r, [&ctx](std::unique_ptr<request> req) {
|
||||
sp::get_read_metrics_latency_histogram_depricated.set(r, [&ctx](std::unique_ptr<request> req) {
|
||||
return sum_histogram_stats(ctx.sp, &proxy::stats::read);
|
||||
});
|
||||
|
||||
sp::get_range_metrics_latency_histogram.set(r, [&ctx](std::unique_ptr<request> req) {
|
||||
return sum_timer_stats(ctx.sp, &proxy::stats::range);
|
||||
});
|
||||
|
||||
sp::get_write_metrics_latency_histogram.set(r, [&ctx](std::unique_ptr<request> req) {
|
||||
return sum_timer_stats(ctx.sp, &proxy::stats::write);
|
||||
});
|
||||
|
||||
sp::get_read_metrics_latency_histogram.set(r, [&ctx](std::unique_ptr<request> req) {
|
||||
return sum_timer_stats(ctx.sp, &proxy::stats::read);
|
||||
});
|
||||
|
||||
sp::get_read_estimated_histogram.set(r, [&ctx](std::unique_ptr<request> req) {
|
||||
return sum_estimated_histogram(ctx, &proxy::stats::estimated_read);
|
||||
});
|
||||
@@ -342,7 +397,7 @@ void set_storage_proxy(http_context& ctx, routes& r) {
|
||||
});
|
||||
|
||||
sp::get_range_estimated_histogram.set(r, [&ctx](std::unique_ptr<request> req) {
|
||||
return sum_histogram_stats(ctx.sp, &proxy::stats::read);
|
||||
return sum_timer_stats(ctx.sp, &proxy::stats::read);
|
||||
});
|
||||
|
||||
sp::get_range_latency.set(r, [&ctx](std::unique_ptr<request> req) {
|
||||
|
||||
11
auth/auth.cc
11
auth/auth.cc
@@ -97,7 +97,7 @@ namespace std {
|
||||
template <>
|
||||
struct hash<auth::data_resource> {
|
||||
size_t operator()(const auth::data_resource & v) const {
|
||||
return std::hash<sstring>()(v.name());
|
||||
return v.hash_value();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -354,9 +354,12 @@ future<> auth::auth::setup_table(const sstring& name, const sstring& cql) {
|
||||
::shared_ptr<cql3::statements::create_table_statement> statement =
|
||||
static_pointer_cast<cql3::statements::create_table_statement>(
|
||||
parsed->prepare(db)->statement);
|
||||
// Origin sets "Legacy Cf Id" for the new table. We have no need to be
|
||||
// pre-2.1 compatible (afaik), so lets skip a whole lotta hoolaballo
|
||||
return statement->announce_migration(qp.proxy(), false).then([statement](bool) {});
|
||||
auto schema = statement->get_cf_meta_data();
|
||||
auto uuid = generate_legacy_id(schema->ks_name(), schema->cf_name());
|
||||
|
||||
schema_builder b(schema);
|
||||
b.set_uuid(uuid);
|
||||
return service::get_local_migration_manager().announce_new_column_family(b.build(), false);
|
||||
}
|
||||
|
||||
future<bool> auth::auth::has_existing_users(const sstring& cfname, const sstring& def_user_name, const sstring& name_column) {
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "utils/hash.hh"
|
||||
#include <iosfwd>
|
||||
#include <set>
|
||||
#include <seastar/core/sstring.hh>
|
||||
@@ -137,6 +138,10 @@ public:
|
||||
|
||||
bool operator==(const data_resource&) const;
|
||||
bool operator<(const data_resource&) const;
|
||||
|
||||
size_t hash_value() const {
|
||||
return utils::tuple_hash()(_ks, _cf);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,7 +28,11 @@ class checked_file_impl : public file_impl {
|
||||
public:
|
||||
|
||||
checked_file_impl(disk_error_signal_type& s, file f)
|
||||
: _signal(s) , _file(f) {}
|
||||
: _signal(s) , _file(f) {
|
||||
_memory_dma_alignment = f.memory_dma_alignment();
|
||||
_disk_read_dma_alignment = f.disk_read_dma_alignment();
|
||||
_disk_write_dma_alignment = f.disk_write_dma_alignment();
|
||||
}
|
||||
|
||||
virtual future<size_t> write_dma(uint64_t pos, const void* buffer, size_t len, const io_priority_class& pc) override {
|
||||
return do_io_check(_signal, [&] {
|
||||
|
||||
127
clustering_bounds_comparator.hh
Normal file
127
clustering_bounds_comparator.hh
Normal file
@@ -0,0 +1,127 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2016 ScyllaDB
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is part of Scylla.
|
||||
*
|
||||
* Scylla is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Scylla is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Scylla. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "keys.hh"
|
||||
#include "schema.hh"
|
||||
#include "range.hh"
|
||||
|
||||
/**
|
||||
* Represents the kind of bound in a range tombstone.
|
||||
*/
|
||||
enum class bound_kind : uint8_t {
|
||||
excl_end = 0,
|
||||
incl_start = 1,
|
||||
// values 2 to 5 are reserved for forward Origin compatibility
|
||||
incl_end = 6,
|
||||
excl_start = 7,
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const bound_kind k);
|
||||
|
||||
bound_kind invert_kind(bound_kind k);
|
||||
int32_t weight(bound_kind k);
|
||||
|
||||
static inline bound_kind flip_bound_kind(bound_kind bk)
|
||||
{
|
||||
switch (bk) {
|
||||
case bound_kind::excl_end: return bound_kind::excl_start;
|
||||
case bound_kind::incl_end: return bound_kind::incl_start;
|
||||
case bound_kind::excl_start: return bound_kind::excl_end;
|
||||
case bound_kind::incl_start: return bound_kind::incl_end;
|
||||
}
|
||||
abort();
|
||||
}
|
||||
|
||||
class bound_view {
|
||||
const static thread_local clustering_key empty_prefix;
|
||||
public:
|
||||
const clustering_key_prefix& prefix;
|
||||
bound_kind kind;
|
||||
bound_view(const clustering_key_prefix& prefix, bound_kind kind)
|
||||
: prefix(prefix)
|
||||
, kind(kind)
|
||||
{ }
|
||||
struct compare {
|
||||
// To make it assignable and to avoid taking a schema_ptr, we
|
||||
// wrap the schema reference.
|
||||
std::reference_wrapper<const schema> _s;
|
||||
compare(const schema& s) : _s(s)
|
||||
{ }
|
||||
bool operator()(const clustering_key_prefix& p1, int32_t w1, const clustering_key_prefix& p2, int32_t w2) const {
|
||||
auto type = _s.get().clustering_key_prefix_type();
|
||||
auto res = prefix_equality_tri_compare(type->types().begin(),
|
||||
type->begin(p1), type->end(p1),
|
||||
type->begin(p2), type->end(p2),
|
||||
tri_compare);
|
||||
if (res) {
|
||||
return res < 0;
|
||||
}
|
||||
auto d1 = p1.size(_s);
|
||||
auto d2 = p2.size(_s);
|
||||
if (d1 == d2) {
|
||||
return w1 < w2;
|
||||
}
|
||||
return d1 < d2 ? w1 <= 0 : w2 > 0;
|
||||
}
|
||||
bool operator()(const bound_view b, const clustering_key_prefix& p) const {
|
||||
return operator()(b.prefix, weight(b.kind), p, 0);
|
||||
}
|
||||
bool operator()(const clustering_key_prefix& p, const bound_view b) const {
|
||||
return operator()(p, 0, b.prefix, weight(b.kind));
|
||||
}
|
||||
bool operator()(const bound_view b1, const bound_view b2) const {
|
||||
return operator()(b1.prefix, weight(b1.kind), b2.prefix, weight(b2.kind));
|
||||
}
|
||||
};
|
||||
bool equal(const schema& s, const bound_view other) const {
|
||||
return kind == other.kind && prefix.equal(s, other.prefix);
|
||||
}
|
||||
bool adjacent(const schema& s, const bound_view other) const {
|
||||
return invert_kind(other.kind) == kind && prefix.equal(s, other.prefix);
|
||||
}
|
||||
static bound_view bottom(const schema& s) {
|
||||
return {empty_prefix, bound_kind::incl_start};
|
||||
}
|
||||
static bound_view top(const schema& s) {
|
||||
return {empty_prefix, bound_kind::incl_end};
|
||||
}
|
||||
/*
|
||||
template<template<typename> typename T, typename U>
|
||||
concept bool Range() {
|
||||
return requires (T<U> range) {
|
||||
{ range.start() } -> stdx::optional<U>;
|
||||
{ range.end() } -> stdx::optional<U>;
|
||||
};
|
||||
};*/
|
||||
template<template<typename> typename Range>
|
||||
static std::pair<bound_view, bound_view> from_range(const schema& s, const Range<clustering_key_prefix>& range) {
|
||||
return {
|
||||
range.start() ? bound_view(range.start()->value(), range.start()->is_inclusive() ? bound_kind::incl_start : bound_kind::excl_start) : bottom(s),
|
||||
range.end() ? bound_view(range.end()->value(), range.end()->is_inclusive() ? bound_kind::incl_end : bound_kind::excl_end) : top(s),
|
||||
};
|
||||
}
|
||||
friend std::ostream& operator<<(std::ostream& out, const bound_view& b) {
|
||||
return out << "{bound: prefix=" << b.prefix << ", kind=" << b.kind << "}";
|
||||
}
|
||||
};
|
||||
124
clustering_key_filter.cc
Normal file
124
clustering_key_filter.cc
Normal file
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* Copyright (C) 2016 ScyllaDB
|
||||
*
|
||||
* Modified by ScyllaDB
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is part of Scylla.
|
||||
*
|
||||
* Scylla is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Scylla is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Scylla. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "clustering_key_filter.hh"
|
||||
#include "keys.hh"
|
||||
#include "query-request.hh"
|
||||
#include "range.hh"
|
||||
|
||||
namespace query {
|
||||
|
||||
const std::vector<range<clustering_key_prefix>>&
|
||||
clustering_key_filtering_context::get_ranges(const partition_key& key) const {
|
||||
static thread_local std::vector<range<clustering_key_prefix>> full_range = {{}};
|
||||
return _factory ? _factory->get_ranges(key) : full_range;
|
||||
}
|
||||
|
||||
clustering_key_filtering_context clustering_key_filtering_context::create_no_filtering() {
|
||||
return clustering_key_filtering_context{};
|
||||
}
|
||||
|
||||
const clustering_key_filtering_context no_clustering_key_filtering =
|
||||
clustering_key_filtering_context::create_no_filtering();
|
||||
|
||||
class stateless_clustering_key_filter_factory : public clustering_key_filter_factory {
|
||||
clustering_key_filter _filter;
|
||||
std::vector<range<clustering_key_prefix>> _ranges;
|
||||
public:
|
||||
stateless_clustering_key_filter_factory(std::vector<range<clustering_key_prefix>>&& ranges,
|
||||
clustering_key_filter&& filter)
|
||||
: _filter(std::move(filter)), _ranges(std::move(ranges)) {}
|
||||
|
||||
virtual clustering_key_filter get_filter(const partition_key& key) override {
|
||||
return _filter;
|
||||
}
|
||||
|
||||
virtual clustering_key_filter get_filter_for_sorted(const partition_key& key) override {
|
||||
return _filter;
|
||||
}
|
||||
|
||||
virtual const std::vector<range<clustering_key_prefix>>& get_ranges(const partition_key& key) override {
|
||||
return _ranges;
|
||||
}
|
||||
};
|
||||
|
||||
class partition_slice_clustering_key_filter_factory : public clustering_key_filter_factory {
|
||||
schema_ptr _schema;
|
||||
const partition_slice& _slice;
|
||||
clustering_key_prefix::prefix_equal_tri_compare _cmp;
|
||||
public:
|
||||
partition_slice_clustering_key_filter_factory(schema_ptr s, const partition_slice& slice)
|
||||
: _schema(std::move(s)), _slice(slice), _cmp(*_schema) {}
|
||||
|
||||
virtual clustering_key_filter get_filter(const partition_key& key) override {
|
||||
const clustering_row_ranges& ranges = _slice.row_ranges(*_schema, key);
|
||||
return [this, &ranges] (const clustering_key& key) {
|
||||
return std::any_of(std::begin(ranges), std::end(ranges),
|
||||
[this, &key] (const range<clustering_key_prefix>& r) { return r.contains(key, _cmp); });
|
||||
};
|
||||
}
|
||||
|
||||
virtual clustering_key_filter get_filter_for_sorted(const partition_key& key) override {
|
||||
const clustering_row_ranges& ranges = _slice.row_ranges(*_schema, key);
|
||||
return [this, &ranges] (const clustering_key& key) {
|
||||
return std::any_of(std::begin(ranges), std::end(ranges),
|
||||
[this, &key] (const range<clustering_key_prefix>& r) { return r.contains(key, _cmp); });
|
||||
};
|
||||
}
|
||||
|
||||
virtual const std::vector<range<clustering_key_prefix>>& get_ranges(const partition_key& key) override {
|
||||
return _slice.row_ranges(*_schema, key);
|
||||
}
|
||||
};
|
||||
|
||||
static const shared_ptr<clustering_key_filter_factory>
|
||||
create_partition_slice_filter(schema_ptr s, const partition_slice& slice) {
|
||||
return ::make_shared<partition_slice_clustering_key_filter_factory>(std::move(s), slice);
|
||||
}
|
||||
|
||||
const clustering_key_filtering_context
|
||||
clustering_key_filtering_context::create(schema_ptr schema, const partition_slice& slice) {
|
||||
static thread_local clustering_key_filtering_context accept_all = clustering_key_filtering_context(
|
||||
::make_shared<stateless_clustering_key_filter_factory>(std::vector<range<clustering_key_prefix>>{{}},
|
||||
[](const clustering_key&) { return true; }));
|
||||
static thread_local clustering_key_filtering_context reject_all = clustering_key_filtering_context(
|
||||
::make_shared<stateless_clustering_key_filter_factory>(std::vector<range<clustering_key_prefix>>{},
|
||||
[](const clustering_key&) { return false; }));
|
||||
|
||||
if (slice.get_specific_ranges()) {
|
||||
return clustering_key_filtering_context(create_partition_slice_filter(schema, slice));
|
||||
}
|
||||
|
||||
const clustering_row_ranges& ranges = slice.default_row_ranges();
|
||||
|
||||
if (ranges.empty()) {
|
||||
return reject_all;
|
||||
}
|
||||
|
||||
if (ranges.size() == 1 && ranges[0].is_full()) {
|
||||
return accept_all;
|
||||
}
|
||||
return clustering_key_filtering_context(create_partition_slice_filter(schema, slice));
|
||||
}
|
||||
|
||||
}
|
||||
75
clustering_key_filter.hh
Normal file
75
clustering_key_filter.hh
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (C) 2016 ScyllaDB
|
||||
*
|
||||
* Modified by ScyllaDB
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is part of Scylla.
|
||||
*
|
||||
* Scylla is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Scylla is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Scylla. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
#include "core/shared_ptr.hh"
|
||||
#include "database_fwd.hh"
|
||||
#include "schema.hh"
|
||||
|
||||
template<typename T> class range;
|
||||
|
||||
namespace query {
|
||||
|
||||
class partition_slice;
|
||||
|
||||
// A predicate that tells if a clustering key should be accepted.
|
||||
using clustering_key_filter = std::function<bool(const clustering_key&)>;
|
||||
|
||||
// A factory for clustering key filter which can be reused for multiple clustering keys.
|
||||
class clustering_key_filter_factory {
|
||||
public:
|
||||
// Create a clustering key filter that can be used for multiple clustering keys with no restrictions.
|
||||
virtual clustering_key_filter get_filter(const partition_key&) = 0;
|
||||
// Create a clustering key filter that can be used for multiple clustering keys but they have to be sorted.
|
||||
virtual clustering_key_filter get_filter_for_sorted(const partition_key&) = 0;
|
||||
virtual const std::vector<range<clustering_key_prefix>>& get_ranges(const partition_key&) = 0;
|
||||
virtual ~clustering_key_filter_factory() = default;
|
||||
};
|
||||
|
||||
class clustering_key_filtering_context {
|
||||
private:
|
||||
shared_ptr<clustering_key_filter_factory> _factory;
|
||||
clustering_key_filtering_context() {};
|
||||
clustering_key_filtering_context(shared_ptr<clustering_key_filter_factory> factory) : _factory(factory) {}
|
||||
public:
|
||||
// Create a clustering key filter that can be used for multiple clustering keys with no restrictions.
|
||||
clustering_key_filter get_filter(const partition_key& key) const {
|
||||
return _factory ? _factory->get_filter(key) : [] (const clustering_key&) { return true; };
|
||||
}
|
||||
// Create a clustering key filter that can be used for multiple clustering keys but they have to be sorted.
|
||||
clustering_key_filter get_filter_for_sorted(const partition_key& key) const {
|
||||
return _factory ? _factory->get_filter_for_sorted(key) : [] (const clustering_key&) { return true; };
|
||||
}
|
||||
const std::vector<range<clustering_key_prefix>>& get_ranges(const partition_key& key) const;
|
||||
|
||||
static const clustering_key_filtering_context create(schema_ptr, const partition_slice&);
|
||||
|
||||
static clustering_key_filtering_context create_no_filtering();
|
||||
};
|
||||
|
||||
extern const clustering_key_filtering_context no_clustering_key_filtering;
|
||||
|
||||
}
|
||||
@@ -51,6 +51,9 @@ public:
|
||||
// Return a list of sstables to be compacted after applying the strategy.
|
||||
compaction_descriptor get_sstables_for_compaction(column_family& cfs, std::vector<lw_shared_ptr<sstable>> candidates);
|
||||
|
||||
// Return if parallel compaction is allowed by strategy.
|
||||
bool parallel_compaction() const;
|
||||
|
||||
static sstring name(compaction_strategy_type type) {
|
||||
switch (type) {
|
||||
case compaction_strategy_type::null:
|
||||
|
||||
@@ -805,3 +805,11 @@ commitlog_total_space_in_mb: -1
|
||||
# true: relaxed environment checks; performance and reliability may degraade.
|
||||
#
|
||||
# developer_mode: false
|
||||
|
||||
|
||||
# Idle-time background processing
|
||||
#
|
||||
# Scylla can perform certain jobs in the background while the system is otherwise idle,
|
||||
# freeing processor resources when there is other work to be done.
|
||||
#
|
||||
# defragment_memory_on_idle: true
|
||||
|
||||
@@ -162,6 +162,7 @@ modes = {
|
||||
|
||||
scylla_tests = [
|
||||
'tests/mutation_test',
|
||||
'tests/schema_registry_test',
|
||||
'tests/canonical_mutation_test',
|
||||
'tests/range_test',
|
||||
'tests/types_test',
|
||||
@@ -292,6 +293,7 @@ scylla_core = (['database.cc',
|
||||
'mutation_query.cc',
|
||||
'key_reader.cc',
|
||||
'keys.cc',
|
||||
'clustering_key_filter.cc',
|
||||
'sstables/sstables.cc',
|
||||
'sstables/compress.cc',
|
||||
'sstables/row.cc',
|
||||
@@ -350,6 +352,7 @@ scylla_core = (['database.cc',
|
||||
'cql3/statements/grant_statement.cc',
|
||||
'cql3/statements/revoke_statement.cc',
|
||||
'cql3/statements/alter_type_statement.cc',
|
||||
'cql3/statements/alter_keyspace_statement.cc',
|
||||
'cql3/update_parameters.cc',
|
||||
'cql3/ut_name.cc',
|
||||
'cql3/user_options.cc',
|
||||
@@ -368,6 +371,7 @@ scylla_core = (['database.cc',
|
||||
'cql3/operator.cc',
|
||||
'cql3/relation.cc',
|
||||
'cql3/column_identifier.cc',
|
||||
'cql3/column_specification.cc',
|
||||
'cql3/constants.cc',
|
||||
'cql3/query_processor.cc',
|
||||
'cql3/query_options.cc',
|
||||
@@ -383,6 +387,7 @@ scylla_core = (['database.cc',
|
||||
'cql3/selection/selection.cc',
|
||||
'cql3/selection/selector.cc',
|
||||
'cql3/restrictions/statement_restrictions.cc',
|
||||
'cql3/result_set.cc',
|
||||
'db/consistency_level.cc',
|
||||
'db/system_keyspace.cc',
|
||||
'db/schema_tables.cc',
|
||||
|
||||
@@ -35,7 +35,7 @@ class converting_mutation_partition_applier : public mutation_partition_visitor
|
||||
deletable_row* _current_row;
|
||||
private:
|
||||
static bool is_compatible(const column_definition& new_def, const data_type& old_type, column_kind kind) {
|
||||
return new_def.kind == kind && new_def.type->is_value_compatible_with(*old_type);
|
||||
return ::is_compatible(new_def.kind, kind) && new_def.type->is_value_compatible_with(*old_type);
|
||||
}
|
||||
void accept_cell(row& dst, column_kind kind, const column_definition& new_def, const data_type& old_type, atomic_cell_view cell) {
|
||||
if (is_compatible(new_def, old_type, kind) && cell.timestamp() > new_def.dropped_at()) {
|
||||
|
||||
14
cql3/Cql.g
14
cql3/Cql.g
@@ -32,6 +32,7 @@ options {
|
||||
|
||||
@parser::includes {
|
||||
#include "cql3/selection/writetime_or_ttl.hh"
|
||||
#include "cql3/statements/alter_keyspace_statement.hh"
|
||||
#include "cql3/statements/alter_table_statement.hh"
|
||||
#include "cql3/statements/create_keyspace_statement.hh"
|
||||
#include "cql3/statements/drop_keyspace_statement.hh"
|
||||
@@ -316,9 +317,7 @@ cqlStatement returns [shared_ptr<parsed_statement> stmt]
|
||||
| st13=dropIndexStatement { $stmt = st13; }
|
||||
#endif
|
||||
| st14=alterTableStatement { $stmt = st14; }
|
||||
#if 0
|
||||
| st15=alterKeyspaceStatement { $stmt = st15; }
|
||||
#endif
|
||||
| st16=grantStatement { $stmt = st16; }
|
||||
| st17=revokeStatement { $stmt = st17; }
|
||||
| st18=listPermissionsStatement { $stmt = st18; }
|
||||
@@ -809,15 +808,18 @@ dropTriggerStatement returns [DropTriggerStatement expr]
|
||||
{ $expr = new DropTriggerStatement(cf, name.toString(), ifExists); }
|
||||
;
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ALTER KEYSPACE <KS> WITH <property> = <value>;
|
||||
*/
|
||||
alterKeyspaceStatement returns [AlterKeyspaceStatement expr]
|
||||
@init { KSPropDefs attrs = new KSPropDefs(); }
|
||||
alterKeyspaceStatement returns [shared_ptr<cql3::statements::alter_keyspace_statement> expr]
|
||||
@init {
|
||||
auto attrs = make_shared<cql3::statements::ks_prop_defs>();
|
||||
}
|
||||
: K_ALTER K_KEYSPACE ks=keyspaceName
|
||||
K_WITH properties[attrs] { $expr = new AlterKeyspaceStatement(ks, attrs); }
|
||||
K_WITH properties[attrs] { $expr = make_shared<cql3::statements::alter_keyspace_statement>(ks, attrs); }
|
||||
;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ALTER COLUMN FAMILY <CF> ALTER <column> TYPE <newtype>;
|
||||
|
||||
56
cql3/column_specification.cc
Normal file
56
cql3/column_specification.cc
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2016 ScyllaDB
|
||||
*
|
||||
* Modified by ScyllaDB
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is part of Scylla.
|
||||
*
|
||||
* Scylla is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Scylla is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Scylla. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "cql3/column_specification.hh"
|
||||
|
||||
namespace cql3 {
|
||||
|
||||
bool column_specification::all_in_same_table(const std::vector<::shared_ptr<column_specification>>& names)
|
||||
{
|
||||
assert(!names.empty());
|
||||
|
||||
auto first = names.front();
|
||||
return std::all_of(std::next(names.begin()), names.end(), [first] (auto&& spec) {
|
||||
return spec->ks_name == first->ks_name && spec->cf_name == first->cf_name;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -75,6 +75,8 @@ public:
|
||||
bool is_reversed_type() const {
|
||||
return ::dynamic_pointer_cast<const reversed_type_impl>(type) != nullptr;
|
||||
}
|
||||
|
||||
static bool all_in_same_table(const std::vector<::shared_ptr<column_specification>>& names);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -432,10 +432,9 @@ void query_processor::migration_subscriber::on_update_keyspace(const sstring& ks
|
||||
|
||||
void query_processor::migration_subscriber::on_update_column_family(const sstring& ks_name, const sstring& cf_name, bool columns_changed)
|
||||
{
|
||||
if (columns_changed) {
|
||||
log.info("Column definitions for {}.{} changed, invalidating related prepared statements", ks_name, cf_name);
|
||||
remove_invalid_prepared_statements(ks_name, cf_name);
|
||||
}
|
||||
// #1255: Ignoring columns_changed deliberately.
|
||||
log.info("Column definitions for {}.{} changed, invalidating related prepared statements", ks_name, cf_name);
|
||||
remove_invalid_prepared_statements(ks_name, cf_name);
|
||||
}
|
||||
|
||||
void query_processor::migration_subscriber::on_update_user_type(const sstring& ks_name, const sstring& type_name)
|
||||
|
||||
@@ -394,6 +394,9 @@ public:
|
||||
return bounds_range_type::bound(prefix, is_inclusive(b));
|
||||
};
|
||||
auto range = bounds_range_type(read_bound(statements::bound::START), read_bound(statements::bound::END));
|
||||
if (query::is_wrap_around(range, *_schema)) {
|
||||
return {};
|
||||
}
|
||||
return { range };
|
||||
}
|
||||
#if 0
|
||||
|
||||
@@ -352,7 +352,9 @@ single_column_primary_key_restrictions<partition_key>::bounds_ranges(const query
|
||||
template<>
|
||||
std::vector<query::clustering_range>
|
||||
single_column_primary_key_restrictions<clustering_key_prefix>::bounds_ranges(const query_options& options) const {
|
||||
auto bounds = compute_bounds(options);
|
||||
auto wrapping_bounds = compute_bounds(options);
|
||||
auto bounds = boost::copy_range<query::clustering_row_ranges>(wrapping_bounds
|
||||
| boost::adaptors::filtered([&](auto&& r) { return !query::is_wrap_around(r, *_schema); }));
|
||||
auto less_cmp = clustering_key_prefix::less_compare(*_schema);
|
||||
std::sort(bounds.begin(), bounds.end(), [&] (query::clustering_range& x, query::clustering_range& y) {
|
||||
if (!x.start() && !y.start()) {
|
||||
|
||||
181
cql3/result_set.cc
Normal file
181
cql3/result_set.cc
Normal file
@@ -0,0 +1,181 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2015 ScyllaDB
|
||||
*
|
||||
* Modified by ScyllaDB
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is part of Scylla.
|
||||
*
|
||||
* Scylla is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Scylla is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Scylla. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "cql3/result_set.hh"
|
||||
|
||||
namespace cql3 {
|
||||
|
||||
metadata::metadata(std::vector<::shared_ptr<column_specification>> names_)
|
||||
: metadata(flag_enum_set(), std::move(names_), names_.size(), {})
|
||||
{ }
|
||||
|
||||
metadata::metadata(flag_enum_set flags, std::vector<::shared_ptr<column_specification>> names_, uint32_t column_count,
|
||||
::shared_ptr<const service::pager::paging_state> paging_state)
|
||||
: _flags(flags)
|
||||
, names(std::move(names_))
|
||||
, _column_count(column_count)
|
||||
, _paging_state(std::move(paging_state))
|
||||
{ }
|
||||
|
||||
// The maximum number of values that the ResultSet can hold. This can be bigger than columnCount due to CASSANDRA-4911
|
||||
uint32_t metadata::value_count() {
|
||||
return _flags.contains<flag::NO_METADATA>() ? _column_count : names.size();
|
||||
}
|
||||
|
||||
void metadata::add_non_serialized_column(::shared_ptr<column_specification> name) {
|
||||
// See comment above. Because columnCount doesn't account the newly added name, it
|
||||
// won't be serialized.
|
||||
names.emplace_back(std::move(name));
|
||||
}
|
||||
|
||||
bool metadata::all_in_same_cf() const {
|
||||
if (_flags.contains<flag::NO_METADATA>()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return column_specification::all_in_same_table(names);
|
||||
}
|
||||
|
||||
void metadata::set_has_more_pages(::shared_ptr<const service::pager::paging_state> paging_state) {
|
||||
if (!paging_state) {
|
||||
return;
|
||||
}
|
||||
|
||||
_flags.set<flag::HAS_MORE_PAGES>();
|
||||
_paging_state = std::move(paging_state);
|
||||
}
|
||||
|
||||
void metadata::set_skip_metadata() {
|
||||
_flags.set<flag::NO_METADATA>();
|
||||
}
|
||||
|
||||
metadata::flag_enum_set metadata::flags() const {
|
||||
return _flags;
|
||||
}
|
||||
|
||||
uint32_t metadata::column_count() const {
|
||||
return _column_count;
|
||||
}
|
||||
|
||||
::shared_ptr<const service::pager::paging_state> metadata::paging_state() const {
|
||||
return _paging_state;
|
||||
}
|
||||
|
||||
const std::vector<::shared_ptr<column_specification>>& metadata::get_names() const {
|
||||
return names;
|
||||
}
|
||||
|
||||
prepared_metadata::prepared_metadata(const std::vector<::shared_ptr<column_specification>>& names,
|
||||
const std::vector<uint16_t>& partition_key_bind_indices)
|
||||
: _names{names}
|
||||
, _partition_key_bind_indices{partition_key_bind_indices}
|
||||
{
|
||||
if (!names.empty() && column_specification::all_in_same_table(_names)) {
|
||||
_flags.set<flag::GLOBAL_TABLES_SPEC>();
|
||||
}
|
||||
}
|
||||
|
||||
prepared_metadata::flag_enum_set prepared_metadata::flags() const {
|
||||
return _flags;
|
||||
}
|
||||
|
||||
const std::vector<::shared_ptr<column_specification>>& prepared_metadata::names() const {
|
||||
return _names;
|
||||
}
|
||||
|
||||
const std::vector<uint16_t>& prepared_metadata::partition_key_bind_indices() const {
|
||||
return _partition_key_bind_indices;
|
||||
}
|
||||
|
||||
result_set::result_set(std::vector<::shared_ptr<column_specification>> metadata_)
|
||||
: _metadata(::make_shared<metadata>(std::move(metadata_)))
|
||||
{ }
|
||||
|
||||
result_set::result_set(::shared_ptr<metadata> metadata)
|
||||
: _metadata(std::move(metadata))
|
||||
{ }
|
||||
|
||||
size_t result_set::size() const {
|
||||
return _rows.size();
|
||||
}
|
||||
|
||||
bool result_set::empty() const {
|
||||
return _rows.empty();
|
||||
}
|
||||
|
||||
void result_set::add_row(std::vector<bytes_opt> row) {
|
||||
assert(row.size() == _metadata->value_count());
|
||||
_rows.emplace_back(std::move(row));
|
||||
}
|
||||
|
||||
void result_set::add_column_value(bytes_opt value) {
|
||||
if (_rows.empty() || _rows.back().size() == _metadata->value_count()) {
|
||||
std::vector<bytes_opt> row;
|
||||
row.reserve(_metadata->value_count());
|
||||
_rows.emplace_back(std::move(row));
|
||||
}
|
||||
|
||||
_rows.back().emplace_back(std::move(value));
|
||||
}
|
||||
|
||||
void result_set::reverse() {
|
||||
std::reverse(_rows.begin(), _rows.end());
|
||||
}
|
||||
|
||||
void result_set::trim(size_t limit) {
|
||||
if (_rows.size() > limit) {
|
||||
_rows.resize(limit);
|
||||
}
|
||||
}
|
||||
|
||||
metadata& result_set::get_metadata() {
|
||||
return *_metadata;
|
||||
}
|
||||
|
||||
const metadata& result_set::get_metadata() const {
|
||||
return *_metadata;
|
||||
}
|
||||
|
||||
const std::deque<std::vector<bytes_opt>>& result_set::rows() const {
|
||||
return _rows;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -50,15 +50,11 @@
|
||||
namespace cql3 {
|
||||
|
||||
class metadata {
|
||||
#if 0
|
||||
public static final CBCodec<Metadata> codec = new Codec();
|
||||
public static final Metadata EMPTY = new Metadata(EnumSet.of(Flag.NO_METADATA), null, 0, null);
|
||||
#endif
|
||||
public:
|
||||
enum class flag : uint8_t {
|
||||
GLOBAL_TABLES_SPEC,
|
||||
HAS_MORE_PAGES,
|
||||
NO_METADATA
|
||||
GLOBAL_TABLES_SPEC = 0,
|
||||
HAS_MORE_PAGES = 1,
|
||||
NO_METADATA = 2,
|
||||
};
|
||||
|
||||
using flag_enum = super_enum<flag,
|
||||
@@ -83,208 +79,31 @@ private:
|
||||
::shared_ptr<const service::pager::paging_state> _paging_state;
|
||||
|
||||
public:
|
||||
metadata(std::vector<::shared_ptr<column_specification>> names_)
|
||||
: metadata(flag_enum_set(), std::move(names_), names_.size(), {})
|
||||
{ }
|
||||
metadata(std::vector<::shared_ptr<column_specification>> names_);
|
||||
|
||||
metadata(flag_enum_set flags, std::vector<::shared_ptr<column_specification>> names_, uint32_t column_count,
|
||||
::shared_ptr<const service::pager::paging_state> paging_state)
|
||||
: _flags(flags)
|
||||
, names(std::move(names_))
|
||||
, _column_count(column_count)
|
||||
, _paging_state(std::move(paging_state))
|
||||
{ }
|
||||
::shared_ptr<const service::pager::paging_state> paging_state);
|
||||
|
||||
// The maximum number of values that the ResultSet can hold. This can be bigger than columnCount due to CASSANDRA-4911
|
||||
uint32_t value_count() {
|
||||
return _flags.contains<flag::NO_METADATA>() ? _column_count : names.size();
|
||||
}
|
||||
uint32_t value_count();
|
||||
|
||||
void add_non_serialized_column(::shared_ptr<column_specification> name) {
|
||||
// See comment above. Because columnCount doesn't account the newly added name, it
|
||||
// won't be serialized.
|
||||
names.emplace_back(std::move(name));
|
||||
}
|
||||
void add_non_serialized_column(::shared_ptr<column_specification> name);
|
||||
|
||||
private:
|
||||
bool all_in_same_cf() const {
|
||||
if (_flags.contains<flag::NO_METADATA>()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
assert(!names.empty());
|
||||
|
||||
auto first = names.front();
|
||||
return std::all_of(std::next(names.begin()), names.end(), [first] (auto&& spec) {
|
||||
return spec->ks_name == first->ks_name && spec->cf_name == first->cf_name;
|
||||
});
|
||||
}
|
||||
bool all_in_same_cf() const;
|
||||
|
||||
public:
|
||||
void set_has_more_pages(::shared_ptr<const service::pager::paging_state> paging_state) {
|
||||
if (!paging_state) {
|
||||
return;
|
||||
}
|
||||
void set_has_more_pages(::shared_ptr<const service::pager::paging_state> paging_state);
|
||||
|
||||
_flags.set<flag::HAS_MORE_PAGES>();
|
||||
_paging_state = std::move(paging_state);
|
||||
}
|
||||
void set_skip_metadata();
|
||||
|
||||
void set_skip_metadata() {
|
||||
_flags.set<flag::NO_METADATA>();
|
||||
}
|
||||
flag_enum_set flags() const;
|
||||
|
||||
flag_enum_set flags() const {
|
||||
return _flags;
|
||||
}
|
||||
uint32_t column_count() const;
|
||||
|
||||
uint32_t column_count() const {
|
||||
return _column_count;
|
||||
}
|
||||
|
||||
auto paging_state() const {
|
||||
return _paging_state;
|
||||
}
|
||||
|
||||
auto const& get_names() const {
|
||||
return names;
|
||||
}
|
||||
|
||||
#if 0
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if (names == null)
|
||||
{
|
||||
sb.append("[").append(columnCount).append(" columns]");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (ColumnSpecification name : names)
|
||||
{
|
||||
sb.append("[").append(name.name);
|
||||
sb.append("(").append(name.ksName).append(", ").append(name.cfName).append(")");
|
||||
sb.append(", ").append(name.type).append("]");
|
||||
}
|
||||
}
|
||||
if (flags.contains(Flag.HAS_MORE_PAGES))
|
||||
sb.append(" (to be continued)");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static class Codec implements CBCodec<Metadata>
|
||||
{
|
||||
public Metadata decode(ByteBuf body, int version)
|
||||
{
|
||||
// flags & column count
|
||||
int iflags = body.readInt();
|
||||
int columnCount = body.readInt();
|
||||
|
||||
EnumSet<Flag> flags = Flag.deserialize(iflags);
|
||||
|
||||
PagingState state = null;
|
||||
if (flags.contains(Flag.HAS_MORE_PAGES))
|
||||
state = PagingState.deserialize(CBUtil.readValue(body));
|
||||
|
||||
if (flags.contains(Flag.NO_METADATA))
|
||||
return new Metadata(flags, null, columnCount, state);
|
||||
|
||||
boolean globalTablesSpec = flags.contains(Flag.GLOBAL_TABLES_SPEC);
|
||||
|
||||
String globalKsName = null;
|
||||
String globalCfName = null;
|
||||
if (globalTablesSpec)
|
||||
{
|
||||
globalKsName = CBUtil.readString(body);
|
||||
globalCfName = CBUtil.readString(body);
|
||||
}
|
||||
|
||||
// metadata (names/types)
|
||||
List<ColumnSpecification> names = new ArrayList<ColumnSpecification>(columnCount);
|
||||
for (int i = 0; i < columnCount; i++)
|
||||
{
|
||||
String ksName = globalTablesSpec ? globalKsName : CBUtil.readString(body);
|
||||
String cfName = globalTablesSpec ? globalCfName : CBUtil.readString(body);
|
||||
ColumnIdentifier colName = new ColumnIdentifier(CBUtil.readString(body), true);
|
||||
AbstractType type = DataType.toType(DataType.codec.decodeOne(body, version));
|
||||
names.add(new ColumnSpecification(ksName, cfName, colName, type));
|
||||
}
|
||||
return new Metadata(flags, names, names.size(), state);
|
||||
}
|
||||
|
||||
public void encode(Metadata m, ByteBuf dest, int version)
|
||||
{
|
||||
boolean noMetadata = m.flags.contains(Flag.NO_METADATA);
|
||||
boolean globalTablesSpec = m.flags.contains(Flag.GLOBAL_TABLES_SPEC);
|
||||
boolean hasMorePages = m.flags.contains(Flag.HAS_MORE_PAGES);
|
||||
|
||||
assert version > 1 || (!m.flags.contains(Flag.HAS_MORE_PAGES) && !noMetadata): "version = " + version + ", flags = " + m.flags;
|
||||
|
||||
dest.writeInt(Flag.serialize(m.flags));
|
||||
dest.writeInt(m.columnCount);
|
||||
|
||||
if (hasMorePages)
|
||||
CBUtil.writeValue(m.pagingState.serialize(), dest);
|
||||
|
||||
if (!noMetadata)
|
||||
{
|
||||
if (globalTablesSpec)
|
||||
{
|
||||
CBUtil.writeString(m.names.get(0).ksName, dest);
|
||||
CBUtil.writeString(m.names.get(0).cfName, dest);
|
||||
}
|
||||
|
||||
for (int i = 0; i < m.columnCount; i++)
|
||||
{
|
||||
ColumnSpecification name = m.names.get(i);
|
||||
if (!globalTablesSpec)
|
||||
{
|
||||
CBUtil.writeString(name.ksName, dest);
|
||||
CBUtil.writeString(name.cfName, dest);
|
||||
}
|
||||
CBUtil.writeString(name.name.toString(), dest);
|
||||
DataType.codec.writeOne(DataType.fromType(name.type, version), dest, version);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int encodedSize(Metadata m, int version)
|
||||
{
|
||||
boolean noMetadata = m.flags.contains(Flag.NO_METADATA);
|
||||
boolean globalTablesSpec = m.flags.contains(Flag.GLOBAL_TABLES_SPEC);
|
||||
boolean hasMorePages = m.flags.contains(Flag.HAS_MORE_PAGES);
|
||||
|
||||
int size = 8;
|
||||
if (hasMorePages)
|
||||
size += CBUtil.sizeOfValue(m.pagingState.serialize());
|
||||
|
||||
if (!noMetadata)
|
||||
{
|
||||
if (globalTablesSpec)
|
||||
{
|
||||
size += CBUtil.sizeOfString(m.names.get(0).ksName);
|
||||
size += CBUtil.sizeOfString(m.names.get(0).cfName);
|
||||
}
|
||||
|
||||
for (int i = 0; i < m.columnCount; i++)
|
||||
{
|
||||
ColumnSpecification name = m.names.get(i);
|
||||
if (!globalTablesSpec)
|
||||
{
|
||||
size += CBUtil.sizeOfString(name.ksName);
|
||||
size += CBUtil.sizeOfString(name.cfName);
|
||||
}
|
||||
size += CBUtil.sizeOfString(name.name.toString());
|
||||
size += DataType.codec.oneSerializedSize(DataType.fromType(name.type, version), version);
|
||||
}
|
||||
}
|
||||
return size;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
::shared_ptr<const service::pager::paging_state> paging_state() const;
|
||||
|
||||
const std::vector<::shared_ptr<column_specification>>& get_names() const;
|
||||
};
|
||||
|
||||
inline ::shared_ptr<cql3::metadata> make_empty_metadata()
|
||||
@@ -294,223 +113,61 @@ inline ::shared_ptr<cql3::metadata> make_empty_metadata()
|
||||
return result;
|
||||
}
|
||||
|
||||
class result_set {
|
||||
#if 0
|
||||
private static final ColumnIdentifier COUNT_COLUMN = new ColumnIdentifier("count", false);
|
||||
#endif
|
||||
class prepared_metadata {
|
||||
public:
|
||||
enum class flag : uint8_t {
|
||||
GLOBAL_TABLES_SPEC = 0,
|
||||
};
|
||||
|
||||
using flag_enum = super_enum<flag,
|
||||
flag::GLOBAL_TABLES_SPEC>;
|
||||
|
||||
using flag_enum_set = enum_set<flag_enum>;
|
||||
private:
|
||||
flag_enum_set _flags;
|
||||
std::vector<::shared_ptr<column_specification>> _names;
|
||||
std::vector<uint16_t> _partition_key_bind_indices;
|
||||
public:
|
||||
prepared_metadata(const std::vector<::shared_ptr<column_specification>>& names,
|
||||
const std::vector<uint16_t>& partition_key_bind_indices);
|
||||
|
||||
flag_enum_set flags() const;
|
||||
const std::vector<::shared_ptr<column_specification>>& names() const;
|
||||
const std::vector<uint16_t>& partition_key_bind_indices() const;
|
||||
};
|
||||
|
||||
class result_set {
|
||||
public:
|
||||
::shared_ptr<metadata> _metadata;
|
||||
std::deque<std::vector<bytes_opt>> _rows;
|
||||
public:
|
||||
result_set(std::vector<::shared_ptr<column_specification>> metadata_)
|
||||
: _metadata(::make_shared<metadata>(std::move(metadata_)))
|
||||
{ }
|
||||
result_set(std::vector<::shared_ptr<column_specification>> metadata_);
|
||||
|
||||
result_set(::shared_ptr<metadata> metadata)
|
||||
: _metadata(std::move(metadata))
|
||||
{ }
|
||||
result_set(::shared_ptr<metadata> metadata);
|
||||
|
||||
size_t size() const {
|
||||
return _rows.size();
|
||||
}
|
||||
size_t size() const;
|
||||
|
||||
bool empty() const {
|
||||
return _rows.empty();
|
||||
}
|
||||
bool empty() const;
|
||||
|
||||
void add_row(std::vector<bytes_opt> row) {
|
||||
assert(row.size() == _metadata->value_count());
|
||||
_rows.emplace_back(std::move(row));
|
||||
}
|
||||
void add_row(std::vector<bytes_opt> row);
|
||||
|
||||
void add_column_value(bytes_opt value) {
|
||||
if (_rows.empty() || _rows.back().size() == _metadata->value_count()) {
|
||||
std::vector<bytes_opt> row;
|
||||
row.reserve(_metadata->value_count());
|
||||
_rows.emplace_back(std::move(row));
|
||||
}
|
||||
void add_column_value(bytes_opt value);
|
||||
|
||||
_rows.back().emplace_back(std::move(value));
|
||||
}
|
||||
void reverse();
|
||||
|
||||
void reverse() {
|
||||
std::reverse(_rows.begin(), _rows.end());
|
||||
}
|
||||
|
||||
void trim(size_t limit) {
|
||||
if (_rows.size() > limit) {
|
||||
_rows.resize(limit);
|
||||
}
|
||||
}
|
||||
void trim(size_t limit);
|
||||
|
||||
template<typename RowComparator>
|
||||
void sort(RowComparator&& cmp) {
|
||||
std::sort(_rows.begin(), _rows.end(), std::forward<RowComparator>(cmp));
|
||||
}
|
||||
|
||||
metadata& get_metadata() {
|
||||
return *_metadata;
|
||||
}
|
||||
metadata& get_metadata();
|
||||
|
||||
const metadata& get_metadata() const {
|
||||
return *_metadata;
|
||||
}
|
||||
const metadata& get_metadata() const;
|
||||
|
||||
// Returns a range of rows. A row is a range of bytes_opt.
|
||||
auto const& rows() const {
|
||||
return _rows;
|
||||
}
|
||||
#if 0
|
||||
public CqlResult toThriftResult()
|
||||
{
|
||||
assert metadata.names != null;
|
||||
|
||||
String UTF8 = "UTF8Type";
|
||||
CqlMetadata schema = new CqlMetadata(new HashMap<ByteBuffer, String>(),
|
||||
new HashMap<ByteBuffer, String>(),
|
||||
// The 2 following ones shouldn't be needed in CQL3
|
||||
UTF8, UTF8);
|
||||
|
||||
for (int i = 0; i < metadata.columnCount; i++)
|
||||
{
|
||||
ColumnSpecification spec = metadata.names.get(i);
|
||||
ByteBuffer colName = ByteBufferUtil.bytes(spec.name.toString());
|
||||
schema.name_types.put(colName, UTF8);
|
||||
AbstractType<?> normalizedType = spec.type instanceof ReversedType ? ((ReversedType)spec.type).baseType : spec.type;
|
||||
schema.value_types.put(colName, normalizedType.toString());
|
||||
|
||||
}
|
||||
|
||||
List<CqlRow> cqlRows = new ArrayList<CqlRow>(rows.size());
|
||||
for (List<ByteBuffer> row : rows)
|
||||
{
|
||||
List<Column> thriftCols = new ArrayList<Column>(metadata.columnCount);
|
||||
for (int i = 0; i < metadata.columnCount; i++)
|
||||
{
|
||||
Column col = new Column(ByteBufferUtil.bytes(metadata.names.get(i).name.toString()));
|
||||
col.setValue(row.get(i));
|
||||
thriftCols.add(col);
|
||||
}
|
||||
// The key of CqlRow shoudn't be needed in CQL3
|
||||
cqlRows.add(new CqlRow(ByteBufferUtil.EMPTY_BYTE_BUFFER, thriftCols));
|
||||
}
|
||||
CqlResult res = new CqlResult(CqlResultType.ROWS);
|
||||
res.setRows(cqlRows).setSchema(schema);
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
try
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(metadata).append('\n');
|
||||
for (List<ByteBuffer> row : rows)
|
||||
{
|
||||
for (int i = 0; i < row.size(); i++)
|
||||
{
|
||||
ByteBuffer v = row.get(i);
|
||||
if (v == null)
|
||||
{
|
||||
sb.append(" | null");
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.append(" | ");
|
||||
if (metadata.flags.contains(Flag.NO_METADATA))
|
||||
sb.append("0x").append(ByteBufferUtil.bytesToHex(v));
|
||||
else
|
||||
sb.append(metadata.names.get(i).type.getString(v));
|
||||
}
|
||||
}
|
||||
sb.append('\n');
|
||||
}
|
||||
sb.append("---");
|
||||
return sb.toString();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Codec implements CBCodec<ResultSet>
|
||||
{
|
||||
/*
|
||||
* Format:
|
||||
* - metadata
|
||||
* - rows count (4 bytes)
|
||||
* - rows
|
||||
*/
|
||||
public ResultSet decode(ByteBuf body, int version)
|
||||
{
|
||||
Metadata m = Metadata.codec.decode(body, version);
|
||||
int rowCount = body.readInt();
|
||||
ResultSet rs = new ResultSet(m, new ArrayList<List<ByteBuffer>>(rowCount));
|
||||
|
||||
// rows
|
||||
int totalValues = rowCount * m.columnCount;
|
||||
for (int i = 0; i < totalValues; i++)
|
||||
rs.addColumnValue(CBUtil.readValue(body));
|
||||
|
||||
return rs;
|
||||
}
|
||||
|
||||
public void encode(ResultSet rs, ByteBuf dest, int version)
|
||||
{
|
||||
Metadata.codec.encode(rs.metadata, dest, version);
|
||||
dest.writeInt(rs.rows.size());
|
||||
for (List<ByteBuffer> row : rs.rows)
|
||||
{
|
||||
// Note that we do only want to serialize only the first columnCount values, even if the row
|
||||
// as more: see comment on Metadata.names field.
|
||||
for (int i = 0; i < rs.metadata.columnCount; i++)
|
||||
CBUtil.writeValue(row.get(i), dest);
|
||||
}
|
||||
}
|
||||
|
||||
public int encodedSize(ResultSet rs, int version)
|
||||
{
|
||||
int size = Metadata.codec.encodedSize(rs.metadata, version) + 4;
|
||||
for (List<ByteBuffer> row : rs.rows)
|
||||
{
|
||||
for (int i = 0; i < rs.metadata.columnCount; i++)
|
||||
size += CBUtil.sizeOfValue(row.get(i));
|
||||
}
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
||||
public static enum Flag
|
||||
{
|
||||
// The order of that enum matters!!
|
||||
GLOBAL_TABLES_SPEC,
|
||||
HAS_MORE_PAGES,
|
||||
NO_METADATA;
|
||||
|
||||
public static EnumSet<Flag> deserialize(int flags)
|
||||
{
|
||||
EnumSet<Flag> set = EnumSet.noneOf(Flag.class);
|
||||
Flag[] values = Flag.values();
|
||||
for (int n = 0; n < values.length; n++)
|
||||
{
|
||||
if ((flags & (1 << n)) != 0)
|
||||
set.add(values[n]);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
public static int serialize(EnumSet<Flag> flags)
|
||||
{
|
||||
int i = 0;
|
||||
for (Flag flag : flags)
|
||||
i |= 1 << flag.ordinal();
|
||||
return i;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
const std::deque<std::vector<bytes_opt>>& rows() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ uint32_t selection::add_column_for_ordering(const column_definition& c) {
|
||||
raw_selector::to_selectables(raw_selectors, schema), db, schema, defs);
|
||||
|
||||
auto metadata = collect_metadata(schema, raw_selectors, *factories);
|
||||
if (processes_selection(raw_selectors)) {
|
||||
if (processes_selection(raw_selectors) || raw_selectors.size() != defs.size()) {
|
||||
return ::make_shared<selection_with_processing>(schema, std::move(defs), std::move(metadata), std::move(factories));
|
||||
} else {
|
||||
return ::make_shared<simple_selection>(schema, std::move(defs), std::move(metadata), false);
|
||||
|
||||
102
cql3/statements/alter_keyspace_statement.cc
Normal file
102
cql3/statements/alter_keyspace_statement.cc
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2015 ScyllaDB
|
||||
*
|
||||
* Modified by ScyllaDB
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is part of Scylla.
|
||||
*
|
||||
* Scylla is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Scylla is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Scylla. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "alter_keyspace_statement.hh"
|
||||
#include "service/migration_manager.hh"
|
||||
#include "db/system_keyspace.hh"
|
||||
#include "database.hh"
|
||||
|
||||
cql3::statements::alter_keyspace_statement::alter_keyspace_statement(sstring name, ::shared_ptr<ks_prop_defs> attrs)
|
||||
: _name(name)
|
||||
, _attrs(std::move(attrs))
|
||||
{}
|
||||
|
||||
const sstring& cql3::statements::alter_keyspace_statement::keyspace() const {
|
||||
return _name;
|
||||
}
|
||||
|
||||
future<> cql3::statements::alter_keyspace_statement::check_access(const service::client_state& state) {
|
||||
return state.has_keyspace_access(_name, auth::permission::ALTER);
|
||||
}
|
||||
|
||||
void cql3::statements::alter_keyspace_statement::validate(distributed<service::storage_proxy>& proxy, const service::client_state& state) {
|
||||
try {
|
||||
service::get_local_storage_proxy().get_db().local().find_keyspace(_name); // throws on failure
|
||||
auto tmp = _name;
|
||||
std::transform(tmp.begin(), tmp.end(), tmp.begin(), ::tolower);
|
||||
if (tmp == db::system_keyspace::NAME) {
|
||||
throw exceptions::invalid_request_exception("Cannot alter system keyspace");
|
||||
}
|
||||
|
||||
_attrs->validate();
|
||||
|
||||
if (!bool(_attrs->get_replication_strategy_class()) && !_attrs->get_replication_options().empty()) {
|
||||
throw exceptions::configuration_exception("Missing replication strategy class");
|
||||
}
|
||||
#if 0
|
||||
// The strategy is validated through KSMetaData.validate() in announceKeyspaceUpdate below.
|
||||
// However, for backward compatibility with thrift, this doesn't validate unexpected options yet,
|
||||
// so doing proper validation here.
|
||||
AbstractReplicationStrategy.validateReplicationStrategy(name,
|
||||
AbstractReplicationStrategy.getClass(attrs.getReplicationStrategyClass()),
|
||||
StorageService.instance.getTokenMetadata(),
|
||||
DatabaseDescriptor.getEndpointSnitch(),
|
||||
attrs.getReplicationOptions());
|
||||
#endif
|
||||
|
||||
|
||||
} catch (no_such_keyspace& e) {
|
||||
std::throw_with_nested(exceptions::invalid_request_exception("Unknown keyspace " + _name));
|
||||
}
|
||||
}
|
||||
|
||||
future<bool> cql3::statements::alter_keyspace_statement::announce_migration(distributed<service::storage_proxy>& proxy, bool is_local_only) {
|
||||
auto old_ksm = service::get_local_storage_proxy().get_db().local().find_keyspace(_name).metadata();
|
||||
return service::get_local_migration_manager().announce_keyspace_update(_attrs->as_ks_metadata_update(old_ksm), is_local_only).then([] {
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
shared_ptr<transport::event::schema_change> cql3::statements::alter_keyspace_statement::change_event() {
|
||||
return make_shared<transport::event::schema_change>(
|
||||
transport::event::schema_change::change_type::UPDATED,
|
||||
keyspace());
|
||||
}
|
||||
@@ -41,80 +41,29 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "cql3/statements/schema_altering_statement.hh"
|
||||
#include "cql3/statements/ks_prop_defs.hh"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace cql3 {
|
||||
|
||||
namespace statements {
|
||||
|
||||
class alter_keyspace_statement : public schema_altering_statement {
|
||||
sstring _name;
|
||||
std::unique_ptr<ks_prop_defs> _attrs;
|
||||
::shared_ptr<ks_prop_defs> _attrs;
|
||||
|
||||
public:
|
||||
alter_keyspace_statement(sstring name, std::unique_ptr<ks_prop_defs>&& attrs)
|
||||
: _name{name}
|
||||
, _attrs{std::move(attrs)}
|
||||
{ }
|
||||
alter_keyspace_statement(sstring name, ::shared_ptr<ks_prop_defs> attrs);
|
||||
|
||||
virtual const sstring& keyspace() const override {
|
||||
return _name;
|
||||
}
|
||||
const sstring& keyspace() const override;
|
||||
|
||||
#if 0
|
||||
public void checkAccess(ClientState state) throws UnauthorizedException, InvalidRequestException
|
||||
{
|
||||
state.hasKeyspaceAccess(name, Permission.ALTER);
|
||||
}
|
||||
|
||||
public void validate(ClientState state) throws RequestValidationException
|
||||
{
|
||||
KSMetaData ksm = Schema.instance.getKSMetaData(name);
|
||||
if (ksm == null)
|
||||
throw new InvalidRequestException("Unknown keyspace " + name);
|
||||
if (ksm.name.equalsIgnoreCase(SystemKeyspace.NAME))
|
||||
throw new InvalidRequestException("Cannot alter system keyspace");
|
||||
|
||||
attrs.validate();
|
||||
|
||||
if (attrs.getReplicationStrategyClass() == null && !attrs.getReplicationOptions().isEmpty())
|
||||
{
|
||||
throw new ConfigurationException("Missing replication strategy class");
|
||||
}
|
||||
else if (attrs.getReplicationStrategyClass() != null)
|
||||
{
|
||||
// The strategy is validated through KSMetaData.validate() in announceKeyspaceUpdate below.
|
||||
// However, for backward compatibility with thrift, this doesn't validate unexpected options yet,
|
||||
// so doing proper validation here.
|
||||
AbstractReplicationStrategy.validateReplicationStrategy(name,
|
||||
AbstractReplicationStrategy.getClass(attrs.getReplicationStrategyClass()),
|
||||
StorageService.instance.getTokenMetadata(),
|
||||
DatabaseDescriptor.getEndpointSnitch(),
|
||||
attrs.getReplicationOptions());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean announceMigration(boolean isLocalOnly) throws RequestValidationException
|
||||
{
|
||||
KSMetaData ksm = Schema.instance.getKSMetaData(name);
|
||||
// In the (very) unlikely case the keyspace was dropped since validate()
|
||||
if (ksm == null)
|
||||
throw new InvalidRequestException("Unknown keyspace " + name);
|
||||
|
||||
MigrationManager.announceKeyspaceUpdate(attrs.asKSMetadataUpdate(ksm), isLocalOnly);
|
||||
return true;
|
||||
}
|
||||
|
||||
public Event.SchemaChange changeEvent()
|
||||
{
|
||||
return new Event.SchemaChange(Event.SchemaChange.Change.UPDATED, keyspace());
|
||||
}
|
||||
#endif
|
||||
future<> check_access(const service::client_state& state) override;
|
||||
void validate(distributed<service::storage_proxy>& proxy, const service::client_state& state) override;
|
||||
future<bool> announce_migration(distributed<service::storage_proxy>& proxy, bool is_local_only) override;
|
||||
shared_ptr<transport::event::schema_change> change_event() override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ void cf_prop_defs::apply_to_builder(schema_builder& builder) {
|
||||
}
|
||||
|
||||
std::experimental::optional<sstring> tmp_value = {};
|
||||
if (has_property(KW_MINCOMPACTIONTHRESHOLD)) {
|
||||
if (has_property(KW_COMPACTION)) {
|
||||
if (get_compaction_options().count(KW_MINCOMPACTIONTHRESHOLD)) {
|
||||
tmp_value = get_compaction_options().at(KW_MINCOMPACTIONTHRESHOLD);
|
||||
}
|
||||
@@ -170,7 +170,7 @@ void cf_prop_defs::apply_to_builder(schema_builder& builder) {
|
||||
int min_compaction_threshold = to_int(KW_MINCOMPACTIONTHRESHOLD, tmp_value, builder.get_min_compaction_threshold());
|
||||
|
||||
tmp_value = {};
|
||||
if (has_property(KW_MAXCOMPACTIONTHRESHOLD)) {
|
||||
if (has_property(KW_COMPACTION)) {
|
||||
if (get_compaction_options().count(KW_MAXCOMPACTIONTHRESHOLD)) {
|
||||
tmp_value = get_compaction_options().at(KW_MAXCOMPACTIONTHRESHOLD);
|
||||
}
|
||||
|
||||
@@ -79,6 +79,18 @@ lw_shared_ptr<keyspace_metadata> ks_prop_defs::as_ks_metadata(sstring ks_name) {
|
||||
return keyspace_metadata::new_keyspace(ks_name, get_replication_strategy_class().value(), options, get_boolean(KW_DURABLE_WRITES, true));
|
||||
}
|
||||
|
||||
lw_shared_ptr<keyspace_metadata> ks_prop_defs::as_ks_metadata_update(lw_shared_ptr<keyspace_metadata> old) {
|
||||
auto options = get_replication_options();
|
||||
options.erase(REPLICATION_STRATEGY_CLASS_KEY);
|
||||
auto sc = get_replication_strategy_class();
|
||||
if (!sc) {
|
||||
sc = old->strategy_name();
|
||||
options = old->strategy_options();
|
||||
}
|
||||
return keyspace_metadata::new_keyspace(old->name(), *sc, options, get_boolean(KW_DURABLE_WRITES, true));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@ public:
|
||||
std::map<sstring, sstring> get_replication_options() const;
|
||||
std::experimental::optional<sstring> get_replication_strategy_class() const;
|
||||
lw_shared_ptr<keyspace_metadata> as_ks_metadata(sstring ks_name);
|
||||
lw_shared_ptr<keyspace_metadata> as_ks_metadata_update(lw_shared_ptr<keyspace_metadata> old);
|
||||
|
||||
#if 0
|
||||
public KSMetaData asKSMetadataUpdate(KSMetaData old) throws RequestValidationException
|
||||
|
||||
@@ -221,7 +221,7 @@ select_statement::execute(distributed<service::storage_proxy>& proxy, service::q
|
||||
auto now = db_clock::now();
|
||||
|
||||
auto command = ::make_lw_shared<query::read_command>(_schema->id(), _schema->version(),
|
||||
make_partition_slice(options), limit, to_gc_clock(now));
|
||||
make_partition_slice(options), limit, to_gc_clock(now), options.get_timestamp(state));
|
||||
|
||||
int32_t page_size = options.get_page_size();
|
||||
|
||||
@@ -313,7 +313,7 @@ select_statement::execute_internal(distributed<service::storage_proxy>& proxy, s
|
||||
int32_t limit = get_limit(options);
|
||||
auto now = db_clock::now();
|
||||
auto command = ::make_lw_shared<query::read_command>(_schema->id(), _schema->version(),
|
||||
make_partition_slice(options), limit);
|
||||
make_partition_slice(options), limit, to_gc_clock(now), options.get_timestamp(state));
|
||||
auto partition_ranges = _restrictions->get_partition_key_ranges(options);
|
||||
|
||||
if (needs_post_query_ordering() && _limit) {
|
||||
|
||||
482
database.cc
482
database.cc
@@ -87,6 +87,13 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
lw_shared_ptr<memtable_list>
|
||||
column_family::make_memory_only_memtable_list() {
|
||||
auto seal = [this] { return make_ready_future<>(); };
|
||||
auto get_schema = [this] { return schema(); };
|
||||
return make_lw_shared<memtable_list>(std::move(seal), std::move(get_schema), _config.max_memtable_size, _config.dirty_memory_region_group);
|
||||
}
|
||||
|
||||
lw_shared_ptr<memtable_list>
|
||||
column_family::make_memtable_list() {
|
||||
auto seal = [this] { return seal_active_memtable(); };
|
||||
@@ -101,30 +108,14 @@ column_family::make_streaming_memtable_list() {
|
||||
return make_lw_shared<memtable_list>(std::move(seal), std::move(get_schema), _config.max_streaming_memtable_size, _config.streaming_dirty_memory_region_group);
|
||||
}
|
||||
|
||||
column_family::column_family(schema_ptr schema, config config, db::commitlog& cl, compaction_manager& compaction_manager)
|
||||
column_family::column_family(schema_ptr schema, config config, db::commitlog* cl, compaction_manager& compaction_manager)
|
||||
: _schema(std::move(schema))
|
||||
, _config(std::move(config))
|
||||
, _memtables(make_memtable_list())
|
||||
, _streaming_memtables(_config.enable_disk_writes ? make_streaming_memtable_list() : make_memtable_list())
|
||||
, _memtables(_config.enable_disk_writes ? make_memtable_list() : make_memory_only_memtable_list())
|
||||
, _streaming_memtables(_config.enable_disk_writes ? make_streaming_memtable_list() : make_memory_only_memtable_list())
|
||||
, _sstables(make_lw_shared<sstable_list>())
|
||||
, _cache(_schema, sstables_as_mutation_source(), sstables_as_key_source(), global_cache_tracker())
|
||||
, _commitlog(&cl)
|
||||
, _compaction_manager(compaction_manager)
|
||||
, _flush_queue(std::make_unique<memtable_flush_queue>())
|
||||
{
|
||||
if (!_config.enable_disk_writes) {
|
||||
dblog.warn("Writes disabled, column family no durable.");
|
||||
}
|
||||
}
|
||||
|
||||
column_family::column_family(schema_ptr schema, config config, no_commitlog cl, compaction_manager& compaction_manager)
|
||||
: _schema(std::move(schema))
|
||||
, _config(std::move(config))
|
||||
, _memtables(make_memtable_list())
|
||||
, _streaming_memtables(_config.enable_disk_writes ? make_streaming_memtable_list() : make_memtable_list())
|
||||
, _sstables(make_lw_shared<sstable_list>())
|
||||
, _cache(_schema, sstables_as_mutation_source(), sstables_as_key_source(), global_cache_tracker())
|
||||
, _commitlog(nullptr)
|
||||
, _commitlog(cl)
|
||||
, _compaction_manager(compaction_manager)
|
||||
, _flush_queue(std::make_unique<memtable_flush_queue>())
|
||||
{
|
||||
@@ -147,8 +138,11 @@ column_family::make_partition_presence_checker(lw_shared_ptr<sstable_list> old_s
|
||||
|
||||
mutation_source
|
||||
column_family::sstables_as_mutation_source() {
|
||||
return mutation_source([this] (schema_ptr s, const query::partition_range& r, const io_priority_class& pc) {
|
||||
return make_sstable_reader(std::move(s), r, pc);
|
||||
return mutation_source([this] (schema_ptr s,
|
||||
const query::partition_range& r,
|
||||
query::clustering_key_filtering_context ck_filtering,
|
||||
const io_priority_class& pc) {
|
||||
return make_sstable_reader(std::move(s), r, ck_filtering, pc);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -180,16 +174,23 @@ class range_sstable_reader final : public mutation_reader::impl {
|
||||
// Use a pointer instead of copying, so we don't need to regenerate the reader if
|
||||
// the priority changes.
|
||||
const io_priority_class& _pc;
|
||||
query::clustering_key_filtering_context _ck_filtering;
|
||||
public:
|
||||
range_sstable_reader(schema_ptr s, lw_shared_ptr<sstable_list> sstables, const query::partition_range& pr, const io_priority_class& pc)
|
||||
range_sstable_reader(schema_ptr s,
|
||||
lw_shared_ptr<sstable_list> sstables,
|
||||
const query::partition_range& pr,
|
||||
query::clustering_key_filtering_context ck_filtering,
|
||||
const io_priority_class& pc)
|
||||
: _pr(pr)
|
||||
, _sstables(std::move(sstables))
|
||||
, _pc(pc)
|
||||
, _ck_filtering(ck_filtering)
|
||||
{
|
||||
std::vector<mutation_reader> readers;
|
||||
for (const lw_shared_ptr<sstables::sstable>& sst : *_sstables | boost::adaptors::map_values) {
|
||||
// FIXME: make sstable::read_range_rows() return ::mutation_reader so that we can drop this wrapper.
|
||||
mutation_reader reader = make_mutation_reader<sstable_range_wrapping_reader>(sst, s, pr, pc);
|
||||
mutation_reader reader =
|
||||
make_mutation_reader<sstable_range_wrapping_reader>(sst, s, pr, _ck_filtering, _pc);
|
||||
if (sst->is_shared()) {
|
||||
reader = make_filtering_reader(std::move(reader), belongs_to_current_shard);
|
||||
}
|
||||
@@ -214,22 +215,30 @@ class single_key_sstable_reader final : public mutation_reader::impl {
|
||||
// Use a pointer instead of copying, so we don't need to regenerate the reader if
|
||||
// the priority changes.
|
||||
const io_priority_class& _pc;
|
||||
query::clustering_key_filtering_context _ck_filtering;
|
||||
public:
|
||||
single_key_sstable_reader(schema_ptr schema, lw_shared_ptr<sstable_list> sstables, const partition_key& key, const io_priority_class& pc)
|
||||
single_key_sstable_reader(schema_ptr schema,
|
||||
lw_shared_ptr<sstable_list> sstables,
|
||||
const partition_key& key,
|
||||
query::clustering_key_filtering_context ck_filtering,
|
||||
const io_priority_class& pc)
|
||||
: _schema(std::move(schema))
|
||||
, _key(sstables::key::from_partition_key(*_schema, key))
|
||||
, _sstables(std::move(sstables))
|
||||
, _pc(pc)
|
||||
, _ck_filtering(ck_filtering)
|
||||
{ }
|
||||
|
||||
virtual future<mutation_opt> operator()() override {
|
||||
if (_done) {
|
||||
return make_ready_future<mutation_opt>();
|
||||
}
|
||||
return parallel_for_each(*_sstables | boost::adaptors::map_values, [this](const lw_shared_ptr<sstables::sstable>& sstable) {
|
||||
return sstable->read_row(_schema, _key, _pc).then([this](mutation_opt mo) {
|
||||
apply(_m, std::move(mo));
|
||||
});
|
||||
return parallel_for_each(*_sstables | boost::adaptors::map_values,
|
||||
[this](const lw_shared_ptr<sstables::sstable>& sstable) {
|
||||
return sstable->read_row(_schema, _key, _ck_filtering, _pc)
|
||||
.then([this](mutation_opt mo) {
|
||||
apply(_m, std::move(mo));
|
||||
});
|
||||
}).then([this] {
|
||||
_done = true;
|
||||
return std::move(_m);
|
||||
@@ -238,16 +247,28 @@ public:
|
||||
};
|
||||
|
||||
mutation_reader
|
||||
column_family::make_sstable_reader(schema_ptr s, const query::partition_range& pr, const io_priority_class& pc) const {
|
||||
column_family::make_sstable_reader(schema_ptr s,
|
||||
const query::partition_range& pr,
|
||||
query::clustering_key_filtering_context ck_filtering,
|
||||
const io_priority_class& pc) const {
|
||||
// restricts a reader's concurrency if the configuration specifies it
|
||||
auto restrict_reader = [&] (mutation_reader&& in) {
|
||||
if (_config.read_concurrency_config.sem) {
|
||||
return make_restricted_reader(_config.read_concurrency_config, 1, std::move(in));
|
||||
} else {
|
||||
return std::move(in);
|
||||
}
|
||||
};
|
||||
|
||||
if (pr.is_singular() && pr.start()->value().has_key()) {
|
||||
const dht::ring_position& pos = pr.start()->value();
|
||||
if (dht::shard_of(pos.token()) != engine().cpu_id()) {
|
||||
return make_empty_reader(); // range doesn't belong to this shard
|
||||
}
|
||||
return make_mutation_reader<single_key_sstable_reader>(std::move(s), _sstables, *pos.key(), pc);
|
||||
return restrict_reader(make_mutation_reader<single_key_sstable_reader>(std::move(s), _sstables, *pos.key(), ck_filtering, pc));
|
||||
} else {
|
||||
// range_sstable_reader is not movable so we need to wrap it
|
||||
return make_mutation_reader<range_sstable_reader>(std::move(s), _sstables, pr, pc);
|
||||
return restrict_reader(make_mutation_reader<range_sstable_reader>(std::move(s), _sstables, pr, ck_filtering, pc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,14 +327,17 @@ column_family::find_row(schema_ptr s, const dht::decorated_key& partition_key, c
|
||||
}
|
||||
|
||||
mutation_reader
|
||||
column_family::make_reader(schema_ptr s, const query::partition_range& range, const io_priority_class& pc) const {
|
||||
column_family::make_reader(schema_ptr s,
|
||||
const query::partition_range& range,
|
||||
const query::clustering_key_filtering_context& ck_filtering,
|
||||
const io_priority_class& pc) const {
|
||||
if (query::is_wrap_around(range, *s)) {
|
||||
// make_combined_reader() can't handle streams that wrap around yet.
|
||||
fail(unimplemented::cause::WRAP_AROUND);
|
||||
}
|
||||
|
||||
std::vector<mutation_reader> readers;
|
||||
readers.reserve(_memtables->size() + _sstables->size());
|
||||
readers.reserve(_memtables->size() + 1);
|
||||
|
||||
// We're assuming that cache and memtables are both read atomically
|
||||
// for single-key queries, so we don't need to special case memtable
|
||||
@@ -336,13 +360,13 @@ column_family::make_reader(schema_ptr s, const query::partition_range& range, co
|
||||
// https://github.com/scylladb/scylla/issues/185
|
||||
|
||||
for (auto&& mt : *_memtables) {
|
||||
readers.emplace_back(mt->make_reader(s, range, pc));
|
||||
readers.emplace_back(mt->make_reader(s, range, ck_filtering, pc));
|
||||
}
|
||||
|
||||
if (_config.enable_cache) {
|
||||
readers.emplace_back(_cache.make_reader(s, range, pc));
|
||||
readers.emplace_back(_cache.make_reader(s, range, ck_filtering, pc));
|
||||
} else {
|
||||
readers.emplace_back(make_sstable_reader(s, range, pc));
|
||||
readers.emplace_back(make_sstable_reader(s, range, ck_filtering, pc));
|
||||
}
|
||||
|
||||
return make_combined_reader(std::move(readers));
|
||||
@@ -458,12 +482,6 @@ future<> lister::scan_dir(sstring name, lister::dir_entry_types type, walker_typ
|
||||
});
|
||||
}
|
||||
|
||||
static std::vector<sstring> parse_fname(sstring filename) {
|
||||
std::vector<sstring> comps;
|
||||
boost::split(comps , filename ,boost::is_any_of(".-"));
|
||||
return comps;
|
||||
}
|
||||
|
||||
static bool belongs_to_current_shard(const schema& s, const partition_key& first, const partition_key& last) {
|
||||
auto key_shard = [&s] (const partition_key& pk) {
|
||||
auto token = dht::global_partitioner().get_token(s, pk);
|
||||
@@ -475,12 +493,75 @@ static bool belongs_to_current_shard(const schema& s, const partition_key& first
|
||||
return (s1 <= me) && (me <= s2);
|
||||
}
|
||||
|
||||
static bool belongs_to_other_shard(const schema& s, const partition_key& first, const partition_key& last) {
|
||||
auto key_shard = [&s] (const partition_key& pk) {
|
||||
auto token = dht::global_partitioner().get_token(s, pk);
|
||||
return dht::shard_of(token);
|
||||
};
|
||||
auto s1 = key_shard(first);
|
||||
auto s2 = key_shard(last);
|
||||
auto me = engine().cpu_id();
|
||||
return (s1 != me) || (me != s2);
|
||||
}
|
||||
|
||||
static bool belongs_to_current_shard(const schema& s, range<partition_key> r) {
|
||||
assert(r.start());
|
||||
assert(r.end());
|
||||
return belongs_to_current_shard(s, r.start()->value(), r.end()->value());
|
||||
}
|
||||
|
||||
static bool belongs_to_other_shard(const schema& s, range<partition_key> r) {
|
||||
assert(r.start());
|
||||
assert(r.end());
|
||||
return belongs_to_other_shard(s, r.start()->value(), r.end()->value());
|
||||
}
|
||||
|
||||
future<> column_family::load_sstable(sstables::sstable&& sstab, bool reset_level) {
|
||||
auto sst = make_lw_shared<sstables::sstable>(std::move(sstab));
|
||||
return sst->get_sstable_key_range(*_schema).then([this, sst, reset_level] (range<partition_key> r) mutable {
|
||||
// Checks whether or not sstable belongs to current shard.
|
||||
if (!belongs_to_current_shard(*_schema, r)) {
|
||||
dblog.debug("sstable {} not relevant for this shard, ignoring", sst->get_filename());
|
||||
sst->mark_for_deletion();
|
||||
return make_ready_future<>();
|
||||
}
|
||||
bool in_other_shard = belongs_to_other_shard(*_schema, std::move(r));
|
||||
return sst->load().then([this, sst, in_other_shard, reset_level] () mutable {
|
||||
if (in_other_shard) {
|
||||
// If we're here, this sstable is shared by this and other
|
||||
// shard(s). Shared sstables cannot be deleted until all
|
||||
// shards compacted them, so to reduce disk space usage we
|
||||
// want to start splitting them now.
|
||||
// However, we need to delay this compaction until we read all
|
||||
// the sstables belonging to this CF, because we need all of
|
||||
// them to know which tombstones we can drop, and what
|
||||
// generation number is free.
|
||||
_sstables_need_rewrite.push_back(sst);
|
||||
}
|
||||
if (reset_level) {
|
||||
// When loading a migrated sstable, set level to 0 because
|
||||
// it may overlap with existing tables in levels > 0.
|
||||
// This step is optional, because even if we didn't do this
|
||||
// scylla would detect the overlap, and bring back some of
|
||||
// the sstables to level 0.
|
||||
sst->set_sstable_level(0);
|
||||
}
|
||||
add_sstable(sst);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// load_sstable() wants to start rewriting sstables which are shared between
|
||||
// several shards, but we can't start any compaction before all the sstables
|
||||
// of this CF were loaded. So call this function to start rewrites, if any.
|
||||
void column_family::start_rewrite() {
|
||||
for (auto sst : _sstables_need_rewrite) {
|
||||
dblog.info("Splitting {} for shard", sst->get_filename());
|
||||
_compaction_manager.submit_sstable_rewrite(this, sst);
|
||||
}
|
||||
_sstables_need_rewrite.clear();
|
||||
}
|
||||
|
||||
future<sstables::entry_descriptor> column_family::probe_file(sstring sstdir, sstring fname) {
|
||||
|
||||
using namespace sstables;
|
||||
@@ -505,24 +586,9 @@ future<sstables::entry_descriptor> column_family::probe_file(sstring sstdir, sst
|
||||
}
|
||||
}
|
||||
|
||||
auto sst = std::make_unique<sstables::sstable>(_schema->ks_name(), _schema->cf_name(), sstdir, comps.generation, comps.version, comps.format);
|
||||
auto fut = sst->get_sstable_key_range(*_schema);
|
||||
return std::move(fut).then([this, sst = std::move(sst), sstdir = std::move(sstdir), comps] (range<partition_key> r) mutable {
|
||||
// Checks whether or not sstable belongs to current shard.
|
||||
if (!belongs_to_current_shard(*_schema, std::move(r))) {
|
||||
dblog.debug("sstable {} not relevant for this shard, ignoring",
|
||||
sstables::sstable::filename(sstdir, _schema->ks_name(), _schema->cf_name(), comps.version, comps.generation, comps.format,
|
||||
sstables::sstable::component_type::Data));
|
||||
sstable::mark_sstable_for_deletion(_schema->ks_name(), _schema->cf_name(), sstdir, comps.generation, comps.version, comps.format);
|
||||
return make_ready_future<>();
|
||||
}
|
||||
|
||||
auto fut = sst->load();
|
||||
return std::move(fut).then([this, sst = std::move(sst)] () mutable {
|
||||
add_sstable(std::move(*sst));
|
||||
return make_ready_future<>();
|
||||
});
|
||||
}).then_wrapped([fname, comps] (future<> f) {
|
||||
return load_sstable(sstables::sstable(
|
||||
_schema->ks_name(), _schema->cf_name(), sstdir, comps.generation,
|
||||
comps.version, comps.format)).then_wrapped([fname, comps] (future<> f) {
|
||||
try {
|
||||
f.get();
|
||||
} catch (malformed_sstable_exception& e) {
|
||||
@@ -662,10 +728,6 @@ column_family::seal_active_memtable() {
|
||||
auto old = _memtables->back();
|
||||
dblog.debug("Sealing active memtable, partitions: {}, occupancy: {}", old->partition_count(), old->occupancy());
|
||||
|
||||
if (!_config.enable_disk_writes) {
|
||||
return make_ready_future<>();
|
||||
}
|
||||
|
||||
if (old->empty()) {
|
||||
dblog.debug("Memtable is empty");
|
||||
return make_ready_future<>();
|
||||
@@ -766,6 +828,12 @@ column_family::start() {
|
||||
|
||||
future<>
|
||||
column_family::stop() {
|
||||
// Please note that in here, we shouldn't use the implicit seal function in each memtable's
|
||||
// list. The reason is that for the streaming memtables, the memtable_list's seal function does
|
||||
// not guarantee anything to be immediately flushed, and will set a timer instead (so we can
|
||||
// coalesce writes). During stop, we need to force flushing behavior so we call
|
||||
// seal_active_streaming_memtable() instead. That problem does not exist for memtables and we
|
||||
// could call _memtables->seal_active_memtable() here. We don't, for consistency with streaming.
|
||||
seal_active_memtable();
|
||||
seal_active_streaming_memtable();
|
||||
return _compaction_manager.remove(this).then([this] {
|
||||
@@ -778,6 +846,51 @@ column_family::stop() {
|
||||
});
|
||||
}
|
||||
|
||||
future<std::vector<sstables::entry_descriptor>> column_family::flush_upload_dir() {
|
||||
struct work {
|
||||
sstable_list sstables;
|
||||
std::unordered_map<int64_t, sstables::entry_descriptor> descriptors;
|
||||
std::vector<sstables::entry_descriptor> flushed;
|
||||
};
|
||||
|
||||
return do_with(work(), [this] (work& work) {
|
||||
return lister::scan_dir(_config.datadir + "/upload/", { directory_entry_type::regular },
|
||||
[this, &work] (directory_entry de) {
|
||||
auto comps = sstables::entry_descriptor::make_descriptor(de.name);
|
||||
if (comps.component != sstables::sstable::component_type::TOC) {
|
||||
return make_ready_future<>();
|
||||
}
|
||||
auto sst = make_lw_shared<sstables::sstable>(_schema->ks_name(), _schema->cf_name(),
|
||||
_config.datadir + "/upload", comps.generation,
|
||||
comps.version, comps.format);
|
||||
work.sstables.emplace(comps.generation, std::move(sst));
|
||||
work.descriptors.emplace(comps.generation, std::move(comps));
|
||||
return make_ready_future<>();
|
||||
}, &manifest_json_filter).then([this, &work] {
|
||||
work.flushed.reserve(work.descriptors.size());
|
||||
|
||||
return do_for_each(work.sstables, [this, &work] (auto& pair) {
|
||||
auto gen = this->calculate_generation_for_new_table();
|
||||
auto& sst = pair.second;
|
||||
|
||||
auto&& comps = std::move(work.descriptors.at(pair.first));
|
||||
comps.generation = gen;
|
||||
work.flushed.push_back(std::move(comps));
|
||||
|
||||
// Read toc content as it will be needed for moving and deleting a sstable.
|
||||
return sst->read_toc().then([&sst] {
|
||||
return sst->mutate_sstable_level(0);
|
||||
}).then([this, &sst, gen] {
|
||||
return sst->create_links(_config.datadir, gen);
|
||||
}).then([&sst] {
|
||||
return sstables::remove_by_toc_name(sst->toc_filename());
|
||||
});
|
||||
});
|
||||
}).then([&work] {
|
||||
return make_ready_future<std::vector<sstables::entry_descriptor>>(std::move(work.flushed));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
future<std::vector<sstables::entry_descriptor>>
|
||||
column_family::reshuffle_sstables(std::set<int64_t> all_generations, int64_t start) {
|
||||
@@ -905,6 +1018,12 @@ column_family::rebuild_sstable_list(const std::vector<sstables::shared_sstable>&
|
||||
});
|
||||
_sstables_compacted_but_not_deleted.erase(e, _sstables_compacted_but_not_deleted.end());
|
||||
rebuild_statistics();
|
||||
}).handle_exception([] (std::exception_ptr e) {
|
||||
try {
|
||||
std::rethrow_exception(e);
|
||||
} catch (sstables::atomic_deletion_cancelled& adc) {
|
||||
dblog.debug("Failed to delete sstables after compaction: {}", adc);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -971,19 +1090,14 @@ future<> column_family::cleanup_sstables(sstables::compaction_descriptor descrip
|
||||
future<>
|
||||
column_family::load_new_sstables(std::vector<sstables::entry_descriptor> new_tables) {
|
||||
return parallel_for_each(new_tables, [this] (auto comps) {
|
||||
auto sst = make_lw_shared<sstables::sstable>(_schema->ks_name(), _schema->cf_name(), _config.datadir, comps.generation, comps.version, comps.format);
|
||||
return sst->load().then([this, sst] {
|
||||
return sst->mutate_sstable_level(0);
|
||||
}).then([this, sst] {
|
||||
auto first = sst->get_first_partition_key(*_schema);
|
||||
auto last = sst->get_last_partition_key(*_schema);
|
||||
if (belongs_to_current_shard(*_schema, first, last)) {
|
||||
this->add_sstable(sst);
|
||||
} else {
|
||||
sst->mark_for_deletion();
|
||||
}
|
||||
return make_ready_future<>();
|
||||
});
|
||||
return this->load_sstable(sstables::sstable(
|
||||
_schema->ks_name(), _schema->cf_name(), _config.datadir,
|
||||
comps.generation, comps.version, comps.format), true);
|
||||
}).then([this] {
|
||||
start_rewrite();
|
||||
// Drop entire cache for this column family because it may be populated
|
||||
// with stale data.
|
||||
return get_row_cache().clear();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1034,14 +1148,6 @@ void column_family::set_compaction_strategy(sstables::compaction_strategy_type s
|
||||
_compaction_strategy = make_compaction_strategy(strategy, _schema->compaction_strategy_options());
|
||||
}
|
||||
|
||||
bool column_family::compaction_manager_queued() const {
|
||||
return _compaction_manager_queued;
|
||||
}
|
||||
|
||||
void column_family::set_compaction_manager_queued(bool compaction_manager_queued) {
|
||||
_compaction_manager_queued = compaction_manager_queued;
|
||||
}
|
||||
|
||||
bool column_family::pending_compactions() const {
|
||||
return _stats.pending_compactions > 0;
|
||||
}
|
||||
@@ -1113,7 +1219,12 @@ future<> column_family::populate(sstring sstdir) {
|
||||
return do_with(std::vector<future<>>(), [this, sstdir, verifier, descriptor] (std::vector<future<>>& futures) {
|
||||
return lister::scan_dir(sstdir, { directory_entry_type::regular }, [this, sstdir, verifier, descriptor, &futures] (directory_entry de) {
|
||||
// FIXME: The secondary indexes are in this level, but with a directory type, (starting with ".")
|
||||
auto f = probe_file(sstdir, de.name).then([verifier, descriptor] (auto entry) {
|
||||
auto f = probe_file(sstdir, de.name).then([verifier, descriptor, sstdir] (auto entry) {
|
||||
if (entry.component == sstables::sstable::component_type::TemporaryStatistics) {
|
||||
return remove_file(sstables::sstable::filename(sstdir, entry.ks, entry.cf, entry.version, entry.generation,
|
||||
entry.format, sstables::sstable::component_type::TemporaryStatistics));
|
||||
}
|
||||
|
||||
if (verifier->count(entry.generation)) {
|
||||
if (verifier->at(entry.generation) == status::has_toc_file) {
|
||||
if (entry.component == sstables::sstable::component_type::TOC) {
|
||||
@@ -1143,6 +1254,7 @@ future<> column_family::populate(sstring sstdir) {
|
||||
if (!descriptor->format) {
|
||||
descriptor->format = entry.format;
|
||||
}
|
||||
return make_ready_future<>();
|
||||
});
|
||||
|
||||
// push future returned by probe_file into an array of futures,
|
||||
@@ -1205,8 +1317,7 @@ database::database() : database(db::config())
|
||||
{}
|
||||
|
||||
database::database(const db::config& cfg)
|
||||
: _streaming_dirty_memory_region_group(&_dirty_memory_region_group)
|
||||
, _cfg(std::make_unique<db::config>(cfg))
|
||||
: _cfg(std::make_unique<db::config>(cfg))
|
||||
, _memtable_total_space([this] {
|
||||
_stats = make_lw_shared<db_stats>();
|
||||
|
||||
@@ -1217,6 +1328,7 @@ database::database(const db::config& cfg)
|
||||
return memtable_total_space;
|
||||
}())
|
||||
, _streaming_memtable_total_space(_memtable_total_space / 4)
|
||||
, _streaming_dirty_memory_region_group(&_dirty_memory_region_group)
|
||||
, _version(empty_version)
|
||||
, _enable_incremental_backups(cfg.incremental_backups())
|
||||
, _memtables_throttler(_memtable_total_space, _dirty_memory_region_group)
|
||||
@@ -1225,8 +1337,7 @@ database::database(const db::config& cfg)
|
||||
&_memtables_throttler
|
||||
)
|
||||
{
|
||||
// Start compaction manager with two tasks for handling compaction jobs.
|
||||
_compaction_manager.start(2);
|
||||
_compaction_manager.start();
|
||||
setup_collectd();
|
||||
|
||||
dblog.info("Row: max_vector_size: {}, internal_count: {}", size_t(row::max_vector_size), size_t(row::internal_count));
|
||||
@@ -1269,6 +1380,38 @@ database::setup_collectd() {
|
||||
, "total_operations", "total_reads")
|
||||
, scollectd::make_typed(scollectd::data_type::DERIVE, _stats->total_reads)
|
||||
));
|
||||
|
||||
_collectd.push_back(
|
||||
scollectd::add_polled_metric(scollectd::type_instance_id("database"
|
||||
, scollectd::per_cpu_plugin_instance
|
||||
, "total_operations", "sstable_read_queue_overloads")
|
||||
, scollectd::make_typed(scollectd::data_type::COUNTER, _stats->sstable_read_queue_overloaded)
|
||||
));
|
||||
|
||||
_collectd.push_back(
|
||||
scollectd::add_polled_metric(scollectd::type_instance_id("database"
|
||||
, scollectd::per_cpu_plugin_instance
|
||||
, "queue_length", "active_reads")
|
||||
, scollectd::make_typed(scollectd::data_type::GAUGE, [this] { return max_concurrent_reads() - _read_concurrency_sem.current(); })
|
||||
));
|
||||
_collectd.push_back(
|
||||
scollectd::add_polled_metric(scollectd::type_instance_id("database"
|
||||
, scollectd::per_cpu_plugin_instance
|
||||
, "queue_length", "queued_reads")
|
||||
, scollectd::make_typed(scollectd::data_type::GAUGE, [this] { return _read_concurrency_sem.waiters(); })
|
||||
));
|
||||
_collectd.push_back(
|
||||
scollectd::add_polled_metric(scollectd::type_instance_id("database"
|
||||
, scollectd::per_cpu_plugin_instance
|
||||
, "queue_length", "active_reads_system_keyspace")
|
||||
, scollectd::make_typed(scollectd::data_type::GAUGE, [this] { return max_system_concurrent_reads() - _system_read_concurrency_sem.current(); })
|
||||
));
|
||||
_collectd.push_back(
|
||||
scollectd::add_polled_metric(scollectd::type_instance_id("database"
|
||||
, scollectd::per_cpu_plugin_instance
|
||||
, "queue_length", "queued_reads_system_keyspace")
|
||||
, scollectd::make_typed(scollectd::data_type::GAUGE, [this] { return _system_read_concurrency_sem.waiters(); })
|
||||
));
|
||||
}
|
||||
|
||||
database::~database() {
|
||||
@@ -1287,48 +1430,29 @@ future<> database::populate_keyspace(sstring datadir, sstring ks_name) {
|
||||
auto i = _keyspaces.find(ks_name);
|
||||
if (i == _keyspaces.end()) {
|
||||
dblog.warn("Skipping undefined keyspace: {}", ks_name);
|
||||
return make_ready_future<>();
|
||||
} else {
|
||||
dblog.info("Populating Keyspace {}", ks_name);
|
||||
return lister::scan_dir(ksdir, { directory_entry_type::directory }, [this, ksdir, ks_name] (directory_entry de) {
|
||||
auto comps = parse_fname(de.name);
|
||||
if (comps.size() < 2) {
|
||||
dblog.error("Keyspace {}: Skipping malformed CF {} ", ksdir, de.name);
|
||||
return make_ready_future<>();
|
||||
}
|
||||
|
||||
sstring cfname = comps[0];
|
||||
sstring uuidst = comps[1];
|
||||
|
||||
try {
|
||||
auto&& uuid = [&] {
|
||||
try {
|
||||
return find_uuid(ks_name, cfname);
|
||||
} catch (const std::out_of_range& e) {
|
||||
std::throw_with_nested(no_such_column_family(ks_name, cfname));
|
||||
}
|
||||
}();
|
||||
auto& cf = find_column_family(uuid);
|
||||
|
||||
// #870: Check that the directory name matches
|
||||
// the current, expected UUID of the CF.
|
||||
if (utils::UUID(uuidst) == uuid) {
|
||||
// FIXME: Increase parallelism.
|
||||
auto sstdir = ksdir + "/" + de.name;
|
||||
dblog.info("Keyspace {}: Reading CF {} ", ksdir, cfname);
|
||||
return cf.populate(sstdir);
|
||||
}
|
||||
// Nope. Warn and ignore.
|
||||
dblog.info("Keyspace {}: Skipping obsolete version of CF {} ({})", ksdir, cfname, uuidst);
|
||||
} catch (marshal_exception&) {
|
||||
// Bogus UUID part of directory name
|
||||
dblog.warn("{}, CF {}: malformed UUID: {}. Ignoring", ksdir, comps[0], uuidst);
|
||||
} catch (no_such_column_family&) {
|
||||
dblog.warn("{}, CF {}: schema not loaded!", ksdir, comps[0]);
|
||||
}
|
||||
return make_ready_future<>();
|
||||
});
|
||||
auto& ks = i->second;
|
||||
return parallel_for_each(ks.metadata()->cf_meta_data() | boost::adaptors::map_values,
|
||||
[ks_name, &ks, this] (schema_ptr s) {
|
||||
utils::UUID uuid = s->id();
|
||||
lw_shared_ptr<column_family> cf = _column_families[uuid];
|
||||
sstring cfname = cf->schema()->cf_name();
|
||||
auto sstdir = ks.column_family_directory(cfname, uuid);
|
||||
dblog.info("Keyspace {}: Reading CF {} ", ks_name, cfname);
|
||||
return ks.make_directory_for_column_family(cfname, uuid).then([cf, sstdir] {
|
||||
return cf->populate(sstdir);
|
||||
}).handle_exception([ks_name, cfname, sstdir](std::exception_ptr eptr) {
|
||||
std::string msg =
|
||||
sprint("Exception while populating keyspace '%s' with column family '%s' from file '%s': %s",
|
||||
ks_name, cfname, sstdir, eptr);
|
||||
dblog.error("Exception while populating keyspace '{}' with column family '{}' from file '{}': {}",
|
||||
ks_name, cfname, sstdir, eptr);
|
||||
throw std::runtime_error(msg.c_str());
|
||||
});
|
||||
});
|
||||
}
|
||||
return make_ready_future<>();
|
||||
}
|
||||
|
||||
future<> database::populate(sstring datadir) {
|
||||
@@ -1476,8 +1600,17 @@ void database::add_keyspace(sstring name, keyspace k) {
|
||||
_keyspaces.emplace(std::move(name), std::move(k));
|
||||
}
|
||||
|
||||
void database::update_keyspace(const sstring& name) {
|
||||
throw std::runtime_error("update keyspace not implemented");
|
||||
future<> database::update_keyspace(const sstring& name) {
|
||||
auto& proxy = service::get_storage_proxy();
|
||||
return db::schema_tables::read_schema_partition_for_keyspace(proxy, db::schema_tables::KEYSPACES, name).then([this, name](db::schema_tables::schema_result_value_type&& v) {
|
||||
auto& ks = find_keyspace(name);
|
||||
|
||||
auto tmp_ksm = db::schema_tables::create_keyspace_from_schema_partition(v);
|
||||
auto new_ksm = ::make_lw_shared<keyspace_metadata>(tmp_ksm->name(), tmp_ksm->strategy_name(), tmp_ksm->strategy_options(), tmp_ksm->durable_writes(),
|
||||
boost::copy_range<std::vector<schema_ptr>>(ks.metadata()->cf_meta_data() | boost::adaptors::map_values), ks.metadata()->user_types());
|
||||
ks.update_from(std::move(new_ksm));
|
||||
return service::get_local_migration_manager().notify_update_keyspace(ks.metadata());
|
||||
});
|
||||
}
|
||||
|
||||
void database::drop_keyspace(const sstring& name) {
|
||||
@@ -1631,6 +1764,11 @@ keyspace::set_replication_strategy(std::unique_ptr<locator::abstract_replication
|
||||
_replication_strategy = std::move(replication_strategy);
|
||||
}
|
||||
|
||||
void keyspace::update_from(::lw_shared_ptr<keyspace_metadata> ksm) {
|
||||
_metadata = std::move(ksm);
|
||||
create_replication_strategy(_metadata->strategy_options());
|
||||
}
|
||||
|
||||
column_family::config
|
||||
keyspace::make_column_family_config(const schema& s) const {
|
||||
column_family::config cfg;
|
||||
@@ -1643,6 +1781,7 @@ keyspace::make_column_family_config(const schema& s) const {
|
||||
cfg.max_streaming_memtable_size = _config.max_streaming_memtable_size;
|
||||
cfg.dirty_memory_region_group = _config.dirty_memory_region_group;
|
||||
cfg.streaming_dirty_memory_region_group = _config.streaming_dirty_memory_region_group;
|
||||
cfg.read_concurrency_config = _config.read_concurrency_config;
|
||||
cfg.cf_stats = _config.cf_stats;
|
||||
cfg.enable_incremental_backups = _config.enable_incremental_backups;
|
||||
|
||||
@@ -1658,7 +1797,11 @@ keyspace::column_family_directory(const sstring& name, utils::UUID uuid) const {
|
||||
|
||||
future<>
|
||||
keyspace::make_directory_for_column_family(const sstring& name, utils::UUID uuid) {
|
||||
return io_check(touch_directory, column_family_directory(name, uuid));
|
||||
auto cfdir = column_family_directory(name, uuid);
|
||||
return seastar::async([cfdir = std::move(cfdir)] {
|
||||
io_check(touch_directory, cfdir).get();
|
||||
io_check(touch_directory, cfdir + "/upload").get();
|
||||
});
|
||||
}
|
||||
|
||||
no_such_keyspace::no_such_keyspace(const sstring& ks_name)
|
||||
@@ -1821,6 +1964,7 @@ column_family::query(schema_ptr s, const query::read_command& cmd, query::result
|
||||
auto add_partition = [&qs] (uint32_t live_rows, mutation&& m) {
|
||||
auto pb = qs.builder.add_partition(*qs.schema, m.key());
|
||||
m.partition().query_compacted(pb, *qs.schema, live_rows);
|
||||
qs.limit -= live_rows;
|
||||
};
|
||||
return do_with(querying_reader(qs.schema, as_mutation_source(), range, qs.cmd.slice, qs.limit, qs.cmd.timestamp, add_partition),
|
||||
[] (auto&& rd) { return rd.read(); });
|
||||
@@ -1828,18 +1972,21 @@ column_family::query(schema_ptr s, const query::read_command& cmd, query::result
|
||||
return make_ready_future<lw_shared_ptr<query::result>>(
|
||||
make_lw_shared<query::result>(qs.builder.build()));
|
||||
}).finally([lc, this]() mutable {
|
||||
_stats.reads.mark(lc);
|
||||
if (lc.is_start()) {
|
||||
_stats.estimated_read.add(lc.latency(), _stats.reads.count);
|
||||
}
|
||||
_stats.reads.mark(lc);
|
||||
if (lc.is_start()) {
|
||||
_stats.estimated_read.add(lc.latency(), _stats.reads.hist.count);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
mutation_source
|
||||
column_family::as_mutation_source() const {
|
||||
return mutation_source([this] (schema_ptr s, const query::partition_range& range, const io_priority_class& pc) {
|
||||
return this->make_reader(std::move(s), range, pc);
|
||||
return mutation_source([this] (schema_ptr s,
|
||||
const query::partition_range& range,
|
||||
query::clustering_key_filtering_context ck_filtering,
|
||||
const io_priority_class& pc) {
|
||||
return this->make_reader(std::move(s), range, ck_filtering, pc);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1865,7 +2012,7 @@ std::unordered_set<sstring> database::get_initial_tokens() {
|
||||
std::unordered_set<sstring> tokens;
|
||||
sstring tokens_string = get_config().initial_token();
|
||||
try {
|
||||
boost::split(tokens, tokens_string, boost::is_any_of(sstring(",")));
|
||||
boost::split(tokens, tokens_string, boost::is_any_of(sstring(", ")));
|
||||
} catch (...) {
|
||||
throw std::runtime_error(sprint("Unable to parse initial_token=%s", tokens_string));
|
||||
}
|
||||
@@ -1931,7 +2078,7 @@ column_family::apply(const mutation& m, const db::replay_position& rp) {
|
||||
_memtables->seal_on_overflow();
|
||||
_stats.writes.mark(lc);
|
||||
if (lc.is_start()) {
|
||||
_stats.estimated_write.add(lc.latency(), _stats.writes.count);
|
||||
_stats.estimated_write.add(lc.latency(), _stats.writes.hist.count);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1944,7 +2091,7 @@ column_family::apply(const frozen_mutation& m, const schema_ptr& m_schema, const
|
||||
_memtables->seal_on_overflow();
|
||||
_stats.writes.mark(lc);
|
||||
if (lc.is_start()) {
|
||||
_stats.estimated_write.add(lc.latency(), _stats.writes.count);
|
||||
_stats.estimated_write.add(lc.latency(), _stats.writes.hist.count);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2095,6 +2242,14 @@ database::make_keyspace_config(const keyspace_metadata& ksm) {
|
||||
}
|
||||
cfg.dirty_memory_region_group = &_dirty_memory_region_group;
|
||||
cfg.streaming_dirty_memory_region_group = &_streaming_dirty_memory_region_group;
|
||||
cfg.read_concurrency_config.sem = &_read_concurrency_sem;
|
||||
cfg.read_concurrency_config.timeout = _cfg->read_request_timeout_in_ms() * 1ms;
|
||||
// Assume a queued read takes up 10kB of memory, and allow 2% of memory to be filled up with such reads.
|
||||
cfg.read_concurrency_config.max_queue_length = memory::stats().total_memory() * 0.02 / 10000;
|
||||
cfg.read_concurrency_config.raise_queue_overloaded_exception = [this] {
|
||||
++_stats->sstable_read_queue_overloaded;
|
||||
throw std::runtime_error("sstable inactive read queue overloaded");
|
||||
};
|
||||
cfg.cf_stats = &_cf_stats;
|
||||
cfg.enable_incremental_backups = _enable_incremental_backups;
|
||||
return cfg;
|
||||
@@ -2186,7 +2341,7 @@ future<> database::truncate(const keyspace& ks, column_family& cf, timestamp_fun
|
||||
// gotten all things to disk. Again, need queue-ish or something.
|
||||
f = cf.flush();
|
||||
} else {
|
||||
cf.clear();
|
||||
f = cf.clear();
|
||||
}
|
||||
|
||||
return cf.run_with_compaction_disabled([f = std::move(f), &cf, auto_snapshot, tsf = std::move(tsf)]() mutable {
|
||||
@@ -2522,7 +2677,7 @@ future<> column_family::flush() {
|
||||
// FIXME: this will synchronously wait for this write to finish, but doesn't guarantee
|
||||
// anything about previous writes.
|
||||
_stats.pending_flushes++;
|
||||
return seal_active_memtable().finally([this]() mutable {
|
||||
return _memtables->seal_active_memtable().finally([this]() mutable {
|
||||
_stats.pending_flushes--;
|
||||
// In origin memtable_switch_count is incremented inside
|
||||
// ColumnFamilyMeetrics Flush.run
|
||||
@@ -2544,7 +2699,7 @@ future<> column_family::flush(const db::replay_position& pos) {
|
||||
// We ignore this for now and just say that if we're asked for
|
||||
// a CF and it exists, we pretty much have to have data that needs
|
||||
// flushing. Let's do it.
|
||||
return seal_active_memtable();
|
||||
return _memtables->seal_active_memtable();
|
||||
}
|
||||
|
||||
// FIXME: We can do much better than this in terms of cache management. Right
|
||||
@@ -2561,29 +2716,36 @@ future<> column_family::flush_streaming_mutations(std::vector<query::partition_r
|
||||
// need this code to go away as soon as we can (see FIXME above). So the double gate is a better
|
||||
// temporary counter measure.
|
||||
return with_gate(_streaming_flush_gate, [this, ranges = std::move(ranges)] {
|
||||
return seal_active_streaming_memtable_delayed().finally([this, ranges = std::move(ranges)] {
|
||||
if (_config.enable_cache) {
|
||||
for (auto& range : ranges) {
|
||||
_cache.invalidate(range);
|
||||
}
|
||||
return _streaming_memtables->seal_active_memtable().finally([this, ranges = std::move(ranges)] {
|
||||
if (!_config.enable_cache) {
|
||||
return make_ready_future<>();
|
||||
}
|
||||
return do_with(std::move(ranges), [this] (auto& ranges) {
|
||||
return parallel_for_each(ranges, [this](auto&& range) {
|
||||
return _cache.invalidate(range);
|
||||
});
|
||||
});
|
||||
return do_with(std::move(ranges), [this] (auto& ranges) {
|
||||
return parallel_for_each(ranges, [this](auto&& range) {
|
||||
return _cache.invalidate(range);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void column_family::clear() {
|
||||
_cache.clear();
|
||||
future<> column_family::clear() {
|
||||
_memtables->clear();
|
||||
_memtables->add_memtable();
|
||||
_streaming_memtables->clear();
|
||||
_streaming_memtables->add_memtable();
|
||||
return _cache.clear();
|
||||
}
|
||||
|
||||
// NOTE: does not need to be futurized, but might eventually, depending on
|
||||
// if we implement notifications, whatnot.
|
||||
future<db::replay_position> column_family::discard_sstables(db_clock::time_point truncated_at) {
|
||||
assert(_compaction_disabled > 0);
|
||||
assert(!compaction_manager_queued());
|
||||
|
||||
return with_lock(_sstables_lock.for_read(), [this, truncated_at] {
|
||||
db::replay_position rp;
|
||||
@@ -2603,13 +2765,13 @@ future<db::replay_position> column_family::discard_sstables(db_clock::time_point
|
||||
|
||||
_sstables = std::move(pruned);
|
||||
dblog.debug("cleaning out row cache");
|
||||
_cache.clear();
|
||||
|
||||
return parallel_for_each(remove, [](sstables::shared_sstable s) {
|
||||
return sstables::delete_atomically({s});
|
||||
}).then([rp] {
|
||||
return make_ready_future<db::replay_position>(rp);
|
||||
}).finally([remove] {}); // keep the objects alive until here.
|
||||
return _cache.clear().then([rp, remove = std::move(remove)] () mutable {
|
||||
return parallel_for_each(remove, [](sstables::shared_sstable s) {
|
||||
return sstables::delete_atomically({s});
|
||||
}).then([rp] {
|
||||
return make_ready_future<db::replay_position>(rp);
|
||||
}).finally([remove] {}); // keep the objects alive until here.
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
86
database.hh
86
database.hh
@@ -249,6 +249,7 @@ public:
|
||||
size_t max_streaming_memtable_size = 5'000'000;
|
||||
logalloc::region_group* dirty_memory_region_group = nullptr;
|
||||
logalloc::region_group* streaming_dirty_memory_region_group = nullptr;
|
||||
restricted_mutation_reader_config read_concurrency_config;
|
||||
::cf_stats* cf_stats = nullptr;
|
||||
};
|
||||
struct no_commitlog {};
|
||||
@@ -262,13 +263,13 @@ public:
|
||||
int64_t live_sstable_count = 0;
|
||||
/** Estimated number of compactions pending for this column family */
|
||||
int64_t pending_compactions = 0;
|
||||
utils::ihistogram reads{256};
|
||||
utils::ihistogram writes{256};
|
||||
utils::timed_rate_moving_average_and_histogram reads{256};
|
||||
utils::timed_rate_moving_average_and_histogram writes{256};
|
||||
sstables::estimated_histogram estimated_read;
|
||||
sstables::estimated_histogram estimated_write;
|
||||
sstables::estimated_histogram estimated_sstable_per_read;
|
||||
utils::ihistogram tombstone_scanned;
|
||||
utils::ihistogram live_scanned;
|
||||
utils::timed_rate_moving_average_and_histogram tombstone_scanned;
|
||||
utils::timed_rate_moving_average_and_histogram live_scanned;
|
||||
};
|
||||
|
||||
struct snapshot_details {
|
||||
@@ -300,6 +301,7 @@ private:
|
||||
// server.
|
||||
lw_shared_ptr<memtable_list> _streaming_memtables;
|
||||
|
||||
lw_shared_ptr<memtable_list> make_memory_only_memtable_list();
|
||||
lw_shared_ptr<memtable_list> make_memtable_list();
|
||||
lw_shared_ptr<memtable_list> make_streaming_memtable_list();
|
||||
|
||||
@@ -309,6 +311,11 @@ private:
|
||||
// have not been deleted yet, so must not GC any tombstones in other sstables
|
||||
// that may delete data in these sstables:
|
||||
std::vector<sstables::shared_sstable> _sstables_compacted_but_not_deleted;
|
||||
// sstables that are shared between several shards so we want to rewrite
|
||||
// them (split the data belonging to this shard to a separate sstable),
|
||||
// but for correct compaction we need to start the compaction only after
|
||||
// reading all sstables.
|
||||
std::vector<sstables::shared_sstable> _sstables_need_rewrite;
|
||||
// Control background fibers waiting for sstables to be deleted
|
||||
seastar::gate _sstable_deletion_gate;
|
||||
// There are situations in which we need to stop writing sstables. Flushers will take
|
||||
@@ -322,8 +329,6 @@ private:
|
||||
db::commitlog* _commitlog;
|
||||
sstables::compaction_strategy _compaction_strategy;
|
||||
compaction_manager& _compaction_manager;
|
||||
// Whether or not a cf is queued by its compaction manager.
|
||||
bool _compaction_manager_queued = false;
|
||||
int _compaction_disabled = 0;
|
||||
class memtable_flush_queue;
|
||||
std::unique_ptr<memtable_flush_queue> _flush_queue;
|
||||
@@ -339,6 +344,7 @@ private:
|
||||
void update_stats_for_new_sstable(uint64_t disk_space_used_by_sstable);
|
||||
void add_sstable(sstables::sstable&& sstable);
|
||||
void add_sstable(lw_shared_ptr<sstables::sstable> sstable);
|
||||
future<> load_sstable(sstables::sstable&& sstab, bool reset_level = false);
|
||||
lw_shared_ptr<memtable> new_memtable();
|
||||
lw_shared_ptr<memtable> new_streaming_memtable();
|
||||
future<stop_iteration> try_flush_memtable_to_sstable(lw_shared_ptr<memtable> memt);
|
||||
@@ -369,7 +375,10 @@ private:
|
||||
// Caller needs to ensure that column_family remains live (FIXME: relax this).
|
||||
// The 'range' parameter must be live as long as the reader is used.
|
||||
// Mutations returned by the reader will all have given schema.
|
||||
mutation_reader make_sstable_reader(schema_ptr schema, const query::partition_range& range, const io_priority_class& pc) const;
|
||||
mutation_reader make_sstable_reader(schema_ptr schema,
|
||||
const query::partition_range& range,
|
||||
query::clustering_key_filtering_context ck_filtering,
|
||||
const io_priority_class& pc) const;
|
||||
|
||||
mutation_source sstables_as_mutation_source();
|
||||
key_source sstables_as_key_source() const;
|
||||
@@ -407,6 +416,7 @@ public:
|
||||
// will be scheduled under the priority class given by pc.
|
||||
mutation_reader make_reader(schema_ptr schema,
|
||||
const query::partition_range& range = query::full_partition_range,
|
||||
const query::clustering_key_filtering_context& ck_filtering = query::no_clustering_key_filtering,
|
||||
const io_priority_class& pc = default_priority_class()) const;
|
||||
|
||||
mutation_source as_mutation_source() const;
|
||||
@@ -427,9 +437,13 @@ public:
|
||||
}
|
||||
|
||||
logalloc::occupancy_stats occupancy() const;
|
||||
private:
|
||||
column_family(schema_ptr schema, config cfg, db::commitlog* cl, compaction_manager&);
|
||||
public:
|
||||
column_family(schema_ptr schema, config cfg, db::commitlog& cl, compaction_manager&);
|
||||
column_family(schema_ptr schema, config cfg, no_commitlog, compaction_manager&);
|
||||
column_family(schema_ptr schema, config cfg, db::commitlog& cl, compaction_manager& cm)
|
||||
: column_family(schema, std::move(cfg), &cl, cm) {}
|
||||
column_family(schema_ptr schema, config cfg, no_commitlog, compaction_manager& cm)
|
||||
: column_family(schema, std::move(cfg), nullptr, cm) {}
|
||||
column_family(column_family&&) = delete; // 'this' is being captured during construction
|
||||
~column_family();
|
||||
const schema_ptr& schema() const { return _schema; }
|
||||
@@ -456,7 +470,7 @@ public:
|
||||
future<> flush();
|
||||
future<> flush(const db::replay_position&);
|
||||
future<> flush_streaming_mutations(std::vector<query::partition_range> ranges = std::vector<query::partition_range>{});
|
||||
void clear(); // discards memtable(s) without flushing them to disk.
|
||||
future<> clear(); // discards memtable(s) without flushing them to disk.
|
||||
future<db::replay_position> discard_sstables(db_clock::time_point);
|
||||
|
||||
// Important warning: disabling writes will only have an effect in the current shard.
|
||||
@@ -483,6 +497,17 @@ public:
|
||||
return std::chrono::steady_clock::now() - _sstable_writes_disabled_at;
|
||||
}
|
||||
|
||||
// This function will iterate through upload directory in column family,
|
||||
// and will do the following for each sstable found:
|
||||
// 1) Mutate sstable level to 0.
|
||||
// 2) Create hard links to its components in column family dir.
|
||||
// 3) Remove all of its components in upload directory.
|
||||
// At the end, it's expected that upload dir is empty and all of its
|
||||
// previous content was moved to column family dir.
|
||||
//
|
||||
// Return a vector containing descriptor of sstables to be loaded.
|
||||
future<std::vector<sstables::entry_descriptor>> flush_upload_dir();
|
||||
|
||||
// Make sure the generation numbers are sequential, starting from "start".
|
||||
// Generations before "start" are left untouched.
|
||||
//
|
||||
@@ -546,8 +571,6 @@ public:
|
||||
return _compaction_strategy;
|
||||
}
|
||||
|
||||
bool compaction_manager_queued() const;
|
||||
void set_compaction_manager_queued(bool compaction_manager_queued);
|
||||
bool pending_compactions() const;
|
||||
|
||||
const stats& get_stats() const {
|
||||
@@ -618,6 +641,7 @@ private:
|
||||
future<sstables::entry_descriptor> probe_file(sstring sstdir, sstring fname);
|
||||
void check_valid_rp(const db::replay_position&) const;
|
||||
public:
|
||||
void start_rewrite();
|
||||
// Iterate over all partitions. Protocol is the same as std::all_of(),
|
||||
// so that iteration can be stopped by returning false.
|
||||
future<bool> for_all_partitions_slow(schema_ptr, std::function<bool (const dht::decorated_key&, const mutation_partition&)> func) const;
|
||||
@@ -727,6 +751,7 @@ public:
|
||||
size_t max_streaming_memtable_size = 5'000'000;
|
||||
logalloc::region_group* dirty_memory_region_group = nullptr;
|
||||
logalloc::region_group* streaming_dirty_memory_region_group = nullptr;
|
||||
restricted_mutation_reader_config read_concurrency_config;
|
||||
::cf_stats* cf_stats = nullptr;
|
||||
};
|
||||
private:
|
||||
@@ -738,10 +763,24 @@ public:
|
||||
: _metadata(std::move(metadata))
|
||||
, _config(std::move(cfg))
|
||||
{}
|
||||
const lw_shared_ptr<keyspace_metadata>& metadata() const {
|
||||
|
||||
void update_from(lw_shared_ptr<keyspace_metadata>);
|
||||
|
||||
/** Note: return by shared pointer value, since the meta data is
|
||||
* semi-volatile. I.e. we could do alter keyspace at any time, and
|
||||
* boom, it is replaced.
|
||||
*/
|
||||
lw_shared_ptr<keyspace_metadata> metadata() const {
|
||||
return _metadata;
|
||||
}
|
||||
void create_replication_strategy(const std::map<sstring, sstring>& options);
|
||||
/**
|
||||
* This should not really be return by reference, since replication
|
||||
* strategy is also volatile in that it could be replaced at "any" time.
|
||||
* However, all current uses at least are "instantateous", i.e. does not
|
||||
* carry it across a continuation. So it is sort of same for now, but
|
||||
* should eventually be refactored.
|
||||
*/
|
||||
locator::abstract_replication_strategy& get_replication_strategy();
|
||||
const locator::abstract_replication_strategy& get_replication_strategy() const;
|
||||
column_family::config make_column_family_config(const schema& s) const;
|
||||
@@ -770,7 +809,7 @@ public:
|
||||
const sstring& datadir() const {
|
||||
return _config.datadir;
|
||||
}
|
||||
private:
|
||||
|
||||
sstring column_family_directory(const sstring& name, utils::UUID uuid) const;
|
||||
};
|
||||
|
||||
@@ -792,22 +831,30 @@ public:
|
||||
|
||||
class database {
|
||||
::cf_stats _cf_stats;
|
||||
static constexpr size_t max_concurrent_reads() { return 100; }
|
||||
static constexpr size_t max_system_concurrent_reads() { return 10; }
|
||||
struct db_stats {
|
||||
uint64_t total_writes = 0;
|
||||
uint64_t total_reads = 0;
|
||||
uint64_t sstable_read_queue_overloaded = 0;
|
||||
};
|
||||
|
||||
lw_shared_ptr<db_stats> _stats;
|
||||
|
||||
std::unique_ptr<db::config> _cfg;
|
||||
size_t _memtable_total_space = 500 << 20;
|
||||
size_t _streaming_memtable_total_space = 500 << 20;
|
||||
logalloc::region_group _dirty_memory_region_group;
|
||||
logalloc::region_group _streaming_dirty_memory_region_group;
|
||||
semaphore _read_concurrency_sem{max_concurrent_reads()};
|
||||
restricted_mutation_reader_config _read_concurrency_config;
|
||||
semaphore _system_read_concurrency_sem{max_system_concurrent_reads()};
|
||||
restricted_mutation_reader_config _system_read_concurrency_config;
|
||||
|
||||
std::unordered_map<sstring, keyspace> _keyspaces;
|
||||
std::unordered_map<utils::UUID, lw_shared_ptr<column_family>> _column_families;
|
||||
std::unordered_map<std::pair<sstring, sstring>, utils::UUID, utils::tuple_hash> _ks_cf_to_uuid;
|
||||
std::unique_ptr<db::commitlog> _commitlog;
|
||||
std::unique_ptr<db::config> _cfg;
|
||||
size_t _memtable_total_space = 500 << 20;
|
||||
size_t _streaming_memtable_total_space = 500 << 20;
|
||||
utils::UUID _version;
|
||||
// compaction_manager object is referenced by all column families of a database.
|
||||
compaction_manager _compaction_manager;
|
||||
@@ -876,7 +923,7 @@ public:
|
||||
keyspace& find_keyspace(const sstring& name);
|
||||
const keyspace& find_keyspace(const sstring& name) const;
|
||||
bool has_keyspace(const sstring& name) const;
|
||||
void update_keyspace(const sstring& name);
|
||||
future<> update_keyspace(const sstring& name);
|
||||
void drop_keyspace(const sstring& name);
|
||||
const auto& keyspaces() const { return _keyspaces; }
|
||||
std::vector<sstring> get_non_system_keyspaces() const;
|
||||
@@ -948,6 +995,9 @@ public:
|
||||
std::unordered_set<sstring> get_initial_tokens();
|
||||
std::experimental::optional<gms::inet_address> get_replace_address();
|
||||
bool is_replacing();
|
||||
semaphore& system_keyspace_read_concurrency_sem() {
|
||||
return _system_read_concurrency_sem;
|
||||
}
|
||||
};
|
||||
|
||||
// FIXME: stub
|
||||
|
||||
@@ -324,6 +324,7 @@ public:
|
||||
val(sstable_preemptive_open_interval_in_mb, uint32_t, 50, Unused, \
|
||||
"When compacting, the replacement opens SSTables before they are completely written and uses in place of the prior SSTables for any range previously written. This setting helps to smoothly transfer reads between the SSTables by reducing page cache churn and keeps hot rows hot." \
|
||||
) \
|
||||
val(defragment_memory_on_idle, bool, true, Used, "Set to true to defragment memory when the cpu is idle. This reduces the amount of work Scylla performs when processing client requests.") \
|
||||
/* Memtable settings */ \
|
||||
val(memtable_allocation_type, sstring, "heap_buffers", Invalid, \
|
||||
"Specify the way Cassandra allocates and manages memtable memory. See Off-heap memtables in Cassandra 2.1. Options are:\n" \
|
||||
@@ -712,17 +713,17 @@ public:
|
||||
val(api_ui_dir, sstring, "swagger-ui/dist/", Used, "The directory location of the API GUI") \
|
||||
val(api_doc_dir, sstring, "api/api-doc/", Used, "The API definition file directory") \
|
||||
val(load_balance, sstring, "none", Used, "CQL request load balancing: 'none' or round-robin'") \
|
||||
val(consistent_rangemovement, bool, true, Used, "When set to true, range movements will be consistent. It means: 1) it will refuse to bootstrapp a new node if other bootstrapping/leaving/moving nodes detected. 2) data will be streamed to a new node only from the node which is no longer responsible for the token range. Same as -Dcassandra.consistent.rangemovement in cassandra") \
|
||||
val(consistent_rangemovement, bool, true, Used, "When set to true, range movements will be consistent. It means: 1) it will refuse to bootstrap a new node if other bootstrapping/leaving/moving nodes detected. 2) data will be streamed to a new node only from the node which is no longer responsible for the token range. Same as -Dcassandra.consistent.rangemovement in cassandra") \
|
||||
val(join_ring, bool, true, Used, "When set to true, a node will join the token ring. When set to false, a node will not join the token ring. User can use nodetool join to initiate ring joinging later. Same as -Dcassandra.join_ring in cassandra.") \
|
||||
val(load_ring_state, bool, true, Used, "When set to true, load tokens and host_ids previously saved. Same as -Dcassandra.load_ring_state in cassandra.") \
|
||||
val(replace_node, sstring, "", Used, "The UUID of the node to replace. Same as -Dcassandra.replace_node in cssandra.") \
|
||||
val(replace_token, sstring, "", Used, "The tokens of the node to replace. Same as -Dcassandra.replace_token in cassandra.") \
|
||||
val(replace_address, sstring, "", Used, "The listen_address or broadcast_address of the dead node to replace. Same as -Dcassandra.replace_address.") \
|
||||
val(replace_address_first_boot, sstring, "", Used, "Like replace_address option, but if the node has been bootstrapped sucessfully it will be ignored. Same as -Dcassandra.replace_address_first_boot.") \
|
||||
val(replace_address_first_boot, sstring, "", Used, "Like replace_address option, but if the node has been bootstrapped successfully it will be ignored. Same as -Dcassandra.replace_address_first_boot.") \
|
||||
val(override_decommission, bool, false, Used, "Set true to force a decommissioned node to join the cluster") \
|
||||
val(ring_delay_ms, uint32_t, 30 * 1000, Used, "Time a node waits to hear from other nodes before joining the ring in milliseconds. Same as -Dcassandra.ring_delay_ms in cassandra.") \
|
||||
val(shutdown_announce_in_ms, uint32_t, 2 * 1000, Used, "Time a node waits after sending gossip shutdown message in milliseconds. Same as -Dcassandra.shutdown_announce_in_ms in cassandra.") \
|
||||
val(developer_mode, bool, false, Used, "Relax environement checks. Setting to true can reduce performance and reliability significantly.") \
|
||||
val(developer_mode, bool, false, Used, "Relax environment checks. Setting to true can reduce performance and reliability significantly.") \
|
||||
val(skip_wait_for_gossip_to_settle, int32_t, -1, Used, "An integer to configure the wait for gossip to settle. -1: wait normally, 0: do not wait at all, n: wait for at most n polls. Same as -Dcassandra.skip_wait_for_gossip_to_settle in cassandra.") \
|
||||
val(experimental, bool, false, Used, "Set to true to unlock experimental features.") \
|
||||
/* done! */
|
||||
|
||||
@@ -674,17 +674,19 @@ future<std::set<sstring>> merge_keyspaces(distributed<service::storage_proxy>& p
|
||||
for (auto&& key : diff.entries_differing) {
|
||||
altered.emplace_back(key);
|
||||
}
|
||||
return do_with(std::move(created), [&proxy, altered = std::move(altered)] (auto& created) {
|
||||
return proxy.local().get_db().invoke_on_all([&created, altered = std::move(altered)] (database& db) {
|
||||
return do_for_each(created, [&db](auto&& val) {
|
||||
auto ksm = create_keyspace_from_schema_partition(val);
|
||||
return db.create_keyspace(ksm).then([ksm] {
|
||||
return service::get_local_migration_manager().notify_create_keyspace(ksm);
|
||||
return do_with(std::move(created), [&proxy, altered = std::move(altered)] (auto& created) mutable {
|
||||
return do_with(std::move(altered), [&proxy, &created](auto& altered) {
|
||||
return proxy.local().get_db().invoke_on_all([&created, &altered] (database& db) {
|
||||
return do_for_each(created, [&db](auto&& val) {
|
||||
auto ksm = create_keyspace_from_schema_partition(val);
|
||||
return db.create_keyspace(ksm).then([ksm] {
|
||||
return service::get_local_migration_manager().notify_create_keyspace(ksm);
|
||||
});
|
||||
}).then([&altered, &db]() {
|
||||
return do_for_each(altered, [&db](auto& name) {
|
||||
return db.update_keyspace(name);
|
||||
});
|
||||
});
|
||||
}).then([&altered, &db] () mutable {
|
||||
for (auto&& name : altered) {
|
||||
db.update_keyspace(name);
|
||||
}
|
||||
});
|
||||
});
|
||||
}).then([dropped = std::move(dropped)] () {
|
||||
@@ -709,15 +711,21 @@ static void merge_tables(distributed<service::storage_proxy>& proxy,
|
||||
std::map<qualified_name, schema_mutations>&& before,
|
||||
std::map<qualified_name, schema_mutations>&& after)
|
||||
{
|
||||
struct dropped_table {
|
||||
global_schema_ptr schema;
|
||||
utils::joinpoint<db_clock::time_point> jp{[] {
|
||||
return make_ready_future<db_clock::time_point>(db_clock::now());
|
||||
}};
|
||||
};
|
||||
std::vector<global_schema_ptr> created;
|
||||
std::vector<global_schema_ptr> altered;
|
||||
std::vector<global_schema_ptr> dropped;
|
||||
std::vector<dropped_table> dropped;
|
||||
|
||||
auto diff = difference(before, after);
|
||||
for (auto&& key : diff.entries_only_on_left) {
|
||||
auto&& s = proxy.local().get_db().local().find_schema(key.keyspace_name, key.table_name);
|
||||
logger.info("Dropping {}.{} id={} version={}", s->ks_name(), s->cf_name(), s->id(), s->version());
|
||||
dropped.emplace_back(s);
|
||||
dropped.emplace_back(dropped_table{s});
|
||||
}
|
||||
for (auto&& key : diff.entries_only_on_right) {
|
||||
auto s = create_table_from_mutations(after.at(key));
|
||||
@@ -730,9 +738,7 @@ static void merge_tables(distributed<service::storage_proxy>& proxy,
|
||||
altered.emplace_back(s);
|
||||
}
|
||||
|
||||
do_with(utils::make_joinpoint([] { return db_clock::now();})
|
||||
, [&created, &dropped, &altered, &proxy](auto& tsf) {
|
||||
return proxy.local().get_db().invoke_on_all([&created, &dropped, &altered, &tsf] (database& db) {
|
||||
proxy.local().get_db().invoke_on_all([&created, &dropped, &altered] (database& db) {
|
||||
return seastar::async([&] {
|
||||
for (auto&& gs : created) {
|
||||
schema_ptr s = gs.get();
|
||||
@@ -747,14 +753,13 @@ static void merge_tables(distributed<service::storage_proxy>& proxy,
|
||||
for (auto&& gs : altered) {
|
||||
update_column_family(db, gs.get()).get();
|
||||
}
|
||||
parallel_for_each(dropped.begin(), dropped.end(), [&db, &tsf](auto&& gs) {
|
||||
schema_ptr s = gs.get();
|
||||
return db.drop_column_family(s->ks_name(), s->cf_name(), [&tsf] { return tsf.value(); }).then([s] {
|
||||
parallel_for_each(dropped.begin(), dropped.end(), [&db](dropped_table& dt) {
|
||||
schema_ptr s = dt.schema.get();
|
||||
return db.drop_column_family(s->ks_name(), s->cf_name(), [&dt] { return dt.jp.value(); }).then([s] {
|
||||
return service::get_local_migration_manager().notify_drop_column_family(s);
|
||||
});
|
||||
}).get();
|
||||
});
|
||||
});
|
||||
}).get();
|
||||
}
|
||||
|
||||
|
||||
@@ -1022,6 +1022,10 @@ void make(database& db, bool durable, bool volatile_testing_only) {
|
||||
kscfg.enable_disk_writes = !volatile_testing_only;
|
||||
kscfg.enable_commitlog = !volatile_testing_only;
|
||||
kscfg.enable_cache = true;
|
||||
// don't make system keyspace reads wait for user reads
|
||||
kscfg.read_concurrency_config.sem = &db.system_keyspace_read_concurrency_sem();
|
||||
kscfg.read_concurrency_config.timeout = {};
|
||||
kscfg.read_concurrency_config.max_queue_length = std::numeric_limits<size_t>::max();
|
||||
keyspace _ks{ksm, std::move(kscfg)};
|
||||
auto rs(locator::abstract_replication_strategy::create_replication_strategy(NAME, "LocalStrategy", service::get_local_storage_service().get_token_metadata(), ksm->strategy_options()));
|
||||
_ks.set_replication_strategy(std::move(rs));
|
||||
|
||||
@@ -87,6 +87,10 @@ public:
|
||||
// [0x00, 0x80] == 1/512
|
||||
// [0xff, 0x80] == 1 - 1/512
|
||||
managed_bytes _data;
|
||||
|
||||
token() : _kind(kind::before_all_keys) {
|
||||
}
|
||||
|
||||
token(kind k, managed_bytes d) : _kind(std::move(k)), _data(std::move(d)) {
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,8 @@ extern thread_local disk_error_signal_type sstable_read_error;
|
||||
extern thread_local disk_error_signal_type sstable_write_error;
|
||||
extern thread_local disk_error_signal_type general_disk_error;
|
||||
|
||||
bool should_stop_on_system_error(const std::system_error& e);
|
||||
|
||||
template<typename Func, typename... Args>
|
||||
std::enable_if_t<!is_future<std::result_of_t<Func(Args&&...)>>::value,
|
||||
std::result_of_t<Func(Args&&...)>>
|
||||
@@ -44,7 +46,7 @@ do_io_check(disk_error_signal_type& signal, Func&& func, Args&&... args) {
|
||||
// calling function
|
||||
return func(std::forward<Args>(args)...);
|
||||
} catch (std::system_error& e) {
|
||||
if (is_system_error_errno(EIO)) {
|
||||
if (should_stop_on_system_error(e)) {
|
||||
signal();
|
||||
throw storage_io_error(e);
|
||||
}
|
||||
@@ -62,7 +64,7 @@ auto do_io_check(disk_error_signal_type& signal, Func&& func, Args&&... args) {
|
||||
try {
|
||||
std::rethrow_exception(ep);
|
||||
} catch (std::system_error& sys_err) {
|
||||
if (is_system_error_errno(EIO)) {
|
||||
if (should_stop_on_system_error(sys_err)) {
|
||||
signal();
|
||||
throw storage_io_error(sys_err);
|
||||
}
|
||||
@@ -70,7 +72,7 @@ auto do_io_check(disk_error_signal_type& signal, Func&& func, Args&&... args) {
|
||||
return futurize<std::result_of_t<Func(Args&&...)>>::make_exception_future(ep);
|
||||
});
|
||||
} catch (std::system_error& e) {
|
||||
if (is_system_error_errno(EIO)) {
|
||||
if (should_stop_on_system_error(e)) {
|
||||
signal();
|
||||
throw storage_io_error(e);
|
||||
}
|
||||
|
||||
14
dist/ami/build_ami.sh
vendored
14
dist/ami/build_ami.sh
vendored
@@ -6,9 +6,9 @@ if [ ! -e dist/ami/build_ami.sh ]; then
|
||||
fi
|
||||
|
||||
print_usage() {
|
||||
echo "build_ami.sh --localrpm --unstable"
|
||||
echo "build_ami.sh --localrpm --repo [URL]"
|
||||
echo " --localrpm deploy locally built rpms"
|
||||
echo " --unstable use unstable branch"
|
||||
echo " --repo specify repository URL"
|
||||
exit 1
|
||||
}
|
||||
LOCALRPM=0
|
||||
@@ -19,9 +19,9 @@ while [ $# -gt 0 ]; do
|
||||
INSTALL_ARGS="$INSTALL_ARGS --localrpm"
|
||||
shift 1
|
||||
;;
|
||||
"--unstable")
|
||||
INSTALL_ARGS="$INSTALL_ARGS --unstable"
|
||||
shift 1
|
||||
"--repo")
|
||||
INSTALL_ARGS="$INSTALL_ARGS --repo $2"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
print_usage
|
||||
@@ -52,8 +52,9 @@ if [ $LOCALRPM -eq 1 ]; then
|
||||
if [ "$ID" = "centos" ]; then
|
||||
rm -rf build/*
|
||||
sudo yum -y install git
|
||||
if [ ! -f dist/ami/files/scylla-server.x86_64.rpm ]; then
|
||||
if [ ! -f dist/ami/files/scylla-conf.x86_64.rpm ] || [ ! -f dist/ami/files/scylla-server.x86_64.rpm ]; then
|
||||
dist/redhat/build_rpm.sh
|
||||
cp build/rpmbuild/RPMS/x86_64/scylla-conf-`cat build/SCYLLA-VERSION-FILE`-`cat build/SCYLLA-RELEASE-FILE`.*.x86_64.rpm dist/ami/files/scylla-conf.x86_64.rpm
|
||||
cp build/rpmbuild/RPMS/x86_64/scylla-server-`cat build/SCYLLA-VERSION-FILE`-`cat build/SCYLLA-RELEASE-FILE`.*.x86_64.rpm dist/ami/files/scylla-server.x86_64.rpm
|
||||
fi
|
||||
if [ ! -f dist/ami/files/scylla-jmx.noarch.rpm ]; then
|
||||
@@ -79,6 +80,7 @@ if [ $LOCALRPM -eq 1 ]; then
|
||||
echo "Build .deb before running build_ami.sh"
|
||||
exit 1
|
||||
fi
|
||||
cp ../scylla-conf_`cat build/SCYLLA-VERSION-FILE | sed 's/\.rc/~rc/'`-`cat build/SCYLLA-RELEASE-FILE`-ubuntu1_amd64.deb dist/ami/files/scylla-conf_amd64.deb
|
||||
cp ../scylla-server_`cat build/SCYLLA-VERSION-FILE | sed 's/\.rc/~rc/'`-`cat build/SCYLLA-RELEASE-FILE`-ubuntu1_amd64.deb dist/ami/files/scylla-server_amd64.deb
|
||||
fi
|
||||
if [ ! -f dist/ami/files/scylla-jmx_all.deb ]; then
|
||||
|
||||
2
dist/ami/files/scylla-ami
vendored
2
dist/ami/files/scylla-ami
vendored
Submodule dist/ami/files/scylla-ami updated: 7019088d7b...863cc4598a
5
dist/common/dep/scylla-env-1.0/debian/changelog
vendored
Normal file
5
dist/common/dep/scylla-env-1.0/debian/changelog
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
scylla-env (1.0-ubuntu1) trusty; urgency=medium
|
||||
|
||||
* Initial release.
|
||||
|
||||
-- Takuya ASADA <syuu@scylladb.com> Mon, 09 May 2016 18:32:52 +0000
|
||||
1
dist/common/dep/scylla-env-1.0/debian/compat
vendored
Normal file
1
dist/common/dep/scylla-env-1.0/debian/compat
vendored
Normal file
@@ -0,0 +1 @@
|
||||
9
|
||||
12
dist/common/dep/scylla-env-1.0/debian/control
vendored
Normal file
12
dist/common/dep/scylla-env-1.0/debian/control
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
Source: scylla-env
|
||||
Maintainer: Takuya ASADA <syuu@scylladb.com>
|
||||
Section: misc
|
||||
Priority: optional
|
||||
Standards-Version: 1.0
|
||||
Build-Depends: debhelper (>= 9)
|
||||
|
||||
Package: scylla-env
|
||||
Architecture: all
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Description: language tool for constructing recognizers, compilers etc
|
||||
A language tool that provides a framework for constructing recognizers, interpreters, compilers, and translators from grammatical descriptions containing actions in a variety of target languages.
|
||||
676
dist/common/dep/scylla-env-1.0/debian/copyright
vendored
Normal file
676
dist/common/dep/scylla-env-1.0/debian/copyright
vendored
Normal file
@@ -0,0 +1,676 @@
|
||||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: ScyllaDB
|
||||
Upstream-Contact: http://www.scylladb.com/
|
||||
Source: https://github.com/scylladb/scylla
|
||||
|
||||
Files: *
|
||||
Copyright: Copyright (c) 2016 ScyllaDB
|
||||
License: AGPL-3.0
|
||||
|
||||
Files: debian/*
|
||||
Copyright: Copyright (c) 2016 ScyllaDB
|
||||
License: AGPL-3.0
|
||||
|
||||
License: AGPL-3.0
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
.
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
.
|
||||
Preamble
|
||||
.
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
.
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
.
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
.
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
.
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
.
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
.
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
.
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
.
|
||||
TERMS AND CONDITIONS
|
||||
.
|
||||
0. Definitions.
|
||||
.
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
.
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
.
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
.
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
.
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
.
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
.
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
.
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
.
|
||||
1. Source Code.
|
||||
.
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
.
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
.
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
.
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
.
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
.
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
.
|
||||
2. Basic Permissions.
|
||||
.
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
.
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
.
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
.
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
.
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
.
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
.
|
||||
4. Conveying Verbatim Copies.
|
||||
.
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
.
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
.
|
||||
5. Conveying Modified Source Versions.
|
||||
.
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
.
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
.
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
.
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
.
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
.
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
.
|
||||
6. Conveying Non-Source Forms.
|
||||
.
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
.
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
.
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
.
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
.
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
.
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
.
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
.
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
.
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
.
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
.
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
.
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
.
|
||||
7. Additional Terms.
|
||||
.
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
.
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
.
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
.
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
.
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
.
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
.
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
.
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
.
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
.
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
.
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
.
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
.
|
||||
8. Termination.
|
||||
.
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
.
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
.
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
.
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
.
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
.
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
.
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
.
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
.
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
.
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
.
|
||||
11. Patents.
|
||||
.
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
.
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
.
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
.
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
.
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
.
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
.
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
.
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
.
|
||||
12. No Surrender of Others' Freedom.
|
||||
.
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
.
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
.
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
.
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
.
|
||||
14. Revised Versions of this License.
|
||||
.
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
.
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
.
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
.
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
.
|
||||
15. Disclaimer of Warranty.
|
||||
.
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
.
|
||||
16. Limitation of Liability.
|
||||
.
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
.
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
.
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
.
|
||||
END OF TERMS AND CONDITIONS
|
||||
.
|
||||
How to Apply These Terms to Your New Programs
|
||||
.
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
.
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
.
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
.
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
.
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
.
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
.
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
2
dist/common/dep/scylla-env-1.0/debian/install
vendored
Normal file
2
dist/common/dep/scylla-env-1.0/debian/install
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
profile.d/* etc/profile.d
|
||||
ld.so.conf.d/* /etc/ld.so.conf.d
|
||||
7
dist/common/dep/scylla-env-1.0/debian/postinst
vendored
Normal file
7
dist/common/dep/scylla-env-1.0/debian/postinst
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
ldconfig
|
||||
|
||||
#DEBHELPER#
|
||||
4
dist/common/dep/scylla-env-1.0/debian/rules
vendored
Executable file
4
dist/common/dep/scylla-env-1.0/debian/rules
vendored
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
%:
|
||||
dh $@
|
||||
54
dist/common/scripts/scylla_config_get.py
vendored
Executable file
54
dist/common/scripts/scylla_config_get.py
vendored
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/python
|
||||
#
|
||||
# Copyright 2016 ScyllaDB
|
||||
#
|
||||
|
||||
#
|
||||
# This file is part of Scylla.
|
||||
#
|
||||
# Scylla is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Scylla is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Scylla. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
import yaml
|
||||
import argparse
|
||||
|
||||
def get(config, key):
|
||||
s = open(config).read()
|
||||
cfg = yaml.load(s)
|
||||
try:
|
||||
val = cfg[key]
|
||||
except KeyError:
|
||||
print "key '%s' not found" % key
|
||||
sys.exit(1)
|
||||
if isinstance(val, list):
|
||||
for v in val:
|
||||
print "%s" % v
|
||||
elif isinstance(val, dict):
|
||||
for k, v in val.items():
|
||||
print "%s:%s" % (k, v)
|
||||
else:
|
||||
print val
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='scylla.yaml config reader/writer from shellscript.')
|
||||
parser.add_argument('-c', '--config', dest='config', action='store',
|
||||
default='/etc/scylla/scylla.yaml',
|
||||
help='path to scylla.yaml')
|
||||
parser.add_argument('-g', '--get', dest='get', action='store',
|
||||
required=True, help='get parameter')
|
||||
args = parser.parse_args()
|
||||
get(args.config, args.get)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
42
dist/common/scripts/scylla_cpuset_setup
vendored
Executable file
42
dist/common/scripts/scylla_cpuset_setup
vendored
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash -e
|
||||
#
|
||||
# Copyright (C) 2016 ScyllaDB
|
||||
|
||||
print_usage() {
|
||||
echo "scylla_cpuset_setup --cpuset 1-7 --smp 7"
|
||||
echo " --cpuset CPUs to use (in cpuset(7) format; default: all))"
|
||||
echo " --smp number of threads (default: one per CPU)"
|
||||
exit 1
|
||||
}
|
||||
|
||||
CPUSET=
|
||||
SMP=
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
"--cpuset")
|
||||
CPUSET=$2
|
||||
shift 2
|
||||
;;
|
||||
"--smp")
|
||||
SMP=$2
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
print_usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$CPUSET" = "" ] && [ "$SMP" = "" ]; then
|
||||
print_usage
|
||||
fi
|
||||
|
||||
OUT="CPUSET=\""
|
||||
if [ "$CPUSET" != "" ]; then
|
||||
OUT="$OUT--cpuset $CPUSET "
|
||||
fi
|
||||
if [ "$SMP" != "" ]; then
|
||||
OUT="$OUT--smp $SMP "
|
||||
fi
|
||||
OUT="$OUT\""
|
||||
echo $OUT > /etc/scylla.d/cpuset.conf
|
||||
27
dist/common/scripts/scylla_io_setup
vendored
27
dist/common/scripts/scylla_io_setup
vendored
@@ -1,5 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
. /etc/os-release
|
||||
if [ "$ID" = "ubuntu" ]; then
|
||||
. /etc/default/scylla-server
|
||||
else
|
||||
. /etc/sysconfig/scylla-server
|
||||
fi
|
||||
for i in /etc/scylla.d/*.conf; do
|
||||
if [ "$i" = "/etc/scylla.d/*.conf" ]; then
|
||||
break
|
||||
fi
|
||||
. "$i"
|
||||
done
|
||||
|
||||
print_usage() {
|
||||
echo "scylla_io_setup --ami"
|
||||
echo " --ami setup AMI instance"
|
||||
@@ -30,16 +43,9 @@ output_to_user()
|
||||
logger -p user.err "$1"
|
||||
}
|
||||
|
||||
. /etc/os-release
|
||||
if [ "$NAME" = "Ubuntu" ]; then
|
||||
. /etc/default/scylla-server
|
||||
else
|
||||
. /etc/sysconfig/scylla-server
|
||||
fi
|
||||
|
||||
if [ `is_developer_mode` -eq 0 ]; then
|
||||
SMP=`echo $SCYLLA_ARGS|grep smp|sed -e "s/^.*smp\(\s\+\|=\)\([0-9]*\).*$/\2/"`
|
||||
CPUSET=`echo $SCYLLA_ARGS|grep cpuset|sed -e "s/^.*\(--cpuset\(\s\+\|=\)[0-9\-]*\).*$/\1/"`
|
||||
SMP=`echo $CPUSET|grep smp|sed -e "s/^.*smp\(\s\+\|=\)\([0-9]*\).*$/\2/"`
|
||||
CPUSET=`echo $CPUSET|grep cpuset|sed -e "s/^.*\(--cpuset\(\s\+\|=\)[0-9\-]*\).*$/\1/"`
|
||||
if [ $AMI_OPT -eq 1 ]; then
|
||||
NR_CPU=`cat /proc/cpuinfo |grep processor|wc -l`
|
||||
NR_DISKS=`lsblk --list --nodeps --noheadings | grep -v xvda | grep xvd | wc -l`
|
||||
@@ -69,7 +75,8 @@ if [ `is_developer_mode` -eq 0 ]; then
|
||||
|
||||
echo "SEASTAR_IO=\"--num-io-queues $NR_IO_QUEUES --max-io-requests $NR_REQS\"" > /etc/scylla.d/io.conf
|
||||
else
|
||||
iotune --evaluation-directory /var/lib/scylla --format envfile --options-file /etc/scylla.d/io.conf $CPUSET
|
||||
DATA_DIR=`/usr/lib/scylla/scylla_config_get.py --config $SCYLLA_CONF/scylla.yaml --get data_file_directories|head -n1`
|
||||
iotune --evaluation-directory $DATA_DIR --format envfile --options-file /etc/scylla.d/io.conf $CPUSET
|
||||
if [ $? -ne 0 ]; then
|
||||
output_to_user "/var/lib/scylla did not pass validation tests, it may not be on XFS and/or has limited disk space."
|
||||
output_to_user "This is a non-supported setup, and performance is expected to be very bad."
|
||||
|
||||
22
dist/common/scripts/scylla_prepare
vendored
22
dist/common/scripts/scylla_prepare
vendored
@@ -1,5 +1,18 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
. /etc/os-release
|
||||
if [ "$ID" = "ubuntu" ]; then
|
||||
. /etc/default/scylla-server
|
||||
else
|
||||
. /etc/sysconfig/scylla-server
|
||||
fi
|
||||
for i in /etc/scylla.d/*.conf; do
|
||||
if [ "$i" = "/etc/scylla.d/*.conf" ]; then
|
||||
break
|
||||
fi
|
||||
. "$i"
|
||||
done
|
||||
|
||||
if [ "$AMI" = "yes" ] && [ -f /etc/scylla/ami_disabled ]; then
|
||||
rm /etc/scylla/ami_disabled
|
||||
exit 1
|
||||
@@ -20,10 +33,15 @@ elif [ "$NETWORK_MODE" = "dpdk" ]; then
|
||||
done
|
||||
else # NETWORK_MODE = posix
|
||||
if [ "$SET_NIC" = "yes" ]; then
|
||||
/usr/lib/scylla/posix_net_conf.sh $IFNAME
|
||||
NRXQ=`find /sys/class/net/$IFNAME/queues -name "rx-*"|wc -l`
|
||||
if [ $NRXQ -gt 1 ]; then
|
||||
CONF_ARGS=-mq
|
||||
else
|
||||
CONF_ARGS=-sq
|
||||
fi
|
||||
/usr/lib/scylla/posix_net_conf.sh $IFNAME $CONF_ARGS
|
||||
fi
|
||||
fi
|
||||
. /etc/os-release
|
||||
if [ "$ID" = "ubuntu" ]; then
|
||||
hugeadm --create-mounts
|
||||
fi
|
||||
|
||||
57
dist/common/scripts/scylla_setup
vendored
57
dist/common/scripts/scylla_setup
vendored
@@ -8,13 +8,15 @@ if [ "`id -u`" -ne 0 ]; then
|
||||
fi
|
||||
|
||||
print_usage() {
|
||||
echo "scylla_setup --disks /dev/hda,/dev/hdb... --nic eth0 --ntp-domain centos --ami --developer-mode --no-kernel-check --no-enable-service --no-selinux-setup --no-bootparam-setup --no-ntp-setup --no-raid-setup --no-coredump-setup --no-sysconfig-setup"
|
||||
echo "scylla_setup --disks /dev/hda,/dev/hdb... --nic eth0 --ntp-domain centos --ami --setup-nic --developer-mode --no-kernel-check --no-verify-package --no-enable-service --no-selinux-setup --no-bootparam-setup --no-ntp-setup --no-raid-setup --no-coredump-setup --no-sysconfig-setup"
|
||||
echo " --disks specify disks for RAID"
|
||||
echo " --nic specify NIC"
|
||||
echo " --ntp-domain specify NTP domain"
|
||||
echo " --ami setup AMI instance"
|
||||
echo " --setup-nic optimize NIC queue"
|
||||
echo " --developer-mode enable developer mode"
|
||||
echo " --no-kernel-check skip kernel version check"
|
||||
echo " --no-verify-package skip verifying packages"
|
||||
echo " --no-enable-service skip enabling service"
|
||||
echo " --no-selinux-setup skip selinux setup"
|
||||
echo " --no-bootparam-setup skip bootparam setup"
|
||||
@@ -42,9 +44,23 @@ interactive_ask_service() {
|
||||
done
|
||||
}
|
||||
|
||||
verify_package() {
|
||||
if [ "$ID" = "ubuntu" ]; then
|
||||
dpkg -s $1 > /dev/null 2>&1 &&:
|
||||
else
|
||||
rpm -q $1 > /dev/null 2>&1 &&:
|
||||
fi
|
||||
if [ $? -eq 1 ]; then
|
||||
echo "$1 package is not installed."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
AMI=0
|
||||
SET_NIC=0
|
||||
DEV_MODE=0
|
||||
KERNEL_CHECK=1
|
||||
VERIFY_PACKAGE=1
|
||||
ENABLE_SERVICE=1
|
||||
SELINUX_SETUP=1
|
||||
BOOTPARAM_SETUP=1
|
||||
@@ -78,6 +94,10 @@ while [ $# -gt 0 ]; do
|
||||
AMI=1
|
||||
shift 1
|
||||
;;
|
||||
"--setup-nic")
|
||||
SET_NIC=1
|
||||
shift 1
|
||||
;;
|
||||
"--developer-mode")
|
||||
DEV_MODE=1
|
||||
shift 1
|
||||
@@ -86,6 +106,10 @@ while [ $# -gt 0 ]; do
|
||||
KERNEL_CHECK=0
|
||||
shift 1
|
||||
;;
|
||||
"--no-verify-package")
|
||||
VERIFY_PACKAGE=0
|
||||
shift 1
|
||||
;;
|
||||
"--no-enable-service")
|
||||
ENABLE_SERVICE=0
|
||||
shift 1
|
||||
@@ -147,17 +171,19 @@ if [ $INTERACTIVE -eq 1 ]; then
|
||||
ENABLE_SERVICE=$?
|
||||
fi
|
||||
|
||||
if [ "$ID" = "ubuntu" ] || [ "$ID" = "debian" ]; then
|
||||
dpkg -s scylla-jmx > /dev/null 2>&1 &&:
|
||||
NO_SCYLLA_JMX=$?
|
||||
else
|
||||
rpm -q scylla-jmx > /dev/null 2>&1 &&:
|
||||
NO_SCYLLA_JMX=$?
|
||||
if [ $INTERACTIVE -eq 1 ]; then
|
||||
interactive_ask_service "Do you verify ScyllaDB packages installed?" &&:
|
||||
VERIFY_PACKAGE=$?
|
||||
fi
|
||||
|
||||
if [ $NO_SCYLLA_JMX -eq 1 ]; then
|
||||
echo "scylla-jmx package is not installed."
|
||||
exit 1
|
||||
if [ $VERIFY_PACKAGE -eq 1 ]; then
|
||||
verify_package scylla-jmx
|
||||
verify_package scylla-tools
|
||||
fi
|
||||
|
||||
if [ $INTERACTIVE -eq 1 ]; then
|
||||
interactive_ask_service "Do you want to enable ScyllaDB services?" &&:
|
||||
ENABLE_SERVICE=$?
|
||||
fi
|
||||
|
||||
if [ $ENABLE_SERVICE -eq 1 ]; then
|
||||
@@ -207,6 +233,9 @@ if [ $INTERACTIVE -eq 1 ]; then
|
||||
echo -n "> "
|
||||
read dsk
|
||||
if [ "$dsk" = "done" ]; then
|
||||
if [ "$DISKS" = "" ]; then
|
||||
continue
|
||||
fi
|
||||
break
|
||||
fi
|
||||
if [ "$dsk" = "" ]; then
|
||||
@@ -262,10 +291,16 @@ if [ $INTERACTIVE -eq 1 ]; then
|
||||
fi
|
||||
done
|
||||
fi
|
||||
interactive_ask_service "Do you want to optimize NIC queue settings?" &&:
|
||||
SET_NIC=$?
|
||||
fi
|
||||
fi
|
||||
if [ $SYSCONFIG_SETUP -eq 1 ]; then
|
||||
/usr/lib/scylla/scylla_sysconfig_setup --nic $NIC
|
||||
SETUP_ARGS=
|
||||
if [ $SET_NIC -eq 1 ]; then
|
||||
SETUP_ARGS="--setup-nic"
|
||||
fi
|
||||
/usr/lib/scylla/scylla_sysconfig_setup --nic $NIC $SETUP_ARGS
|
||||
fi
|
||||
|
||||
if [ $INTERACTIVE -eq 1 ]; then
|
||||
|
||||
13
dist/common/scripts/scylla_stop
vendored
13
dist/common/scripts/scylla_stop
vendored
@@ -1,5 +1,18 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
. /etc/os-release
|
||||
if [ "$ID" = "ubuntu" ]; then
|
||||
. /etc/default/scylla-server
|
||||
else
|
||||
. /etc/sysconfig/scylla-server
|
||||
fi
|
||||
for i in /etc/scylla.d/*.conf; do
|
||||
if [ "$i" = "/etc/scylla.d/*.conf" ]; then
|
||||
break
|
||||
fi
|
||||
. "$i"
|
||||
done
|
||||
|
||||
if [ "$NETWORK_MODE" = "virtio" ]; then
|
||||
ip tuntap del mode tap dev $TAP
|
||||
elif [ "$NETWORK_MODE" = "dpdk" ]; then
|
||||
|
||||
7
dist/common/scripts/scylla_sysconfig_setup
vendored
7
dist/common/scripts/scylla_sysconfig_setup
vendored
@@ -75,13 +75,8 @@ echo Setting parameters on $SYSCONFIG/scylla-server
|
||||
|
||||
ETHDRV=`/usr/lib/scylla/dpdk_nic_bind.py --status | grep if=$NIC | sed -e "s/^.*drv=//" -e "s/ .*$//"`
|
||||
ETHPCIID=`/usr/lib/scylla/dpdk_nic_bind.py --status | grep if=$NIC | awk '{print $1}'`
|
||||
NR_CPU=`cat /proc/cpuinfo |grep processor|wc -l`
|
||||
if [ "$AMI" = "yes" ] && [ $NR_CPU -ge 8 ] && [ "$SET_NIC" = "no" ]; then
|
||||
NR=$((NR_CPU - 1))
|
||||
SET_NIC="yes"
|
||||
SCYLLA_ARGS="$SCYLLA_ARGS --cpuset 1-$NR --smp $NR"
|
||||
fi
|
||||
sed -e s#^NETWORK_MODE=.*#NETWORK_MODE=$NETWORK_MODE# \
|
||||
-e s#^IFNAME=.*#IFNAME=$NIC# \
|
||||
-e s#^ETHDRV=.*#ETHDRV=$ETHDRV# \
|
||||
-e s#^ETHPCIID=.*#ETHPCIID=$ETHPCIID# \
|
||||
-e s#^NR_HUGEPAGES=.*#NR_HUGEPAGES=$NR_HUGEPAGES# \
|
||||
|
||||
4
dist/common/scylla.d/cpuset.conf
vendored
Normal file
4
dist/common/scylla.d/cpuset.conf
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
# DO NO EDIT
|
||||
# This file should be automatically configure by scylla_cpuset_setup
|
||||
#
|
||||
# CPUSET="--cpuset 0 --smp 1"
|
||||
2
dist/common/sudoers.d/scylla
vendored
2
dist/common/sudoers.d/scylla
vendored
@@ -1 +1 @@
|
||||
scylla ALL=(ALL) NOPASSWD:SETENV: /usr/lib/scylla/scylla_prepare,/usr/lib/scylla/scylla_stop,/usr/lib/scylla/scylla_io_setup,/usr/lib/scylla/scylla-ami/scylla_ami_setup
|
||||
scylla ALL=(ALL) NOPASSWD: /usr/lib/scylla/scylla_prepare,/usr/lib/scylla/scylla_stop,/usr/lib/scylla/scylla_io_setup,/usr/lib/scylla/scylla-ami/scylla_ami_setup
|
||||
|
||||
14
dist/common/sysctl.d/99-scylla-sched.conf
vendored
Normal file
14
dist/common/sysctl.d/99-scylla-sched.conf
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
# Prevent auto-scaling from doing anything to our tunables
|
||||
kernel.sched_tunable_scaling = 0
|
||||
|
||||
# Preempt sooner
|
||||
kernel.sched_min_granularity_ns = 500000
|
||||
|
||||
# Don't delay unrelated workloads
|
||||
kernel.sched_wakeup_granularity_ns = 500000
|
||||
|
||||
# Schedule all tasks in this period
|
||||
kernel.sched_latency_ns = 1000000
|
||||
|
||||
# autogroup seems to prevent sched_latency_ns from being respected
|
||||
kernel.sched_autogroup_enabled = 0
|
||||
10
dist/common/systemd/scylla-server.service.in
vendored
10
dist/common/systemd/scylla-server.service.in
vendored
@@ -2,18 +2,18 @@
|
||||
Description=Scylla Server
|
||||
|
||||
[Service]
|
||||
PermissionsStartOnly=true
|
||||
Type=notify
|
||||
LimitMEMLOCK=infinity
|
||||
LimitNOFILE=200000
|
||||
LimitAS=infinity
|
||||
LimitNPROC=8096
|
||||
WorkingDirectory=/var/lib/scylla
|
||||
Environment="HOME=/var/lib/scylla"
|
||||
EnvironmentFile=@@SYSCONFDIR@@/scylla-server
|
||||
EnvironmentFile=/etc/scylla.d/*.conf
|
||||
ExecStartPre=/usr/bin/sudo -E /usr/lib/scylla/scylla_prepare
|
||||
ExecStart=/usr/bin/scylla $SCYLLA_ARGS $SEASTAR_IO $DEV_MODE
|
||||
ExecStopPost=/usr/bin/sudo -E /usr/lib/scylla/scylla_stop
|
||||
WorkingDirectory=$SCYLLA_HOME
|
||||
ExecStartPre=/usr/lib/scylla/scylla_prepare
|
||||
ExecStart=/usr/bin/scylla $SCYLLA_ARGS $SEASTAR_IO $DEV_MODE $CPUSET
|
||||
ExecStopPost=/usr/lib/scylla/scylla_stop
|
||||
TimeoutStartSec=900
|
||||
KillMode=process
|
||||
Restart=on-abnormal
|
||||
|
||||
2
dist/docker/redhat/Dockerfile
vendored
2
dist/docker/redhat/Dockerfile
vendored
@@ -2,8 +2,8 @@ FROM centos:7
|
||||
|
||||
MAINTAINER Avi Kivity <avi@cloudius-systems.com>
|
||||
|
||||
RUN curl http://downloads.scylladb.com/rpm/centos/scylla-1.2.repo -o /etc/yum.repos.d/scylla.repo
|
||||
RUN yum -y install epel-release
|
||||
ADD scylla.repo /etc/yum.repos.d/
|
||||
RUN yum -y clean expire-cache
|
||||
RUN yum -y update
|
||||
RUN yum -y remove boost-thread boost-system
|
||||
|
||||
23
dist/docker/redhat/scylla.repo
vendored
23
dist/docker/redhat/scylla.repo
vendored
@@ -1,23 +0,0 @@
|
||||
[scylla]
|
||||
name=Scylla for Centos $releasever - $basearch
|
||||
baseurl=https://s3.amazonaws.com/downloads.scylladb.com/rpm/centos/$releasever/$basearch/
|
||||
enabled=1
|
||||
gpgcheck=0
|
||||
|
||||
[scylla-generic]
|
||||
name=Scylla for centos $releasever
|
||||
baseurl=https://s3.amazonaws.com/downloads.scylladb.com/rpm/centos/$releasever/noarch/
|
||||
enabled=1
|
||||
gpgcheck=0
|
||||
|
||||
[scylla-3rdparty]
|
||||
name=Scylla 3rdParty for Centos $releasever - $basearch
|
||||
baseurl=https://s3.amazonaws.com/downloads.scylladb.com/rpm/3rdparty/centos/$releasever/$basearch/
|
||||
enabled=1
|
||||
gpgcheck=0
|
||||
|
||||
[scylla-3rdparty-generic]
|
||||
name=Scylla 3rdParty for Centos $releasever
|
||||
baseurl=https://s3.amazonaws.com/downloads.scylladb.com/rpm/3rdparty/centos/$releasever/noarch/
|
||||
enabled=1
|
||||
gpgcheck=0
|
||||
1
dist/docker/ubuntu/Dockerfile
vendored
1
dist/docker/ubuntu/Dockerfile
vendored
@@ -1,4 +1,5 @@
|
||||
FROM ubuntu:14.04
|
||||
RUN sudo apt-get update
|
||||
RUN sudo apt-get install -y wget
|
||||
RUN sudo wget -O /etc/apt/sources.list.d/scylla.list http://downloads.scylladb.com/deb/ubuntu/scylla.list
|
||||
RUN sudo apt-get update
|
||||
|
||||
20
dist/redhat/build_rpm.sh
vendored
20
dist/redhat/build_rpm.sh
vendored
@@ -57,24 +57,24 @@ VERSION=$(./SCYLLA-VERSION-GEN)
|
||||
SCYLLA_VERSION=$(cat build/SCYLLA-VERSION-FILE)
|
||||
SCYLLA_RELEASE=$(cat build/SCYLLA-RELEASE-FILE)
|
||||
echo $VERSION >version
|
||||
./scripts/git-archive-all --extra version --force-submodules --prefix scylla-server-$SCYLLA_VERSION $RPMBUILD/SOURCES/scylla-server-$VERSION.tar
|
||||
./scripts/git-archive-all --extra version --force-submodules --prefix scylla-$SCYLLA_VERSION $RPMBUILD/SOURCES/scylla-$VERSION.tar
|
||||
rm -f version
|
||||
cp dist/redhat/scylla-server.spec.in $RPMBUILD/SPECS/scylla-server.spec
|
||||
sed -i -e "s/@@VERSION@@/$SCYLLA_VERSION/g" $RPMBUILD/SPECS/scylla-server.spec
|
||||
sed -i -e "s/@@RELEASE@@/$SCYLLA_RELEASE/g" $RPMBUILD/SPECS/scylla-server.spec
|
||||
cp dist/redhat/scylla.spec.in $RPMBUILD/SPECS/scylla.spec
|
||||
sed -i -e "s/@@VERSION@@/$SCYLLA_VERSION/g" $RPMBUILD/SPECS/scylla.spec
|
||||
sed -i -e "s/@@RELEASE@@/$SCYLLA_RELEASE/g" $RPMBUILD/SPECS/scylla.spec
|
||||
if [ "$ID" = "fedora" ]; then
|
||||
if [ $JOBS -gt 0 ]; then
|
||||
rpmbuild -bs --define "_topdir $RPMBUILD" --define "_smp_mflags -j$JOBS" $RPMBUILD/SPECS/scylla-server.spec
|
||||
rpmbuild -bs --define "_topdir $RPMBUILD" --define "_smp_mflags -j$JOBS" $RPMBUILD/SPECS/scylla.spec
|
||||
else
|
||||
rpmbuild -bs --define "_topdir $RPMBUILD" $RPMBUILD/SPECS/scylla-server.spec
|
||||
rpmbuild -bs --define "_topdir $RPMBUILD" $RPMBUILD/SPECS/scylla.spec
|
||||
fi
|
||||
mock rebuild --resultdir=`pwd`/build/rpms $RPMBUILD/SRPMS/scylla-server-$VERSION*.src.rpm
|
||||
mock rebuild --resultdir=`pwd`/build/rpms $RPMBUILD/SRPMS/scylla-$VERSION*.src.rpm
|
||||
else
|
||||
sudo yum-builddep -y $RPMBUILD/SPECS/scylla-server.spec
|
||||
sudo yum-builddep -y $RPMBUILD/SPECS/scylla.spec
|
||||
. /etc/profile.d/scylla.sh
|
||||
if [ $JOBS -gt 0 ]; then
|
||||
rpmbuild -ba --define "_topdir $RPMBUILD" --define "_smp_mflags -j$JOBS" $RPMBUILD/SPECS/scylla-server.spec
|
||||
rpmbuild -ba --define "_topdir $RPMBUILD" --define "_smp_mflags -j$JOBS" $RPMBUILD/SPECS/scylla.spec
|
||||
else
|
||||
rpmbuild -ba --define "_topdir $RPMBUILD" $RPMBUILD/SPECS/scylla-server.spec
|
||||
rpmbuild -ba --define "_topdir $RPMBUILD" $RPMBUILD/SPECS/scylla.spec
|
||||
fi
|
||||
fi
|
||||
|
||||
4
dist/redhat/centos_dep/build_dependency.sh
vendored
4
dist/redhat/centos_dep/build_dependency.sh
vendored
@@ -58,10 +58,10 @@ sudo yum install -y rpm-devel python34-devel guile-devel readline-devel ncurses-
|
||||
sudo yum install -y dos2unix
|
||||
|
||||
if [ ! -f $RPMBUILD/RPMS/noarch/scylla-env-1.0-1.el7.centos.noarch.rpm ]; then
|
||||
cd dist/redhat/centos_dep
|
||||
cd dist/common/dep
|
||||
tar cpf $RPMBUILD/SOURCES/scylla-env-1.0.tar scylla-env-1.0
|
||||
cd -
|
||||
rpmbuild --define "_topdir $RPMBUILD" --ba dist/redhat/centos_dep/scylla-env.spec
|
||||
rpmbuild --define "_topdir $RPMBUILD" --ba dist/common/dep/scylla-env.spec
|
||||
fi
|
||||
do_install scylla-env-1.0-1.el7.centos.noarch.rpm
|
||||
|
||||
|
||||
117
dist/redhat/centos_dep/gcc.diff
vendored
117
dist/redhat/centos_dep/gcc.diff
vendored
@@ -1,5 +1,5 @@
|
||||
--- gcc.spec.orig 2015-12-08 16:03:46.000000000 +0000
|
||||
+++ gcc.spec 2016-01-21 08:47:49.160667342 +0000
|
||||
+++ gcc.spec 2016-07-10 06:07:27.612453480 +0000
|
||||
@@ -1,6 +1,7 @@
|
||||
%global DATE 20151207
|
||||
%global SVNREV 231358
|
||||
@@ -8,7 +8,24 @@
|
||||
# Note, gcc_release must be integer, if you want to add suffixes to
|
||||
# %{release}, append them after %{gcc_release} on Release: line.
|
||||
%global gcc_release 2
|
||||
@@ -84,7 +85,8 @@
|
||||
@@ -9,16 +10,8 @@
|
||||
# Hardening slows the compiler way too much.
|
||||
%undefine _hardened_build
|
||||
%global multilib_64_archs sparc64 ppc64 ppc64p7 s390x x86_64
|
||||
-%ifarch %{ix86} x86_64 ia64 ppc ppc64 ppc64p7 alpha %{arm} aarch64
|
||||
-%global build_ada 1
|
||||
-%else
|
||||
%global build_ada 0
|
||||
-%endif
|
||||
-%ifarch %{ix86} x86_64 ppc ppc64 ppc64le ppc64p7 s390 s390x %{arm} aarch64
|
||||
-%global build_go 1
|
||||
-%else
|
||||
%global build_go 0
|
||||
-%endif
|
||||
%ifarch %{ix86} x86_64 ia64
|
||||
%global build_libquadmath 1
|
||||
%else
|
||||
@@ -84,7 +77,8 @@
|
||||
%global multilib_32_arch i686
|
||||
%endif
|
||||
Summary: Various compilers (C, C++, Objective-C, Java, ...)
|
||||
@@ -18,7 +35,7 @@
|
||||
Version: %{gcc_version}
|
||||
Release: %{gcc_release}%{?dist}
|
||||
# libgcc, libgfortran, libgomp, libstdc++ and crtstuff have
|
||||
@@ -99,6 +101,7 @@
|
||||
@@ -99,6 +93,7 @@
|
||||
%global isl_version 0.14
|
||||
URL: http://gcc.gnu.org
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
@@ -26,7 +43,7 @@
|
||||
# Need binutils with -pie support >= 2.14.90.0.4-4
|
||||
# Need binutils which can omit dot symbols and overlap .opd on ppc64 >= 2.15.91.0.2-4
|
||||
# Need binutils which handle -msecure-plt on ppc >= 2.16.91.0.2-2
|
||||
@@ -110,7 +113,7 @@
|
||||
@@ -110,7 +105,7 @@
|
||||
# Need binutils which support .cfi_sections >= 2.19.51.0.14-33
|
||||
# Need binutils which support --no-add-needed >= 2.20.51.0.2-12
|
||||
# Need binutils which support -plugin
|
||||
@@ -35,7 +52,7 @@
|
||||
# While gcc doesn't include statically linked binaries, during testing
|
||||
# -static is used several times.
|
||||
BuildRequires: glibc-static
|
||||
@@ -145,15 +148,15 @@
|
||||
@@ -145,15 +140,15 @@
|
||||
BuildRequires: libunwind >= 0.98
|
||||
%endif
|
||||
%if %{build_isl}
|
||||
@@ -55,7 +72,7 @@
|
||||
# Need .eh_frame ld optimizations
|
||||
# Need proper visibility support
|
||||
# Need -pie support
|
||||
@@ -168,7 +171,7 @@
|
||||
@@ -168,7 +163,7 @@
|
||||
# Need binutils that support .cfi_sections
|
||||
# Need binutils that support --no-add-needed
|
||||
# Need binutils that support -plugin
|
||||
@@ -64,7 +81,7 @@
|
||||
# Make sure gdb will understand DW_FORM_strp
|
||||
Conflicts: gdb < 5.1-2
|
||||
Requires: glibc-devel >= 2.2.90-12
|
||||
@@ -176,17 +179,15 @@
|
||||
@@ -176,17 +171,15 @@
|
||||
# Make sure glibc supports TFmode long double
|
||||
Requires: glibc >= 2.3.90-35
|
||||
%endif
|
||||
@@ -86,7 +103,7 @@
|
||||
Requires(post): /sbin/install-info
|
||||
Requires(preun): /sbin/install-info
|
||||
AutoReq: true
|
||||
@@ -228,12 +229,12 @@
|
||||
@@ -228,12 +221,12 @@
|
||||
The gcc package contains the GNU Compiler Collection version 5.
|
||||
You'll need this package in order to compile C code.
|
||||
|
||||
@@ -101,7 +118,7 @@
|
||||
%endif
|
||||
Obsoletes: libmudflap
|
||||
Obsoletes: libmudflap-devel
|
||||
@@ -241,17 +242,19 @@
|
||||
@@ -241,17 +234,19 @@
|
||||
Obsoletes: libgcj < %{version}-%{release}
|
||||
Obsoletes: libgcj-devel < %{version}-%{release}
|
||||
Obsoletes: libgcj-src < %{version}-%{release}
|
||||
@@ -125,7 +142,7 @@
|
||||
Autoreq: true
|
||||
|
||||
%description c++
|
||||
@@ -259,50 +262,55 @@
|
||||
@@ -259,50 +254,55 @@
|
||||
It includes support for most of the current C++ specification,
|
||||
including templates and exception handling.
|
||||
|
||||
@@ -193,7 +210,7 @@
|
||||
Autoreq: true
|
||||
|
||||
%description objc
|
||||
@@ -313,29 +321,32 @@
|
||||
@@ -313,29 +313,32 @@
|
||||
%package objc++
|
||||
Summary: Objective-C++ support for GCC
|
||||
Group: Development/Languages
|
||||
@@ -233,7 +250,7 @@
|
||||
%endif
|
||||
Requires(post): /sbin/install-info
|
||||
Requires(preun): /sbin/install-info
|
||||
@@ -345,260 +356,286 @@
|
||||
@@ -345,260 +348,286 @@
|
||||
The gcc-gfortran package provides support for compiling Fortran
|
||||
programs with the GNU Compiler Collection.
|
||||
|
||||
@@ -592,7 +609,7 @@
|
||||
Cpp is the GNU C-Compatible Compiler Preprocessor.
|
||||
Cpp is a macro processor which is used automatically
|
||||
by the C compiler to transform your program before actual
|
||||
@@ -623,8 +660,9 @@
|
||||
@@ -623,8 +652,9 @@
|
||||
%package gnat
|
||||
Summary: Ada 83, 95, 2005 and 2012 support for GCC
|
||||
Group: Development/Languages
|
||||
@@ -604,7 +621,7 @@
|
||||
Requires(post): /sbin/install-info
|
||||
Requires(preun): /sbin/install-info
|
||||
Autoreq: true
|
||||
@@ -633,82 +671,90 @@
|
||||
@@ -633,82 +663,90 @@
|
||||
GNAT is a GNU Ada 83, 95, 2005 and 2012 front-end to GCC. This package includes
|
||||
development tools, the documents and Ada compiler.
|
||||
|
||||
@@ -717,7 +734,7 @@
|
||||
Requires: gmp-devel >= 4.1.2-8, mpfr-devel >= 2.2.1, libmpc-devel >= 0.8.1
|
||||
|
||||
%description plugin-devel
|
||||
@@ -728,7 +774,8 @@
|
||||
@@ -728,7 +766,8 @@
|
||||
Summary: Debug information for package %{name}
|
||||
Group: Development/Debug
|
||||
AutoReqProv: 0
|
||||
@@ -727,7 +744,7 @@
|
||||
|
||||
%description debuginfo
|
||||
This package provides debug information for package %{name}.
|
||||
@@ -958,11 +1005,11 @@
|
||||
@@ -958,11 +997,11 @@
|
||||
--enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu \
|
||||
--enable-plugin --enable-initfini-array \
|
||||
--disable-libgcj \
|
||||
@@ -741,7 +758,7 @@
|
||||
%else
|
||||
--without-isl \
|
||||
%endif
|
||||
@@ -971,11 +1018,9 @@
|
||||
@@ -971,11 +1010,9 @@
|
||||
%else
|
||||
--disable-libmpx \
|
||||
%endif
|
||||
@@ -753,7 +770,7 @@
|
||||
%ifarch %{arm}
|
||||
--disable-sjlj-exceptions \
|
||||
%endif
|
||||
@@ -1006,9 +1051,6 @@
|
||||
@@ -1006,9 +1043,6 @@
|
||||
%if 0%{?rhel} >= 7
|
||||
--with-cpu-32=power8 --with-tune-32=power8 --with-cpu-64=power8 --with-tune-64=power8 \
|
||||
%endif
|
||||
@@ -763,7 +780,7 @@
|
||||
%endif
|
||||
%ifarch ppc
|
||||
--build=%{gcc_target_platform} --target=%{gcc_target_platform} --with-cpu=default32
|
||||
@@ -1270,16 +1312,15 @@
|
||||
@@ -1270,16 +1304,15 @@
|
||||
mv %{buildroot}%{_prefix}/%{_lib}/libmpx.spec $FULLPATH/
|
||||
%endif
|
||||
|
||||
@@ -786,7 +803,7 @@
|
||||
%endif
|
||||
%ifarch ppc
|
||||
rm -f $FULLPATH/libgcc_s.so
|
||||
@@ -1819,7 +1860,7 @@
|
||||
@@ -1819,7 +1852,7 @@
|
||||
chmod 755 %{buildroot}%{_prefix}/bin/c?9
|
||||
|
||||
cd ..
|
||||
@@ -795,7 +812,7 @@
|
||||
%find_lang cpplib
|
||||
|
||||
# Remove binaries we will not be including, so that they don't end up in
|
||||
@@ -1869,11 +1910,7 @@
|
||||
@@ -1869,11 +1902,7 @@
|
||||
|
||||
# run the tests.
|
||||
make %{?_smp_mflags} -k check ALT_CC_UNDER_TEST=gcc ALT_CXX_UNDER_TEST=g++ \
|
||||
@@ -807,7 +824,7 @@
|
||||
echo ====================TESTING=========================
|
||||
( LC_ALL=C ../contrib/test_summary || : ) 2>&1 | sed -n '/^cat.*EOF/,/^EOF/{/^cat.*EOF/d;/^EOF/d;/^LAST_UPDATED:/d;p;}'
|
||||
echo ====================TESTING END=====================
|
||||
@@ -1900,13 +1937,13 @@
|
||||
@@ -1900,13 +1929,13 @@
|
||||
--info-dir=%{_infodir} %{_infodir}/gcc.info.gz || :
|
||||
fi
|
||||
|
||||
@@ -823,7 +840,7 @@
|
||||
if [ $1 = 0 -a -f %{_infodir}/cpp.info.gz ]; then
|
||||
/sbin/install-info --delete \
|
||||
--info-dir=%{_infodir} %{_infodir}/cpp.info.gz || :
|
||||
@@ -1945,19 +1982,19 @@
|
||||
@@ -1945,19 +1974,19 @@
|
||||
fi
|
||||
|
||||
%post go
|
||||
@@ -846,7 +863,7 @@
|
||||
if posix.access ("/sbin/ldconfig", "x") then
|
||||
local pid = posix.fork ()
|
||||
if pid == 0 then
|
||||
@@ -1967,7 +2004,7 @@
|
||||
@@ -1967,7 +1996,7 @@
|
||||
end
|
||||
end
|
||||
|
||||
@@ -855,7 +872,7 @@
|
||||
if posix.access ("/sbin/ldconfig", "x") then
|
||||
local pid = posix.fork ()
|
||||
if pid == 0 then
|
||||
@@ -1977,120 +2014,120 @@
|
||||
@@ -1977,120 +2006,120 @@
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1014,7 +1031,7 @@
|
||||
%defattr(-,root,root,-)
|
||||
%{_prefix}/bin/cc
|
||||
%{_prefix}/bin/c89
|
||||
@@ -2414,7 +2451,7 @@
|
||||
@@ -2414,7 +2443,7 @@
|
||||
%{!?_licensedir:%global license %%doc}
|
||||
%license gcc/COPYING* COPYING.RUNTIME
|
||||
|
||||
@@ -1023,7 +1040,7 @@
|
||||
%defattr(-,root,root,-)
|
||||
%{_prefix}/lib/cpp
|
||||
%{_prefix}/bin/cpp
|
||||
@@ -2425,10 +2462,10 @@
|
||||
@@ -2425,10 +2454,10 @@
|
||||
%dir %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_version}
|
||||
%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_version}/cc1
|
||||
|
||||
@@ -1037,7 +1054,7 @@
|
||||
%{!?_licensedir:%global license %%doc}
|
||||
%license gcc/COPYING* COPYING.RUNTIME
|
||||
|
||||
@@ -2469,7 +2506,7 @@
|
||||
@@ -2469,7 +2498,7 @@
|
||||
%endif
|
||||
%doc rpm.doc/changelogs/gcc/cp/ChangeLog*
|
||||
|
||||
@@ -1046,7 +1063,7 @@
|
||||
%defattr(-,root,root,-)
|
||||
%{_prefix}/%{_lib}/libstdc++.so.6*
|
||||
%dir %{_datadir}/gdb
|
||||
@@ -2481,7 +2518,7 @@
|
||||
@@ -2481,7 +2510,7 @@
|
||||
%dir %{_prefix}/share/gcc-%{gcc_version}/python
|
||||
%{_prefix}/share/gcc-%{gcc_version}/python/libstdcxx
|
||||
|
||||
@@ -1055,7 +1072,7 @@
|
||||
%defattr(-,root,root,-)
|
||||
%dir %{_prefix}/include/c++
|
||||
%dir %{_prefix}/include/c++/%{gcc_version}
|
||||
@@ -2507,7 +2544,7 @@
|
||||
@@ -2507,7 +2536,7 @@
|
||||
%endif
|
||||
%doc rpm.doc/changelogs/libstdc++-v3/ChangeLog* libstdc++-v3/README*
|
||||
|
||||
@@ -1064,7 +1081,7 @@
|
||||
%defattr(-,root,root,-)
|
||||
%dir %{_prefix}/lib/gcc
|
||||
%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
|
||||
@@ -2528,7 +2565,7 @@
|
||||
@@ -2528,7 +2557,7 @@
|
||||
%endif
|
||||
|
||||
%if %{build_libstdcxx_docs}
|
||||
@@ -1073,7 +1090,7 @@
|
||||
%defattr(-,root,root)
|
||||
%{_mandir}/man3/*
|
||||
%doc rpm.doc/libstdc++-v3/html
|
||||
@@ -2567,7 +2604,7 @@
|
||||
@@ -2567,7 +2596,7 @@
|
||||
%dir %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_version}
|
||||
%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_version}/cc1objplus
|
||||
|
||||
@@ -1082,7 +1099,7 @@
|
||||
%defattr(-,root,root,-)
|
||||
%{_prefix}/%{_lib}/libobjc.so.4*
|
||||
|
||||
@@ -2621,11 +2658,11 @@
|
||||
@@ -2621,11 +2650,11 @@
|
||||
%endif
|
||||
%doc rpm.doc/gfortran/*
|
||||
|
||||
@@ -1096,7 +1113,7 @@
|
||||
%defattr(-,root,root,-)
|
||||
%dir %{_prefix}/lib/gcc
|
||||
%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
|
||||
@@ -2671,12 +2708,12 @@
|
||||
@@ -2671,12 +2700,12 @@
|
||||
%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_version}/gnat1
|
||||
%doc rpm.doc/changelogs/gcc/ada/ChangeLog*
|
||||
|
||||
@@ -1111,7 +1128,7 @@
|
||||
%defattr(-,root,root,-)
|
||||
%dir %{_prefix}/lib/gcc
|
||||
%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
|
||||
@@ -2702,7 +2739,7 @@
|
||||
@@ -2702,7 +2731,7 @@
|
||||
%exclude %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/adalib/libgnarl.a
|
||||
%endif
|
||||
|
||||
@@ -1120,7 +1137,7 @@
|
||||
%defattr(-,root,root,-)
|
||||
%dir %{_prefix}/lib/gcc
|
||||
%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
|
||||
@@ -2726,7 +2763,7 @@
|
||||
@@ -2726,7 +2755,7 @@
|
||||
%endif
|
||||
%endif
|
||||
|
||||
@@ -1129,7 +1146,7 @@
|
||||
%defattr(-,root,root,-)
|
||||
%{_prefix}/%{_lib}/libgomp.so.1*
|
||||
%{_prefix}/%{_lib}/libgomp-plugin-host_nonshm.so.1*
|
||||
@@ -2734,14 +2771,14 @@
|
||||
@@ -2734,14 +2763,14 @@
|
||||
%doc rpm.doc/changelogs/libgomp/ChangeLog*
|
||||
|
||||
%if %{build_libquadmath}
|
||||
@@ -1146,7 +1163,7 @@
|
||||
%defattr(-,root,root,-)
|
||||
%dir %{_prefix}/lib/gcc
|
||||
%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
|
||||
@@ -2754,7 +2791,7 @@
|
||||
@@ -2754,7 +2783,7 @@
|
||||
%endif
|
||||
%doc rpm.doc/libquadmath/ChangeLog*
|
||||
|
||||
@@ -1155,7 +1172,7 @@
|
||||
%defattr(-,root,root,-)
|
||||
%dir %{_prefix}/lib/gcc
|
||||
%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
|
||||
@@ -2773,12 +2810,12 @@
|
||||
@@ -2773,12 +2802,12 @@
|
||||
%endif
|
||||
|
||||
%if %{build_libitm}
|
||||
@@ -1170,7 +1187,7 @@
|
||||
%defattr(-,root,root,-)
|
||||
%dir %{_prefix}/lib/gcc
|
||||
%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
|
||||
@@ -2791,7 +2828,7 @@
|
||||
@@ -2791,7 +2820,7 @@
|
||||
%endif
|
||||
%doc rpm.doc/libitm/ChangeLog*
|
||||
|
||||
@@ -1179,7 +1196,7 @@
|
||||
%defattr(-,root,root,-)
|
||||
%dir %{_prefix}/lib/gcc
|
||||
%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
|
||||
@@ -2810,11 +2847,11 @@
|
||||
@@ -2810,11 +2839,11 @@
|
||||
%endif
|
||||
|
||||
%if %{build_libatomic}
|
||||
@@ -1193,7 +1210,7 @@
|
||||
%defattr(-,root,root,-)
|
||||
%dir %{_prefix}/lib/gcc
|
||||
%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
|
||||
@@ -2834,11 +2871,11 @@
|
||||
@@ -2834,11 +2863,11 @@
|
||||
%endif
|
||||
|
||||
%if %{build_libasan}
|
||||
@@ -1207,7 +1224,7 @@
|
||||
%defattr(-,root,root,-)
|
||||
%dir %{_prefix}/lib/gcc
|
||||
%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
|
||||
@@ -2860,11 +2897,11 @@
|
||||
@@ -2860,11 +2889,11 @@
|
||||
%endif
|
||||
|
||||
%if %{build_libubsan}
|
||||
@@ -1221,7 +1238,7 @@
|
||||
%defattr(-,root,root,-)
|
||||
%dir %{_prefix}/lib/gcc
|
||||
%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
|
||||
@@ -2886,11 +2923,11 @@
|
||||
@@ -2886,11 +2915,11 @@
|
||||
%endif
|
||||
|
||||
%if %{build_libtsan}
|
||||
@@ -1235,7 +1252,7 @@
|
||||
%defattr(-,root,root,-)
|
||||
%dir %{_prefix}/lib/gcc
|
||||
%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
|
||||
@@ -2902,11 +2939,11 @@
|
||||
@@ -2902,11 +2931,11 @@
|
||||
%endif
|
||||
|
||||
%if %{build_liblsan}
|
||||
@@ -1249,7 +1266,7 @@
|
||||
%defattr(-,root,root,-)
|
||||
%dir %{_prefix}/lib/gcc
|
||||
%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
|
||||
@@ -2918,11 +2955,11 @@
|
||||
@@ -2918,11 +2947,11 @@
|
||||
%endif
|
||||
|
||||
%if %{build_libcilkrts}
|
||||
@@ -1263,7 +1280,7 @@
|
||||
%defattr(-,root,root,-)
|
||||
%dir %{_prefix}/lib/gcc
|
||||
%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
|
||||
@@ -2942,12 +2979,12 @@
|
||||
@@ -2942,12 +2971,12 @@
|
||||
%endif
|
||||
|
||||
%if %{build_libmpx}
|
||||
@@ -1278,7 +1295,7 @@
|
||||
%defattr(-,root,root,-)
|
||||
%dir %{_prefix}/lib/gcc
|
||||
%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
|
||||
@@ -3009,12 +3046,12 @@
|
||||
@@ -3009,12 +3038,12 @@
|
||||
%endif
|
||||
%doc rpm.doc/go/*
|
||||
|
||||
@@ -1293,7 +1310,7 @@
|
||||
%defattr(-,root,root,-)
|
||||
%dir %{_prefix}/lib/gcc
|
||||
%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
|
||||
@@ -3042,7 +3079,7 @@
|
||||
@@ -3042,7 +3071,7 @@
|
||||
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/libgo.so
|
||||
%endif
|
||||
|
||||
@@ -1302,7 +1319,7 @@
|
||||
%defattr(-,root,root,-)
|
||||
%dir %{_prefix}/lib/gcc
|
||||
%dir %{_prefix}/lib/gcc/%{gcc_target_platform}
|
||||
@@ -3060,12 +3097,12 @@
|
||||
@@ -3060,12 +3089,12 @@
|
||||
%endif
|
||||
%endif
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Name: scylla-server
|
||||
Name: scylla
|
||||
Version: @@VERSION@@
|
||||
Release: @@RELEASE@@%{?dist}
|
||||
Summary: Scylla is a highly scalable, eventually consistent, distributed, partitioned row DB.
|
||||
@@ -7,23 +7,40 @@ Group: Applications/Databases
|
||||
License: AGPLv3
|
||||
URL: http://www.scylladb.com/
|
||||
Source0: %{name}-@@VERSION@@-@@RELEASE@@.tar
|
||||
|
||||
BuildRequires: libaio-devel libstdc++-devel cryptopp-devel hwloc-devel numactl-devel libpciaccess-devel libxml2-devel zlib-devel thrift-devel yaml-cpp-devel lz4-devel snappy-devel jsoncpp-devel systemd-devel xz-devel openssl-devel libcap-devel libselinux-devel libgcrypt-devel libgpg-error-devel elfutils-devel krb5-devel libcom_err-devel libattr-devel pcre-devel elfutils-libelf-devel bzip2-devel keyutils-libs-devel xfsprogs-devel make gnutls-devel systemd-devel
|
||||
%{?fedora:BuildRequires: boost-devel ninja-build ragel antlr3-tool antlr3-C++-devel python3 gcc-c++ libasan libubsan python3-pyparsing dnf-yum}
|
||||
%{?rhel:BuildRequires: scylla-libstdc++-static scylla-boost-devel scylla-ninja-build scylla-ragel scylla-antlr3-tool scylla-antlr3-C++-devel python34 scylla-gcc-c++ >= 5.1.1, python34-pyparsing}
|
||||
Requires: systemd-libs hwloc collectd
|
||||
Conflicts: abrt
|
||||
Requires: scylla-server scylla-jmx scylla-tools scylla-kernel-conf
|
||||
Obsoletes: scylla-server < 1.1
|
||||
|
||||
%description
|
||||
Scylla is a highly scalable, eventually consistent, distributed,
|
||||
partitioned row DB.
|
||||
This package installs all required packages for ScyllaDB, including
|
||||
scylla-server, scylla-jmx, scylla-tools.
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%package server
|
||||
Group: Applications/Databases
|
||||
Summary: The Scylla database server
|
||||
License: AGPLv3
|
||||
URL: http://www.scylladb.com/
|
||||
BuildRequires: libaio-devel libstdc++-devel cryptopp-devel hwloc-devel numactl-devel libpciaccess-devel libxml2-devel zlib-devel thrift-devel yaml-cpp-devel lz4-devel snappy-devel jsoncpp-devel systemd-devel xz-devel openssl-devel libcap-devel libselinux-devel libgcrypt-devel libgpg-error-devel elfutils-devel krb5-devel libcom_err-devel libattr-devel pcre-devel elfutils-libelf-devel bzip2-devel keyutils-libs-devel xfsprogs-devel make gnutls-devel systemd-devel lksctp-tools-devel
|
||||
%{?fedora:BuildRequires: boost-devel ninja-build ragel antlr3-tool antlr3-C++-devel python3 gcc-c++ libasan libubsan python3-pyparsing dnf-yum}
|
||||
%{?rhel:BuildRequires: scylla-libstdc++-static scylla-boost-devel scylla-ninja-build scylla-ragel scylla-antlr3-tool scylla-antlr3-C++-devel python34 scylla-gcc-c++ >= 5.1.1, python34-pyparsing}
|
||||
Requires: scylla-conf systemd-libs hwloc collectd PyYAML python-urwid
|
||||
Conflicts: abrt
|
||||
|
||||
%description server
|
||||
This package contains ScyllaDB server.
|
||||
|
||||
%define __debug_install_post \
|
||||
%{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}";\
|
||||
cp scylla-gdb.py ${RPM_BUILD_ROOT}/usr/src/debug/%{name}-%{version}/;\
|
||||
%{nil}
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
%if 0%{?fedora}
|
||||
./configure.py --disable-xen --enable-dpdk --mode=release
|
||||
@@ -45,6 +62,7 @@ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sudoers.d/
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/collectd.d/
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/scylla/
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/scylla.d/
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysctldir}/
|
||||
mkdir -p $RPM_BUILD_ROOT%{_docdir}/scylla/
|
||||
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
|
||||
mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/scylla/
|
||||
@@ -54,6 +72,7 @@ install -m644 dist/common/limits.d/scylla.conf $RPM_BUILD_ROOT%{_sysconfdir}/sec
|
||||
install -m644 dist/common/sudoers.d/scylla $RPM_BUILD_ROOT%{_sysconfdir}/sudoers.d/
|
||||
install -m644 dist/common/collectd.d/scylla.conf $RPM_BUILD_ROOT%{_sysconfdir}/collectd.d/
|
||||
install -m644 dist/common/scylla.d/*.conf $RPM_BUILD_ROOT%{_sysconfdir}/scylla.d/
|
||||
install -m644 dist/common/sysctl.d/*.conf $RPM_BUILD_ROOT%{_sysctldir}/
|
||||
install -d -m755 $RPM_BUILD_ROOT%{_sysconfdir}/scylla
|
||||
install -m644 conf/scylla.yaml $RPM_BUILD_ROOT%{_sysconfdir}/scylla/
|
||||
install -m644 conf/cassandra-rackdc.properties $RPM_BUILD_ROOT%{_sysconfdir}/scylla/
|
||||
@@ -82,33 +101,24 @@ cp -r api/api-doc $RPM_BUILD_ROOT%{_prefix}/lib/scylla/api
|
||||
cp -r tools/scyllatop $RPM_BUILD_ROOT%{_prefix}/lib/scylla/scyllatop
|
||||
cp -P dist/common/sbin/* $RPM_BUILD_ROOT%{_sbindir}/
|
||||
|
||||
%pre
|
||||
%pre server
|
||||
/usr/sbin/groupadd scylla 2> /dev/null || :
|
||||
/usr/sbin/useradd -g scylla -s /sbin/nologin -r -d %{_sharedstatedir}/scylla scylla 2> /dev/null || :
|
||||
%if 0%{?rhel}
|
||||
sed -e "s/Defaults requiretty/#Defaults requiretty/" /etc/sudoers > /tmp/sudoers
|
||||
cp /tmp/sudoers /etc/sudoers
|
||||
rm /tmp/sudoers
|
||||
%endif
|
||||
|
||||
%post
|
||||
grep -v api_ui_dir /etc/scylla/scylla.yaml | grep -v api_doc_dir > /tmp/scylla.yaml
|
||||
echo "api_ui_dir: /usr/lib/scylla/swagger-ui/dist/" >> /tmp/scylla.yaml
|
||||
echo "api_doc_dir: /usr/lib/scylla/api/api-doc/" >> /tmp/scylla.yaml
|
||||
mv /tmp/scylla.yaml /etc/scylla/scylla.yaml
|
||||
%post server
|
||||
# Upgrade coredump settings
|
||||
if [ -f /etc/systemd/coredump.conf ];then
|
||||
/usr/lib/scylla/scylla_coredump_setup
|
||||
fi
|
||||
%systemd_post scylla-server.service
|
||||
|
||||
%preun
|
||||
%preun server
|
||||
%systemd_preun scylla-server.service
|
||||
|
||||
%postun
|
||||
%postun server
|
||||
%systemd_postun
|
||||
|
||||
%posttrans
|
||||
%posttrans server
|
||||
if [ -d /tmp/%{name}-%{version}-%{release} ]; then
|
||||
cp -a /tmp/%{name}-%{version}-%{release}/* /etc/scylla/
|
||||
rm -rf /tmp/%{name}-%{version}-%{release}/
|
||||
@@ -119,16 +129,13 @@ systemctl restart collectd
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%files server
|
||||
%defattr(-,root,root)
|
||||
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/scylla-server
|
||||
%{_sysconfdir}/security/limits.d/scylla.conf
|
||||
%{_sysconfdir}/sudoers.d/scylla
|
||||
%config(noreplace) %{_sysconfdir}/collectd.d/scylla.conf
|
||||
%attr(0755,root,root) %dir %{_sysconfdir}/scylla
|
||||
%config(noreplace) %{_sysconfdir}/scylla/scylla.yaml
|
||||
%config(noreplace) %{_sysconfdir}/scylla/cassandra-rackdc.properties
|
||||
%attr(0755,root,root) %dir %{_sysconfdir}/scylla.d
|
||||
%config(noreplace) %{_sysconfdir}/scylla.d/*.conf
|
||||
%{_docdir}/scylla/README.md
|
||||
@@ -153,6 +160,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_prefix}/lib/scylla/scylla_io_setup
|
||||
%{_prefix}/lib/scylla/scylla_dev_mode_setup
|
||||
%{_prefix}/lib/scylla/scylla_kernel_check
|
||||
%{_prefix}/lib/scylla/scylla_cpuset_setup
|
||||
%{_prefix}/lib/scylla/posix_net_conf.sh
|
||||
%{_prefix}/lib/scylla/dpdk_nic_bind.py
|
||||
%{_prefix}/lib/scylla/dpdk_nic_bind.pyc
|
||||
@@ -160,11 +168,55 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_prefix}/lib/scylla/swagger-ui/dist/*
|
||||
%{_prefix}/lib/scylla/api/api-doc/*
|
||||
%{_prefix}/lib/scylla/scyllatop/*
|
||||
%{_prefix}/lib/scylla/scylla_config_get.py
|
||||
%{_prefix}/lib/scylla/scylla_config_get.pyc
|
||||
%{_prefix}/lib/scylla/scylla_config_get.pyo
|
||||
%attr(0755,scylla,scylla) %dir %{_sharedstatedir}/scylla/
|
||||
%attr(0755,scylla,scylla) %dir %{_sharedstatedir}/scylla/data
|
||||
%attr(0755,scylla,scylla) %dir %{_sharedstatedir}/scylla/commitlog
|
||||
%attr(0755,scylla,scylla) %dir %{_sharedstatedir}/scylla/coredump
|
||||
|
||||
%package conf
|
||||
Group: Applications/Databases
|
||||
Summary: Scylla configuration package
|
||||
License: AGPLv3
|
||||
URL: http://www.scylladb.com/
|
||||
Obsoletes: scylla-server < 1.1
|
||||
|
||||
%description conf
|
||||
This package contains the main scylla configuration file.
|
||||
|
||||
%post conf
|
||||
grep -v api_ui_dir /etc/scylla/scylla.yaml | grep -v api_doc_dir > /tmp/scylla.yaml
|
||||
echo "api_ui_dir: /usr/lib/scylla/swagger-ui/dist/" >> /tmp/scylla.yaml
|
||||
echo "api_doc_dir: /usr/lib/scylla/api/api-doc/" >> /tmp/scylla.yaml
|
||||
mv /tmp/scylla.yaml /etc/scylla/scylla.yaml
|
||||
|
||||
%files conf
|
||||
%defattr(-,root,root)
|
||||
%attr(0755,root,root) %dir %{_sysconfdir}/scylla
|
||||
%config(noreplace) %{_sysconfdir}/scylla/scylla.yaml
|
||||
%config(noreplace) %{_sysconfdir}/scylla/cassandra-rackdc.properties
|
||||
|
||||
%package kernel-conf
|
||||
Group: Applications/Databases
|
||||
Summary: Scylla configuration package for the Linux kernel
|
||||
License: AGPLv3
|
||||
URL: http://www.scylladb.com/
|
||||
|
||||
%description kernel-conf
|
||||
This package contains Linux kernel configuration changes for the Scylla database. Install this package
|
||||
if Scylla is the main application on your server and you wish to optimize its latency and throughput.
|
||||
|
||||
%post kernel-conf
|
||||
# We cannot use the sysctl_apply rpm macro because it is not present in 7.0
|
||||
# following is a "manual" expansion
|
||||
/usr/lib/systemd/systemd-sysctl 99-scylla-sched.conf >/dev/null 2>&1 || :
|
||||
|
||||
%files kernel-conf
|
||||
%defattr(-,root,root)
|
||||
%{_sysctldir}/*.conf
|
||||
|
||||
%changelog
|
||||
* Tue Jul 21 2015 Takuya ASADA <syuu@cloudius-systems.com>
|
||||
- inital version of scylla.spec
|
||||
31
dist/ubuntu/build_deb.sh
vendored
31
dist/ubuntu/build_deb.sh
vendored
@@ -1,5 +1,24 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
print_usage() {
|
||||
echo "build_deb.sh --rebuild-dep"
|
||||
echo " --rebuild-dep rebuild dependency packages"
|
||||
exit 1
|
||||
}
|
||||
REBUILD=0
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
"--rebuild-dep")
|
||||
REBUILD=1
|
||||
shift 1
|
||||
;;
|
||||
*)
|
||||
print_usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
if [ ! -e dist/ubuntu/build_deb.sh ]; then
|
||||
echo "run build_deb.sh in top of scylla dir"
|
||||
exit 1
|
||||
@@ -68,7 +87,17 @@ fi
|
||||
cp dist/common/systemd/scylla-server.service.in debian/scylla-server.service
|
||||
sed -i -e "s#@@SYSCONFDIR@@#/etc/default#g" debian/scylla-server.service
|
||||
|
||||
./dist/ubuntu/dep/build_dependency.sh
|
||||
if [ "$RELEASE" = "14.04" ] && [ $REBUILD -eq 0 ]; then
|
||||
if [ ! -f /etc/apt/sources.list.d/scylla-3rdparty-trusty.list ]; then
|
||||
cd /etc/apt/sources.list.d
|
||||
sudo wget https://s3.amazonaws.com/downloads.scylladb.com/deb/3rdparty/ubuntu/scylla-3rdparty-trusty.list
|
||||
cd -
|
||||
fi
|
||||
sudo apt-get -y update
|
||||
sudo apt-get -y --allow-unauthenticated install antlr3 antlr3-c++-dev libthrift-dev libthrift0 thrift-compiler
|
||||
else
|
||||
./dist/ubuntu/dep/build_dependency.sh
|
||||
fi
|
||||
|
||||
if [ "$RELEASE" = "14.04" ]; then
|
||||
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||
|
||||
26
dist/ubuntu/control.in
vendored
26
dist/ubuntu/control.in
vendored
@@ -4,11 +4,19 @@ Homepage: http://scylladb.com
|
||||
Section: database
|
||||
Priority: optional
|
||||
Standards-Version: 3.9.5
|
||||
Build-Depends: debhelper (>= 9), libyaml-cpp-dev, liblz4-dev, libsnappy-dev, libcrypto++-dev, libjsoncpp-dev, libaio-dev, libthrift-dev, thrift-compiler, antlr3, antlr3-c++-dev, ragel, ninja-build, git, libboost-program-options1.55-dev | libboost-program-options-dev, libboost-filesystem1.55-dev | libboost-filesystem-dev, libboost-system1.55-dev | libboost-system-dev, libboost-thread1.55-dev | libboost-thread-dev, libboost-test1.55-dev | libboost-test-dev, libgnutls28-dev, libhwloc-dev, libnuma-dev, libpciaccess-dev, xfslibs-dev, python3-pyparsing, libxml2-dev, @@BUILD_DEPENDS@@
|
||||
Build-Depends: debhelper (>= 9), libyaml-cpp-dev, liblz4-dev, libsnappy-dev, libcrypto++-dev, libjsoncpp-dev, libaio-dev, libthrift-dev, thrift-compiler, antlr3, antlr3-c++-dev, ragel, ninja-build, git, libboost-program-options1.55-dev | libboost-program-options-dev, libboost-filesystem1.55-dev | libboost-filesystem-dev, libboost-system1.55-dev | libboost-system-dev, libboost-thread1.55-dev | libboost-thread-dev, libboost-test1.55-dev | libboost-test-dev, libgnutls28-dev, libhwloc-dev, libnuma-dev, libpciaccess-dev, xfslibs-dev, python3-pyparsing, libxml2-dev, libsctp-dev, python-urwid, @@BUILD_DEPENDS@@
|
||||
|
||||
Package: scylla-conf
|
||||
Architecture: any
|
||||
Description: Scylla database main configuration file
|
||||
Scylla is a highly scalable, eventually consistent, distributed,
|
||||
partitioned row DB.
|
||||
Replaces: scylla-server (<< 1.1)
|
||||
Conflicts: scylla-server (<< 1.1)
|
||||
|
||||
Package: scylla-server
|
||||
Architecture: amd64
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, hwloc-nox, collectd, @@DEPENDS@@
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, hwloc-nox, collectd, scylla-conf, python-yaml, python-urwid, @@DEPENDS@@
|
||||
Description: Scylla database server binaries
|
||||
Scylla is a highly scalable, eventually consistent, distributed,
|
||||
partitioned row DB.
|
||||
@@ -22,3 +30,17 @@ Description: debugging symbols for scylla-server
|
||||
Scylla is a highly scalable, eventually consistent, distributed,
|
||||
partitioned row DB.
|
||||
This package contains the debugging symbols for scylla-server.
|
||||
|
||||
Package: scylla-kernel-conf
|
||||
Architecture: any
|
||||
Description: Scylla kernel tuning configuration
|
||||
Scylla is a highly scalable, eventually consistent, distributed,
|
||||
partitioned row DB.
|
||||
|
||||
Package: scylla
|
||||
Section: metapackages
|
||||
Architecture: any
|
||||
Depends: scylla-server, scylla-jmx, scylla-tools, scylla-kernel-conf
|
||||
Description: Scylla database metapackage
|
||||
Scylla is a highly scalable, eventually consistent, distributed,
|
||||
partitioned row DB.
|
||||
|
||||
1
dist/ubuntu/debian/scylla-conf.dirs
vendored
Normal file
1
dist/ubuntu/debian/scylla-conf.dirs
vendored
Normal file
@@ -0,0 +1 @@
|
||||
etc/scylla
|
||||
2
dist/ubuntu/debian/scylla-conf.install
vendored
Normal file
2
dist/ubuntu/debian/scylla-conf.install
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
conf/scylla.yaml etc/scylla
|
||||
conf/cassandra-rackdc.properties etc/scylla
|
||||
1
dist/ubuntu/debian/scylla-kernel-conf.dirs
vendored
Normal file
1
dist/ubuntu/debian/scylla-kernel-conf.dirs
vendored
Normal file
@@ -0,0 +1 @@
|
||||
etc/sysctl.d
|
||||
1
dist/ubuntu/debian/scylla-kernel-conf.install
vendored
Normal file
1
dist/ubuntu/debian/scylla-kernel-conf.install
vendored
Normal file
@@ -0,0 +1 @@
|
||||
dist/common/sysctl.d/99-scylla-sched.conf /etc/sysctl.d
|
||||
7
dist/ubuntu/debian/scylla-kernel-conf.postinst
vendored
Normal file
7
dist/ubuntu/debian/scylla-kernel-conf.postinst
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
sysctl -p/etc/sysctl.d/99-scylla-sched.conf
|
||||
|
||||
#DEBHELPER#
|
||||
1
dist/ubuntu/debian/scylla-server-dbg.install
vendored
Normal file
1
dist/ubuntu/debian/scylla-server-dbg.install
vendored
Normal file
@@ -0,0 +1 @@
|
||||
scylla-gdb.py usr/lib/scylla
|
||||
6
dist/ubuntu/debian/scylla-server.dirs
vendored
Normal file
6
dist/ubuntu/debian/scylla-server.dirs
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
etc/scylla.d
|
||||
usr/lib/scylla
|
||||
var/lib/scylla
|
||||
var/lib/scylla/data
|
||||
var/lib/scylla/commitlog
|
||||
var/lib/scylla/coredump
|
||||
4
dist/ubuntu/debian/scylla-server.docs
vendored
Normal file
4
dist/ubuntu/debian/scylla-server.docs
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
*.md
|
||||
NOTICE.txt
|
||||
ORIGIN
|
||||
licenses
|
||||
16
dist/ubuntu/debian/scylla-server.install
vendored
Normal file
16
dist/ubuntu/debian/scylla-server.install
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
dist/common/limits.d/scylla.conf etc/security/limits.d
|
||||
dist/ubuntu/sysctl.d/99-scylla.conf etc/sysctl.d
|
||||
dist/common/sudoers.d/scylla etc/sudoers.d
|
||||
dist/common/collectd.d/scylla.conf etc/collectd/collectd.conf.d
|
||||
dist/common/scylla.d/*.conf etc/scylla.d
|
||||
seastar/scripts/dpdk_nic_bind.py usr/lib/scylla
|
||||
seastar/scripts/posix_net_conf.sh usr/lib/scylla
|
||||
dist/common/scripts/* usr/lib/scylla
|
||||
dist/ubuntu/scripts/* usr/lib/scylla
|
||||
tools/scyllatop usr/lib/scylla
|
||||
swagger-ui/dist usr/lib/scylla/swagger-ui
|
||||
api/api-doc usr/lib/scylla/api
|
||||
build/release/scylla usr/bin
|
||||
build/release/iotune usr/bin
|
||||
dist/common/bin/scyllatop usr/bin
|
||||
dist/common/sbin/* usr/sbin
|
||||
24
dist/ubuntu/debian/scylla-server.upstart
vendored
24
dist/ubuntu/debian/scylla-server.upstart
vendored
@@ -27,11 +27,6 @@ chdir /var/lib/scylla
|
||||
env HOME=/var/lib/scylla
|
||||
|
||||
pre-start script
|
||||
eval "`grep -v -e "^\s*#" -e "^$" /etc/default/scylla-server|sed -e 's/^/export /'`"
|
||||
. /etc/scylla.d/dev-mode.conf
|
||||
. /etc/scylla.d/io.conf
|
||||
export DEV_MODE
|
||||
export SEASTAR_IO
|
||||
if [ "$AMI" = "yes" ]; then
|
||||
sudo /usr/lib/scylla/scylla-ami/scylla_ami_setup
|
||||
fi
|
||||
@@ -39,19 +34,16 @@ pre-start script
|
||||
end script
|
||||
|
||||
script
|
||||
eval "`grep -v -e "^\s*#" -e "^$" /etc/default/scylla-server|sed -e 's/^/export /'`"
|
||||
. /etc/scylla.d/dev-mode.conf
|
||||
. /etc/scylla.d/io.conf
|
||||
export DEV_MODE
|
||||
export SEASTAR_IO
|
||||
exec /usr/bin/scylla $SCYLLA_ARGS $SEASTAR_IO $DEV_MODE
|
||||
. /etc/default/scylla-server
|
||||
for i in /etc/scylla.d/*.conf; do
|
||||
if [ "$i" = "/etc/scylla.d/*.conf" ]; then
|
||||
break
|
||||
fi
|
||||
. "$i"
|
||||
done
|
||||
exec /usr/bin/scylla $SCYLLA_ARGS $SEASTAR_IO $DEV_MODE $CPUSET
|
||||
end script
|
||||
|
||||
post-stop script
|
||||
eval "`grep -v -e "^\s*#" -e "^$" /etc/default/scylla-server|sed -e 's/^/export /'`"
|
||||
. /etc/scylla.d/dev-mode.conf
|
||||
. /etc/scylla.d/io.conf
|
||||
export DEV_MODE
|
||||
export SEASTAR_IO
|
||||
sudo /usr/lib/scylla/scylla_stop
|
||||
end script
|
||||
|
||||
28
dist/ubuntu/dep/build_dependency.sh
vendored
28
dist/ubuntu/dep/build_dependency.sh
vendored
@@ -15,6 +15,34 @@ if [ "$RELEASE" = "14.04" ] || [ "$DISTRIBUTION" = "Debian" ]; then
|
||||
debuild -r fakeroot --no-tgz-check -us -uc
|
||||
cd -
|
||||
fi
|
||||
if [ ! -f build/scylla-env_1.0-0ubuntu1_all.deb ]; then
|
||||
rm -rf build/scylla-env-1.0
|
||||
cp -a dist/common/dep/scylla-env-1.0 build/
|
||||
cd build/scylla-env-1.0
|
||||
debuild -r fakeroot --no-tgz-check -us -uc
|
||||
cd -
|
||||
fi
|
||||
if [ ! -f build/scylla-gdb_7.11-0ubuntu1_amd64.deb ]; then
|
||||
rm -rf build/gdb-7.11
|
||||
if [ ! -f build/gdb_7.11-0ubuntu1.dsc ]; then
|
||||
wget -O build/gdb_7.11-0ubuntu1.dsc http://archive.ubuntu.com/ubuntu/pool/main/g/gdb/gdb_7.11-0ubuntu1.dsc
|
||||
fi
|
||||
if [ ! -f build/gdb_7.11.orig.tar.xz ]; then
|
||||
wget -O build/gdb_7.11.orig.tar.xz http://archive.ubuntu.com/ubuntu/pool/main/g/gdb/gdb_7.11.orig.tar.xz
|
||||
fi
|
||||
if [ ! -f build/gdb_7.11-0ubuntu1.debian.tar.xz ]; then
|
||||
wget -O build/gdb_7.11-0ubuntu1.debian.tar.xz http://archive.ubuntu.com/ubuntu/pool/main/g/gdb/gdb_7.11-0ubuntu1.debian.tar.xz
|
||||
fi
|
||||
cd build
|
||||
dpkg-source -x gdb_7.11-0ubuntu1.dsc
|
||||
mv gdb_7.11.orig.tar.xz scylla-gdb_7.11.orig.tar.xz
|
||||
cd -
|
||||
cd build/gdb-7.11
|
||||
patch -p0 < ../../dist/ubuntu/dep/gdb.diff
|
||||
echo Y | sudo mk-build-deps -i -r
|
||||
debuild -r fakeroot --no-tgz-check -us -uc
|
||||
cd -
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f build/antlr3-c++-dev_3.5.2-1_all.deb ]; then
|
||||
|
||||
3101
dist/ubuntu/dep/gdb.diff
vendored
Normal file
3101
dist/ubuntu/dep/gdb.diff
vendored
Normal file
File diff suppressed because it is too large
Load Diff
71
dist/ubuntu/rules.in
vendored
71
dist/ubuntu/rules.in
vendored
@@ -1,17 +1,5 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
DOC = $(CURDIR)/debian/scylla-server/usr/share/doc/scylla-server
|
||||
SCRIPTS = $(CURDIR)/debian/scylla-server/usr/lib/scylla
|
||||
SWAGGER = $(SCRIPTS)/swagger-ui
|
||||
API = $(SCRIPTS)/api
|
||||
SYSCTL = $(CURDIR)/debian/scylla-server/etc/sysctl.d
|
||||
SUDOERS = $(CURDIR)/debian/scylla-server/etc/sudoers.d
|
||||
LIMITS= $(CURDIR)/debian/scylla-server/etc/security/limits.d
|
||||
COLLECTD= $(CURDIR)/debian/scylla-server/etc/collectd/collectd.conf.d
|
||||
SCYLLAD= $(CURDIR)/debian/scylla-server/etc/scylla.d
|
||||
LIBS = $(CURDIR)/debian/scylla-server/usr/lib
|
||||
CONF = $(CURDIR)/debian/scylla-server/etc/scylla
|
||||
|
||||
override_dh_auto_build:
|
||||
./configure.py --disable-xen --enable-dpdk --mode=release --static-stdc++ --static-thrift --compiler=@@COMPILER@@
|
||||
ninja
|
||||
@@ -21,65 +9,6 @@ override_dh_auto_clean:
|
||||
rm -rf Cql.tokens
|
||||
rm -rf build.ninja seastar/build.ninja
|
||||
|
||||
override_dh_auto_install:
|
||||
mkdir -p $(LIMITS) && \
|
||||
cp $(CURDIR)/dist/common/limits.d/scylla.conf $(LIMITS)
|
||||
|
||||
mkdir -p $(SYSCTL) && \
|
||||
cp $(CURDIR)/dist/ubuntu/sysctl.d/99-scylla.conf $(SYSCTL)
|
||||
|
||||
mkdir -p $(SUDOERS) && \
|
||||
cp $(CURDIR)/dist/common/sudoers.d/scylla $(SUDOERS)
|
||||
|
||||
mkdir -p $(COLLECTD) && \
|
||||
cp $(CURDIR)/dist/common/collectd.d/scylla.conf $(COLLECTD)
|
||||
|
||||
mkdir -p $(SCYLLAD) && \
|
||||
cp $(CURDIR)/dist/common/scylla.d/*.conf $(SCYLLAD)
|
||||
|
||||
mkdir -p $(CONF) && \
|
||||
cp $(CURDIR)/conf/scylla.yaml $(CONF)
|
||||
cp $(CURDIR)/conf/cassandra-rackdc.properties $(CONF)
|
||||
|
||||
mkdir -p $(DOC) && \
|
||||
cp $(CURDIR)/*.md $(DOC)
|
||||
cp $(CURDIR)/NOTICE.txt $(DOC)
|
||||
cp $(CURDIR)/ORIGIN $(DOC)
|
||||
cp -r $(CURDIR)/licenses $(DOC)
|
||||
|
||||
mkdir -p $(SCRIPTS) && \
|
||||
cp $(CURDIR)/seastar/scripts/dpdk_nic_bind.py $(SCRIPTS)
|
||||
cp $(CURDIR)/seastar/scripts/posix_net_conf.sh $(SCRIPTS)
|
||||
cp $(CURDIR)/dist/common/scripts/* $(SCRIPTS)
|
||||
cp $(CURDIR)/dist/ubuntu/scripts/* $(SCRIPTS)
|
||||
cp -r $(CURDIR)/tools/scyllatop $(SCRIPTS)
|
||||
|
||||
mkdir -p $(SWAGGER) && \
|
||||
cp -r $(CURDIR)/swagger-ui/dist $(SWAGGER)
|
||||
|
||||
mkdir -p $(API) && \
|
||||
cp -r $(CURDIR)/api/api-doc $(API)
|
||||
|
||||
mkdir -p $(CURDIR)/debian/scylla-server/usr/bin/ && \
|
||||
cp $(CURDIR)/build/release/scylla \
|
||||
$(CURDIR)/debian/scylla-server/usr/bin/
|
||||
cp $(CURDIR)/build/release/iotune \
|
||||
$(CURDIR)/debian/scylla-server/usr/bin/
|
||||
cp $(CURDIR)/dist/common/bin/scyllatop \
|
||||
$(CURDIR)/debian/scylla-server/usr/bin/
|
||||
|
||||
mkdir -p $(CURDIR)/debian/scylla-server/usr/sbin/ && \
|
||||
cp -P $(CURDIR)/dist/common/sbin/* \
|
||||
$(CURDIR)/debian/scylla-server/usr/sbin/
|
||||
|
||||
|
||||
mkdir -p $(CURDIR)/debian/scylla-server/var/lib/scylla/data
|
||||
mkdir -p $(CURDIR)/debian/scylla-server/var/lib/scylla/commitlog
|
||||
mkdir -p $(CURDIR)/debian/scylla-server/var/lib/scylla/coredump
|
||||
|
||||
mkdir -p $(CURDIR)/debian/scylla-server-dbg/usr/lib/scylla
|
||||
cp $(CURDIR)/scylla-gdb.py $(CURDIR)/debian/scylla-server-dbg/usr/lib/scylla
|
||||
|
||||
override_dh_installinit:
|
||||
dh_installinit --no-start @@DH_INSTALLINIT@@
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
return _heart_beat_state;
|
||||
}
|
||||
|
||||
void set_heart_beat_state(heart_beat_state hbs) {
|
||||
void set_heart_beat_state_and_update_timestamp(heart_beat_state hbs) {
|
||||
update_timestamp();
|
||||
_heart_beat_state = hbs;
|
||||
}
|
||||
|
||||
54
gms/feature.hh
Normal file
54
gms/feature.hh
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (C) 2016 ScyllaDB
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is part of Scylla.
|
||||
*
|
||||
* Scylla is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Scylla is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Scylla. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace gms {
|
||||
|
||||
/**
|
||||
* A gossip feature tracks whether all the nodes the current one is
|
||||
* aware of support the specified feature.
|
||||
*
|
||||
* A feature should only be created once the gossiper is available.
|
||||
*/
|
||||
class feature final {
|
||||
sstring _name;
|
||||
bool _enabled;
|
||||
friend class gossiper;
|
||||
public:
|
||||
explicit feature(sstring name, bool enabled = false);
|
||||
~feature();
|
||||
feature(const feature& other)
|
||||
: feature(other._name, other._enabled)
|
||||
{ }
|
||||
feature& operator=(const feature& other) = delete;
|
||||
const sstring& name() const {
|
||||
return _name;
|
||||
}
|
||||
explicit operator bool() const {
|
||||
return _enabled;
|
||||
}
|
||||
friend inline std::ostream& operator<<(std::ostream& os, const feature& f) {
|
||||
return os << "{ gossip feature = " << f._name << " }";
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace gms
|
||||
120
gms/gossiper.cc
120
gms/gossiper.cc
@@ -57,6 +57,7 @@
|
||||
#include <seastar/core/thread.hh>
|
||||
#include <chrono>
|
||||
#include "dht/i_partitioner.hh"
|
||||
#include <boost/range/algorithm/set_algorithm.hpp>
|
||||
|
||||
namespace gms {
|
||||
|
||||
@@ -534,7 +535,7 @@ void gossiper::run() {
|
||||
// We don't care about heart_beat change on other CPUs - so ingnore this
|
||||
// specific change.
|
||||
//
|
||||
shadow_endpoint_state_map[br_addr].set_heart_beat_state(hbs);
|
||||
shadow_endpoint_state_map[br_addr].get_heart_beat_state() = hbs;
|
||||
|
||||
logger.trace("My heartbeat is now {}", endpoint_state_map[br_addr].get_heart_beat_state().get_heart_beat_version());
|
||||
std::vector<gossip_digest> g_digests;
|
||||
@@ -596,6 +597,8 @@ void gossiper::run() {
|
||||
if (endpoint_map_changed || live_endpoint_changed || unreachable_endpoint_changed) {
|
||||
if (endpoint_map_changed) {
|
||||
shadow_endpoint_state_map = endpoint_state_map;
|
||||
_features_condvar.broadcast();
|
||||
maybe_enable_features();
|
||||
}
|
||||
|
||||
if (live_endpoint_changed) {
|
||||
@@ -612,6 +615,8 @@ void gossiper::run() {
|
||||
if (engine().cpu_id() != 0) {
|
||||
if (endpoint_map_changed) {
|
||||
local_gossiper.endpoint_state_map = shadow_endpoint_state_map;
|
||||
local_gossiper._features_condvar.broadcast();
|
||||
local_gossiper.maybe_enable_features();
|
||||
}
|
||||
|
||||
if (live_endpoint_changed) {
|
||||
@@ -1109,21 +1114,13 @@ void gossiper::mark_alive(inet_address addr, endpoint_state& local_state) {
|
||||
local_state.mark_dead();
|
||||
msg_addr id = get_msg_addr(addr);
|
||||
logger.trace("Sending a EchoMessage to {}", id);
|
||||
auto ok = make_shared<bool>(false);
|
||||
ms().send_gossip_echo(id).then_wrapped([this, id, ok] (auto&& f) mutable {
|
||||
try {
|
||||
f.get();
|
||||
logger.trace("Got EchoMessage Reply");
|
||||
*ok = true;
|
||||
} catch (...) {
|
||||
logger.warn("Fail to send EchoMessage to {}: {}", id, std::current_exception());
|
||||
}
|
||||
return make_ready_future<>();
|
||||
}).get();
|
||||
|
||||
if (*ok) {
|
||||
this->set_last_processed_message_at();
|
||||
this->real_mark_alive(id.addr, local_state);
|
||||
try {
|
||||
ms().send_gossip_echo(id).get();
|
||||
logger.trace("Got EchoMessage Reply");
|
||||
set_last_processed_message_at();
|
||||
real_mark_alive(id.addr, local_state);
|
||||
} catch(...) {
|
||||
logger.warn("Fail to send EchoMessage to {}: {}", id, std::current_exception());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1133,7 +1130,10 @@ void gossiper::real_mark_alive(inet_address addr, endpoint_state& local_state) {
|
||||
local_state.mark_alive();
|
||||
local_state.update_timestamp(); // prevents do_status_check from racing us and evicting if it was down > A_VERY_LONG_TIME
|
||||
_live_endpoints.insert(addr);
|
||||
_live_endpoints_just_added.push_back(addr);
|
||||
auto it = std::find(_live_endpoints_just_added.begin(), _live_endpoints_just_added.end(), addr);
|
||||
if (it == _live_endpoints_just_added.end()) {
|
||||
_live_endpoints_just_added.push_back(addr);
|
||||
}
|
||||
_unreachable_endpoints.erase(addr);
|
||||
_expire_time_endpoint_map.erase(addr);
|
||||
logger.debug("removing expire time for endpoint : {}", addr);
|
||||
@@ -1230,7 +1230,7 @@ void gossiper::apply_new_states(inet_address addr, endpoint_state& local_state,
|
||||
// don't assert here, since if the node restarts the version will go back to zero
|
||||
//int oldVersion = local_state.get_heart_beat_state().get_heart_beat_version();
|
||||
|
||||
local_state.set_heart_beat_state(remote_state.get_heart_beat_state());
|
||||
local_state.set_heart_beat_state_and_update_timestamp(remote_state.get_heart_beat_state());
|
||||
// if (logger.isTraceEnabled()) {
|
||||
// logger.trace("Updating heartbeat state version to {} from {} for {} ...",
|
||||
// local_state.get_heart_beat_state().get_heart_beat_version(), oldVersion, addr);
|
||||
@@ -1447,7 +1447,7 @@ void gossiper::add_saved_endpoint(inet_address ep) {
|
||||
if (it != endpoint_state_map.end()) {
|
||||
ep_state = it->second;
|
||||
logger.debug("not replacing a previous ep_state for {}, but reusing it: {}", ep, ep_state);
|
||||
ep_state.set_heart_beat_state(heart_beat_state(0));
|
||||
ep_state.set_heart_beat_state_and_update_timestamp(heart_beat_state(0));
|
||||
}
|
||||
ep_state.mark_dead();
|
||||
endpoint_state_map[ep] = ep_state;
|
||||
@@ -1529,6 +1529,7 @@ future<> gossiper::do_stop_gossiping() {
|
||||
get_local_failure_detector().unregister_failure_detection_event_listener(&g);
|
||||
}
|
||||
g.uninit_messaging_service_handler();
|
||||
g._features_condvar.broken();
|
||||
return make_ready_future<>();
|
||||
}).get();
|
||||
});
|
||||
@@ -1590,12 +1591,12 @@ bool gossiper::is_alive(inet_address ep) {
|
||||
if (ep == get_broadcast_address()) {
|
||||
return true;
|
||||
}
|
||||
auto eps = get_endpoint_state_for_endpoint(ep);
|
||||
auto it = endpoint_state_map.find(ep);
|
||||
// we could assert not-null, but having isAlive fail screws a node over so badly that
|
||||
// it's worth being defensive here so minor bugs don't cause disproportionate
|
||||
// badness. (See CASSANDRA-1463 for an example).
|
||||
if (eps) {
|
||||
return eps->is_alive();
|
||||
if (it != endpoint_state_map.end()) {
|
||||
return it->second.is_alive();
|
||||
} else {
|
||||
logger.warn("unknown endpoint {}", ep);
|
||||
return false;
|
||||
@@ -1749,32 +1750,69 @@ std::set<sstring> gossiper::get_supported_features() const {
|
||||
return common_features;
|
||||
}
|
||||
|
||||
static future<stop_iteration> check_features(auto features, auto need_features, auto expire) {
|
||||
static bool check_features(std::set<sstring> features, std::set<sstring> need_features) {
|
||||
logger.info("Checking if need_features {} in features {}", need_features, features);
|
||||
if (std::includes(features.begin(), features.end(), need_features.begin(), need_features.end())) {
|
||||
return make_ready_future<stop_iteration>(stop_iteration::yes);
|
||||
}
|
||||
if (gossiper::now() > expire) {
|
||||
throw std::runtime_error(sprint("Unable to wait for feature %s", need_features));
|
||||
return boost::range::includes(features, need_features);
|
||||
}
|
||||
|
||||
future<> gossiper::wait_for_feature_on_all_node(std::set<sstring> features) {
|
||||
return _features_condvar.wait([this, features = std::move(features)] {
|
||||
return check_features(get_supported_features(), features);
|
||||
});
|
||||
}
|
||||
|
||||
future<> gossiper::wait_for_feature_on_node(std::set<sstring> features, inet_address endpoint) {
|
||||
return _features_condvar.wait([this, features = std::move(features), endpoint = std::move(endpoint)] {
|
||||
return check_features(get_supported_features(endpoint), features);
|
||||
});
|
||||
}
|
||||
|
||||
void gossiper::register_feature(feature* f) {
|
||||
if (check_features(get_local_gossiper().get_supported_features(), {f->name()})) {
|
||||
f->_enabled = true;
|
||||
} else {
|
||||
return sleep(std::chrono::seconds(2)).then([] {
|
||||
return make_ready_future<stop_iteration>(stop_iteration::no);
|
||||
});
|
||||
_registered_features.emplace(f->name(), std::vector<feature*>()).first->second.emplace_back(f);
|
||||
}
|
||||
}
|
||||
|
||||
future<> gossiper::wait_for_feature_on_all_node(std::set<sstring> features, std::chrono::seconds timeout) const {
|
||||
auto expire = now() + timeout;
|
||||
return repeat([this, features, expire] {
|
||||
return check_features(get_supported_features(), features, expire);
|
||||
});
|
||||
void gossiper::unregister_feature(feature* f) {
|
||||
auto&& fs = _registered_features[f->name()];
|
||||
auto it = std::find(fs.begin(), fs.end(), f);
|
||||
if (it != fs.end()) {
|
||||
fs.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
future<> gossiper::wait_for_feature_on_node(std::set<sstring> features, inet_address endpoint, std::chrono::seconds timeout) const {
|
||||
auto expire = now() + timeout;
|
||||
return repeat([this, features, endpoint, expire] {
|
||||
return check_features(get_supported_features(endpoint), features, expire);
|
||||
});
|
||||
void gossiper::maybe_enable_features() {
|
||||
if (_registered_features.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto&& features = get_supported_features();
|
||||
for (auto it = _registered_features.begin(); it != _registered_features.end(); ) {
|
||||
if (features.find(it->first) != features.end()) {
|
||||
for (auto&& f : it->second) {
|
||||
f->_enabled = true;
|
||||
}
|
||||
it = _registered_features.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
feature::feature(sstring name, bool enabled)
|
||||
: _name(name)
|
||||
, _enabled(enabled) {
|
||||
if (!_enabled) {
|
||||
get_local_gossiper().register_feature(this);
|
||||
}
|
||||
}
|
||||
|
||||
feature::~feature() {
|
||||
if (!_enabled) {
|
||||
get_local_gossiper().unregister_feature(this);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace gms
|
||||
|
||||
@@ -48,12 +48,14 @@
|
||||
#include "gms/versioned_value.hh"
|
||||
#include "gms/application_state.hh"
|
||||
#include "gms/endpoint_state.hh"
|
||||
#include "gms/feature.hh"
|
||||
#include "message/messaging_service.hh"
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <experimental/optional>
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <set>
|
||||
#include <seastar/core/condition-variable.hh>
|
||||
|
||||
namespace gms {
|
||||
|
||||
@@ -514,17 +516,23 @@ private:
|
||||
uint64_t _nr_run = 0;
|
||||
bool _ms_registered = false;
|
||||
bool _gossiped_to_seed = false;
|
||||
private:
|
||||
condition_variable _features_condvar;
|
||||
std::unordered_map<sstring, std::vector<feature*>> _registered_features;
|
||||
friend class feature;
|
||||
public:
|
||||
// Get features supported by a particular node
|
||||
std::set<sstring> get_supported_features(inet_address endpoint) const;
|
||||
// Get features supported by all the nodes this node knows about
|
||||
std::set<sstring> get_supported_features() const;
|
||||
// Wait for features are available on all nodes this node knows about
|
||||
future<> wait_for_feature_on_all_node(std::set<sstring> features,
|
||||
std::chrono::seconds timeout = std::chrono::seconds(300)) const;
|
||||
future<> wait_for_feature_on_all_node(std::set<sstring> features);
|
||||
// Wait for features are available on a particular node
|
||||
future<> wait_for_feature_on_node(std::set<sstring> features, inet_address endpoint,
|
||||
std::chrono::seconds timeout = std::chrono::seconds(300)) const;
|
||||
future<> wait_for_feature_on_node(std::set<sstring> features, inet_address endpoint);
|
||||
private:
|
||||
void register_feature(feature* f);
|
||||
void unregister_feature(feature* f);
|
||||
void maybe_enable_features();
|
||||
};
|
||||
|
||||
extern distributed<gossiper> _the_gossiper;
|
||||
|
||||
@@ -877,7 +877,7 @@ $name$temp_param serializer<$name$temp_param>::read(Input& buf) {""").substitute
|
||||
continue
|
||||
local_param = "__local_" + str(index)
|
||||
if "attribute" in param:
|
||||
deflt = param["default"][0] if "default" in param else param["type"] + "()"
|
||||
deflt = param["default"][0] if "default" in param else param_type(param["type"]) + "()"
|
||||
fprintln(cout, Template(""" $typ $local = (in.size()>0) ?
|
||||
$func(in, boost::type<$typ>()) : $default;""").substitute({'func' : DESERIALIZER, 'typ': param_type(param["type"]), 'local' : local_param, 'default': deflt}))
|
||||
else:
|
||||
|
||||
@@ -28,6 +28,7 @@ class result_digest final {
|
||||
class result {
|
||||
bytes_ostream buf();
|
||||
std::experimental::optional<query::result_digest> digest();
|
||||
api::timestamp_type last_modified() [ [version 1.2] ] = api::missing_timestamp;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
15
init.cc
15
init.cc
@@ -64,18 +64,23 @@ void init_ms_fd_gossiper(sstring listen_address
|
||||
}
|
||||
|
||||
future<> f = make_ready_future<>();
|
||||
::shared_ptr<server_credentials> creds;
|
||||
std::shared_ptr<credentials_builder> creds;
|
||||
|
||||
if (ew != encrypt_what::none) {
|
||||
// note: credentials are immutable after this, and ok to share across shards
|
||||
creds = ::make_shared<server_credentials>(::make_shared<dh_params>(dh_params::level::MEDIUM));
|
||||
creds = std::make_shared<credentials_builder>();
|
||||
creds->set_dh_level(dh_params::level::MEDIUM);
|
||||
|
||||
creds->set_x509_key_file(ms_cert, ms_key, x509_crt_format::PEM).get();
|
||||
ms_trust_store.empty() ? creds->set_system_trust().get() :
|
||||
creds->set_x509_trust_file(ms_trust_store, x509_crt_format::PEM).get();
|
||||
if (ms_trust_store.empty()) {
|
||||
creds->set_system_trust().get();
|
||||
} else {
|
||||
creds->set_x509_trust_file(ms_trust_store, x509_crt_format::PEM).get();
|
||||
}
|
||||
}
|
||||
|
||||
// Init messaging_service
|
||||
net::get_messaging_service().start(listen, storage_port, ew, ssl_storage_port, creds).get();
|
||||
|
||||
// #293 - do not stop anything
|
||||
//engine().at_exit([] { return net::get_messaging_service().stop(); });
|
||||
// Init failure_detector
|
||||
|
||||
41
keys.cc
41
keys.cc
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "keys.hh"
|
||||
#include "dht/i_partitioner.hh"
|
||||
#include "clustering_bounds_comparator.hh"
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const partition_key& pk) {
|
||||
return out << "pk{" << to_hex(pk) << "}";
|
||||
@@ -52,3 +53,43 @@ partition_key_view::ring_order_tri_compare(const schema& s, partition_key_view k
|
||||
}
|
||||
return legacy_tri_compare(s, k2);
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const bound_kind k) {
|
||||
switch(k) {
|
||||
case bound_kind::excl_end:
|
||||
return out << "excl end";
|
||||
case bound_kind::incl_start:
|
||||
return out << "incl start";
|
||||
case bound_kind::incl_end:
|
||||
return out << "incl end";
|
||||
case bound_kind::excl_start:
|
||||
return out << "excl start";
|
||||
}
|
||||
abort();
|
||||
}
|
||||
|
||||
bound_kind invert_kind(bound_kind k) {
|
||||
switch(k) {
|
||||
case bound_kind::excl_start: return bound_kind::incl_end;
|
||||
case bound_kind::incl_start: return bound_kind::excl_end;
|
||||
case bound_kind::excl_end: return bound_kind::incl_start;
|
||||
case bound_kind::incl_end: return bound_kind::excl_start;
|
||||
}
|
||||
abort();
|
||||
}
|
||||
|
||||
int32_t weight(bound_kind k) {
|
||||
switch(k) {
|
||||
case bound_kind::excl_end:
|
||||
return -2;
|
||||
case bound_kind::incl_start:
|
||||
return -1;
|
||||
case bound_kind::incl_end:
|
||||
return 1;
|
||||
case bound_kind::excl_start:
|
||||
return 2;
|
||||
}
|
||||
abort();
|
||||
}
|
||||
|
||||
const thread_local clustering_key_prefix bound_view::empty_prefix = clustering_key::make_empty();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user