forked from linkedin/venice
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[all][server][dvc] Fast-avro upgrade, fix meta system store schema up…
…date issue and partition size race condition (linkedin#690) * [all][server][dvc] Fast-avro upgrade, fix meta system store schema update issue and partition size race condition This code change includes several fixes: 1. Bump up fast-avro lib tot pick up the recent serde optimizations. 2. Fix the meta system store schema race condition issue in Venice Server. Previously, the update schema may not be available for the latest superset schema since there is a delay between registering superset schema and its derived schema. The fix will always retrieve a latest value schema with a valid derived schema. 3. Use RocksDB API to fetch partition size to avoid the following race condition: RocksDB log compaction can delete file in the middle of measuring the directory size. 4. Let 'fast.avro.field.limit.per.method' to control fast serializer size as well.
- Loading branch information
Showing
8 changed files
with
88 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...al/venice-common/src/test/java/com/linkedin/venice/meta/TestReadOnlySchemaRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.linkedin.venice.meta; | ||
|
||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
import com.linkedin.venice.exceptions.VeniceException; | ||
import com.linkedin.venice.schema.SchemaEntry; | ||
import com.linkedin.venice.schema.writecompute.DerivedSchemaEntry; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import org.testng.Assert; | ||
import org.testng.annotations.Test; | ||
|
||
|
||
public class TestReadOnlySchemaRepository { | ||
@Test | ||
public void testGetLatestDerivedSchema() { | ||
String storeName = "test_store"; | ||
// Latest value schema has a derived schema | ||
SchemaEntry latestValueSchema = new SchemaEntry(1, "\"string\""); | ||
ReadOnlySchemaRepository repository1 = mock(ReadOnlySchemaRepository.class); | ||
when(repository1.getSupersetOrLatestValueSchema(storeName)).thenReturn(latestValueSchema); | ||
DerivedSchemaEntry derivedSchemaEntry = new DerivedSchemaEntry(1, 1, "\"string\""); | ||
when(repository1.getLatestDerivedSchema(storeName, 1)).thenReturn(derivedSchemaEntry); | ||
when(repository1.getLatestDerivedSchema(storeName)).thenCallRealMethod(); | ||
|
||
Assert.assertEquals(repository1.getLatestDerivedSchema(storeName), derivedSchemaEntry); | ||
|
||
// Latest value schema doesn't have a corresponding derived schema. | ||
SchemaEntry latestSupersetSchema = new SchemaEntry(10, "\"string\""); | ||
ReadOnlySchemaRepository repository2 = mock(ReadOnlySchemaRepository.class); | ||
when(repository2.getSupersetOrLatestValueSchema(storeName)).thenReturn(latestSupersetSchema); | ||
when(repository2.getLatestDerivedSchema(storeName, 10)).thenThrow(new VeniceException("No derived schema")); | ||
List<DerivedSchemaEntry> derivedSchemaEntryList = new ArrayList<>(); | ||
DerivedSchemaEntry latestDerivedSchema = new DerivedSchemaEntry(9, 2, "\"string\""); | ||
derivedSchemaEntryList.add(new DerivedSchemaEntry(8, 1, "\"string\"")); | ||
derivedSchemaEntryList.add(new DerivedSchemaEntry(8, 2, "\"string\"")); | ||
derivedSchemaEntryList.add(latestDerivedSchema); | ||
derivedSchemaEntryList.add(new DerivedSchemaEntry(9, 1, "\"string\"")); | ||
when(repository2.getDerivedSchemas(storeName)).thenReturn(derivedSchemaEntryList); | ||
|
||
when(repository2.getLatestDerivedSchema(storeName)).thenCallRealMethod(); | ||
|
||
Assert.assertEquals(repository2.getLatestDerivedSchema(storeName), latestDerivedSchema); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters