jihoonson commented on a change in pull request #10203: URL: https://github.com/apache/druid/pull/10203#discussion_r462599164
########## File path: core/src/main/java/org/apache/druid/java/util/common/HumanReadableBytes.java ########## @@ -0,0 +1,210 @@ +/* + * 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. + */ + +package org.apache.druid.java.util.common; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; + +import java.io.Serializable; + +@JsonSerialize(using = HumanReadableBytesSerializer.class) Review comment: Ah I see. It's used in another Jackson magic. Thanks. ########## File path: docs/configuration/human-readable-byte.md ########## @@ -33,21 +33,22 @@ These properties can be configured through 2 ways: Given the cache size is 3G, there's a configuration as below -```` -druid.cache.sizeInBytes=3000000000 #3 * 1000_000_000 -```` +```properties +# 3G bytes = 3_000_000_000 bytes +druid.cache.sizeInBytes=3000000000 +``` ## A number with a unit suffix -Sometimes value in bytes could be very large in Druid, it's counterintuitive to set value of these properties as above. +Sometimes value in byte could be very large in Druid, it's counterintuitive to set value of these properties as above. Review comment: I think `in bytes` is correct. ########## File path: docs/configuration/human-readable-byte.md ########## @@ -33,21 +33,22 @@ These properties can be configured through 2 ways: Given the cache size is 3G, there's a configuration as below -```` -druid.cache.sizeInBytes=3000000000 #3 * 1000_000_000 -```` +```properties +# 3G bytes = 3_000_000_000 bytes +druid.cache.sizeInBytes=3000000000 +``` ## A number with a unit suffix -Sometimes value in bytes could be very large in Druid, it's counterintuitive to set value of these properties as above. +Sometimes value in byte could be very large in Druid, it's counterintuitive to set value of these properties as above. Here comes another way, a number with a unit suffix. -Given the total size of disks is 1T, the configuration can be +Given the size of disk is 1T, the configuration can be Review comment: Maybe `Given a disk of 1T` is better. ########## File path: docs/configuration/human-readable-byte.md ########## @@ -0,0 +1,88 @@ +--- +id: human-readable-byte +title: "Human-readable Byte Configuration Reference" +--- + +<!-- + ~ 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. + --> + + +This page documents all configuration properties related to bytes. + +These properties can be configured through 2 ways: +1. a simple number in byte Review comment: `in bytes` here too. ########## File path: docs/configuration/human-readable-byte.md ########## @@ -0,0 +1,88 @@ +--- +id: human-readable-byte +title: "Human-readable Byte Configuration Reference" +--- + +<!-- + ~ 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. + --> + + +This page documents all configuration properties related to bytes. + +These properties can be configured through 2 ways: +1. a simple number in byte +2. a number with a unit suffix + +## A number in byte Review comment: Same here too. ########## File path: docs/configuration/human-readable-byte.md ########## @@ -0,0 +1,88 @@ +--- +id: human-readable-byte +title: "Human-readable Byte Configuration Reference" +--- + +<!-- + ~ 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. + --> + + +This page documents all configuration properties related to bytes. + +These properties can be configured through 2 ways: +1. a simple number in byte +2. a number with a unit suffix + +## A number in byte + +Given the cache size is 3G, there's a configuration as below + +```properties +# 3G bytes = 3_000_000_000 bytes +druid.cache.sizeInBytes=3000000000 +``` + + +## A number with a unit suffix + +Sometimes value in byte could be very large in Druid, it's counterintuitive to set value of these properties as above. +Here comes another way, a number with a unit suffix. + +Given the size of disk is 1T, the configuration can be + +```properties +druid.segmentCache.locations=[{"path":"/segment-cache","maxSize":"1t"}] +``` + +Note: in above example, both `1t` and `1T` are acceptable since it's case insensitive. Review comment: I think it should be `case-insensitive` since it's a single word. ########## File path: docs/configuration/human-readable-byte.md ########## @@ -0,0 +1,88 @@ +--- +id: human-readable-byte +title: "Human-readable Byte Configuration Reference" +--- + +<!-- + ~ 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. + --> + + +This page documents all configuration properties related to bytes. + +These properties can be configured through 2 ways: +1. a simple number in byte +2. a number with a unit suffix + +## A number in byte + +Given the cache size is 3G, there's a configuration as below + +```properties +# 3G bytes = 3_000_000_000 bytes +druid.cache.sizeInBytes=3000000000 +``` + + +## A number with a unit suffix + +Sometimes value in byte could be very large in Druid, it's counterintuitive to set value of these properties as above. +Here comes another way, a number with a unit suffix. Review comment: Hmm.. I'm not sure whether or not `counterintuitive` is being used correctly here. AFAIK, it means something which doesn't seems true intuitively but is actually true. Maybe it would be more clear by rephrasing this paragraph to `When you have to put a large number for some configuration, it is easy to make a mistake such as extra or missing 0s. Druid supports a better way, a number with a unit suffix.` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
