Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add table level lock for segment upload #6165

Merged
merged 4 commits into from
Oct 23, 2020

Conversation

xiangfu0
Copy link
Contributor

@xiangfu0 xiangfu0 commented Oct 20, 2020

Description

Add table level lock for segment upload to avoid unnecessary race conditions to cause idealstates update failure when pushing new segments with high parallelism.

@xiangfu0 xiangfu0 force-pushed the add_table_lock_for_segment_upload branch from f3a94cc to 9ba9f4e Compare October 20, 2020 21:45
@xiangfu0 xiangfu0 marked this pull request as draft October 20, 2020 21:51
@codecov-io
Copy link

codecov-io commented Oct 20, 2020

Codecov Report

Merging #6165 into master will decrease coverage by 2.39%.
The diff coverage is 38.09%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6165      +/-   ##
==========================================
- Coverage   66.44%   64.05%   -2.40%     
==========================================
  Files        1075     1237     +162     
  Lines       54773    58482    +3709     
  Branches     8168     8655     +487     
==========================================
+ Hits        36396    37462    +1066     
- Misses      15700    18284    +2584     
- Partials     2677     2736      +59     
Flag Coverage Δ
#unittests 64.05% <38.09%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...e/pinot/broker/api/resources/PinotBrokerDebug.java 0.00% <0.00%> (-79.32%) ⬇️
...ot/broker/broker/AllowAllAccessControlFactory.java 71.42% <ø> (-28.58%) ⬇️
.../helix/BrokerUserDefinedMessageHandlerFactory.java 33.96% <0.00%> (-32.71%) ⬇️
...ava/org/apache/pinot/client/AbstractResultSet.java 53.33% <0.00%> (-3.81%) ⬇️
.../main/java/org/apache/pinot/client/Connection.java 35.55% <0.00%> (-13.29%) ⬇️
...inot/client/JsonAsyncHttpPinotClientTransport.java 10.90% <0.00%> (-51.10%) ⬇️
.../org/apache/pinot/client/ResultTableResultSet.java 0.00% <0.00%> (-34.29%) ⬇️
...not/common/assignment/InstancePartitionsUtils.java 73.80% <ø> (+0.63%) ⬆️
.../apache/pinot/common/exception/QueryException.java 90.27% <ø> (+5.55%) ⬆️
...pinot/common/function/AggregationFunctionType.java 98.27% <ø> (-1.73%) ⬇️
... and 1075 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 669bd59...27f84c4. Read the comment docs.

@xiangfu0 xiangfu0 force-pushed the add_table_lock_for_segment_upload branch 3 times, most recently from 8a02f09 to 145a314 Compare October 20, 2020 23:48
@xiangfu0 xiangfu0 marked this pull request as ready for review October 21, 2020 05:01
Copy link
Contributor

@Jackie-Jiang Jackie-Jiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. We can simplify the logic by using ConcurrentHashMap

@@ -1505,10 +1507,19 @@ public void deleteOfflineTable(String tableName) {
LOGGER.info("Deleting table {}: Removed table config", offlineTableName);

// Remove instance partitions
final String rawTableName = TableNameBuilder.extractRawTableName(tableName);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) we don't use final for local variable

@mcvsubbu
Copy link
Contributor

Discussed offline and suggested:

  1. Adding an array of locks
  2. Changing the helix update to not use the default backoff timer (that backs off for 1s and more exponentially). Throughput will suffer. Better to have smaller backoffs with randomness between 100 and 200ms (say), and more retries.

@xiangfu0 xiangfu0 force-pushed the add_table_lock_for_segment_upload branch 3 times, most recently from 1b9d2de to a17ea4c Compare October 22, 2020 22:07
@xiangfu0 xiangfu0 force-pushed the add_table_lock_for_segment_upload branch from a17ea4c to 7a10126 Compare October 22, 2020 22:11
Copy link
Contributor

@mcvsubbu mcvsubbu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor comment, otherwise lgtm

/**
* Delay policy with random delay between attempts.
*/
public class RandomDelayRetryPolicy extends BaseRetryPolicy {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this. This will be useful in other places as well.

@xiangfu0 xiangfu0 merged commit 5577e87 into master Oct 23, 2020
@xiangfu0 xiangfu0 deleted the add_table_lock_for_segment_upload branch October 23, 2020 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants