Hello Alexey Serbin, Kudu Jenkins, Adar Dembo,

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/14263

to look at the new patch set (#3).

Change subject: KUDU-2842: don't reference CowLock state from TSInfosDict
......................................................................

KUDU-2842: don't reference CowLock state from TSInfosDict

The following race was previously possible:

Tablet A belongs to table T
1. T1: receive GetTableLocations for table T
2. T1: lock A in READ mode
3. T1: add StringPiece(A) => TSInfoPB to dict, where StringPiece(A) points
       to the CowLock state
4. T1: unlock A in READ mode
5. T2: receive ProcessFullTabletReport that has an updated cstate for A
6. T2: lock A in WRITE mode
7. T2: COMMIT mutation to A based on the report, blowing away old in-memory
       CowLock state, and unlock A
8. T1: try to update dict, but key StringPiece(A) is corrupted

This patch addresses this by making the following change:

3. T1: add StringPiece(A) => TSInfoPB to dict, where StringPiece(A)
       points into the TSInfoPB

This patch adds a variant of the ComputeIfAbsent() map utility that
facilitates this self-referential map insertion.

Testing:
- adds a test for the new map function
- piggy-backs on an existing test, adding in some concurrent proxy
  calls, to test the reported race
- I also reran the benchmark posted in 586e957f7 to verify this doesn't regress
  performance

With this patch:
================
Count: 57230
Mean: 1341.46
Percentiles:
   0%  (min) = 69
  25%        = 772
  50%  (med) = 1408
  75%        = 1728
  95%        = 2240
  99%        = 2736
  99.9%      = 3616
  99.99%     = 5440
  100% (max) = 11976

Without this patch:
===================
Count: 56325
Mean: 1360.05
Percentiles:
   0%  (min) = 122
  25%        = 980
  50%  (med) = 1408
  75%        = 1712
  95%        = 2192
  99%        = 2656
  99.9%      = 3392
  99.99%     = 5088
  100% (max) = 8544

Change-Id: I30f4cd2eb8439e1923c1c2617248514354561d16
---
M src/kudu/gutil/map-util.h
M src/kudu/integration-tests/ts_tablet_manager-itest.cc
M src/kudu/master/catalog_manager.cc
M src/kudu/util/map-util-test.cc
4 files changed, 135 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/63/14263/3
--
To view, visit http://gerrit.cloudera.org:8080/14263
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I30f4cd2eb8439e1923c1c2617248514354561d16
Gerrit-Change-Number: 14263
Gerrit-PatchSet: 3
Gerrit-Owner: Andrew Wong <[email protected]>
Gerrit-Reviewer: Adar Dembo <[email protected]>
Gerrit-Reviewer: Alexey Serbin <[email protected]>
Gerrit-Reviewer: Andrew Wong <[email protected]>
Gerrit-Reviewer: Kudu Jenkins (120)

Reply via email to