Vihang Karajgaonkar has uploaded a new patch set (#5). ( 
http://gerrit.cloudera.org:8080/12789 )

Change subject: IMPALA-8312 : Alter database operations have race condition
......................................................................

IMPALA-8312 : Alter database operations have race condition

This patch fixes a race condition in the alter database implementation
in the catalogOpExecutor. The original implementation did a in-place
modification of the metastore database object in the Db. This can lead to
partially updated database object becoming visible to a reading thread causing
potential problems. In order to fix the race, the patch makes a copy of the
existing database object, modifies the copy and then atomically switches
the actual database object with the modified copy. This is done while
holding the metastoreddlLock, and then taking the write lock on the
catalog version object which makes it consistent with the other catalog
write operations.

Added a test which consistently reproduces the race. The test creating many
reader threads and a writer thread which continuously keeps changing the
owner name and its type by issuing a alter database operation. The test fails
without the patch. After the patch the test passes. The race also
applies to the alter database set comment operation, although its hard
to write a test for that code-path.

Change-Id: I32c8c96a6029bf9d9db37ea8315f6c9603b5a2fc
---
M fe/src/main/java/org/apache/impala/catalog/CatalogServiceCatalog.java
M fe/src/main/java/org/apache/impala/catalog/Db.java
M fe/src/main/java/org/apache/impala/service/CatalogOpExecutor.java
A fe/src/test/java/org/apache/impala/catalog/AlterDatabaseTest.java
4 files changed, 288 insertions(+), 28 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/89/12789/5
--
To view, visit http://gerrit.cloudera.org:8080/12789
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I32c8c96a6029bf9d9db37ea8315f6c9603b5a2fc
Gerrit-Change-Number: 12789
Gerrit-PatchSet: 5
Gerrit-Owner: Vihang Karajgaonkar <vih...@cloudera.com>
Gerrit-Reviewer: Bharath Vissapragada <bhara...@cloudera.com>
Gerrit-Reviewer: Fredy Wijaya <fwij...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <impala-public-jenk...@cloudera.com>

Reply via email to