[
https://issues.apache.org/jira/browse/DRILL-5660?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16103596#comment-16103596
]
ASF GitHub Bot commented on DRILL-5660:
---------------------------------------
Github user vdiravka commented on a diff in the pull request:
https://github.com/apache/drill/pull/877#discussion_r129834889
--- Diff:
exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetMetadataVersion.java
---
@@ -0,0 +1,130 @@
+/*
+ * 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.drill.exec.store.parquet;
+
+import org.apache.drill.common.exceptions.DrillRuntimeException;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+
+public class TestParquetMetadataVersion {
+
+ @Test
+ public void testCorrectOnlyMajorVersion() throws Exception {
+ MetadataVersion parsedMetadataVersion = new
MetadataVersion(MetadataVersion.Constants.V1);
+ MetadataVersion expectedMetadataVersion = new MetadataVersion(1, 0);
+ assertEquals("Parquet metadata version is parsed incorrectly",
expectedMetadataVersion, parsedMetadataVersion);
+ }
+
+ @Test
+ public void testCorrectMajorMinorVersions() throws Exception {
+ MetadataVersion parsedMetadataVersion = new
MetadataVersion(MetadataVersion.Constants.V3_1);
+ MetadataVersion expectedMetadataVersion = new MetadataVersion(3, 1);
+ assertEquals("Parquet metadata version is parsed incorrectly",
expectedMetadataVersion, parsedMetadataVersion);
+ }
+
+ @Test
+ public void testTwoDigitNumberMajorVersion() throws Exception {
+ String twoDigitNumberMajorVersion = "v10.2";
+ MetadataVersion parsedMetadataVersion = new
MetadataVersion(twoDigitNumberMajorVersion);
+ MetadataVersion expectedMetadataVersion = new MetadataVersion(10, 2);
+ assertEquals("Parquet metadata version is parsed incorrectly",
expectedMetadataVersion, parsedMetadataVersion);
+ }
+
+ @Test
+ public void testCorrectTwoDigitNumberMinorVersion() throws Exception {
+ String twoDigitNumberMinorVersion = "v3.10";
+ MetadataVersion parsedMetadataVersion = new
MetadataVersion(twoDigitNumberMinorVersion);
+ MetadataVersion expectedMetadataVersion = new MetadataVersion(3, 10);
+ assertEquals("Parquet metadata version is parsed incorrectly",
expectedMetadataVersion, parsedMetadataVersion);
+ }
+
+ @Test(expected = DrillRuntimeException.class)
+ public void testVersionWithoutFirstLetter() throws Exception {
+ String versionWithoutFirstLetter = "3.1";
+ try {
+ new MetadataVersion(versionWithoutFirstLetter);
+ } catch (DrillRuntimeException e) {
+ assertTrue("Not expected exception is obtained while parsing parquet
metadata version",
+ e.getMessage().contains("Could not parse metadata"));
+ throw new DrillRuntimeException(e);
--- End diff --
Missed that. Thanks.
Done
> Drill 1.10 queries fail due to Parquet Metadata "corruption" from DRILL-3867
> ----------------------------------------------------------------------------
>
> Key: DRILL-5660
> URL: https://issues.apache.org/jira/browse/DRILL-5660
> Project: Apache Drill
> Issue Type: Bug
> Affects Versions: 1.11.0
> Reporter: Paul Rogers
> Assignee: Vitalii Diravka
> Labels: doc-impacting
>
> Drill recently accepted a PR for the following bug:
> DRILL-3867: Store relative paths in metadata file
> This PR turned out to have a flaw which affects version compatibility.
> The DRILL-3867 PR changed the format of Parquet metadata files to store
> relative paths. All Drill servers after that PR create files with relative
> paths. But, the version number of the file is unchanged, so that older
> Drillbits don't know that they can't understand the file.
> Instead, if an older Drill tries to read the file, queries fail left and
> right. Drill will resolve the paths, but does so relative to the user's HDFS
> home directory, which is wrong.
> What should have happened is that we should have bumped the parquet metadata
> file version number so that older Drillbits can’t read the file. This ticket
> requests that we do that.
> Now, one could argue that the lack of version number change is fine. Once a
> user upgrades Drill, they won't use an old Drillbit. But, things are not that
> simple:
> * A developer tests a branch based on a pre-DRILL-3867 build on a cluster in
> which metadata files have been created by a post-DRILL-3867 build. (This has
> already occurred multiple times in our shop.)
> * A user tries to upgrade to Drill 1.11, finds an issue, and needs to roll
> back to Drill 1.10. Doing so will cause queries to fail due to
> seemingly-corrupt metadata files.
> * A user tries to do a rolling upgrade: running 1.11 on some servers, 1.10 on
> others. Once a 1.11 server is installed, the metadata is updated ("corrupted"
> from the perspective of 1.10) and queries fail.
> Standard practice in this scenario is to:
> * Bump the file version number when the file format changes, and
> * Software refuses to read files with a version newer than the software was
> designed for.
> Of course, it is highly desirable that newer servers read old files, but that
> is not the issue here.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)