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

Cleaning up getTableName() for segment metadata #4289

Merged
merged 2 commits into from
Jun 11, 2019

Conversation

snleee
Copy link
Contributor

@snleee snleee commented Jun 7, 2019

Removing unnecessary calls to segmentMetadata.getTableName()

After this change, only 3 places will call segmentMetadata.getTableName():

  1. From upload API, derive table name from segment metadata that is being uploaded
  2. ZKMetadataUtil.updateSegmentMetadata() - updating segment zk metadata from segment metadata during segment upload
  3. ColumnarToStarTreeConverter provides table name to generator config from segment metadata.

@snleee snleee force-pushed the segment-metadata-tablename-cleanup branch 3 times, most recently from a64b460 to 33c9fab Compare June 7, 2019 14:03
Removing unnecessary calls to segmentMetadata.getTableName()
@snleee snleee force-pushed the segment-metadata-tablename-cleanup branch from 33c9fab to 25628d1 Compare June 7, 2019 14:16
@codecov-io
Copy link

codecov-io commented Jun 7, 2019

Codecov Report

Merging #4289 into master will decrease coverage by 0.2%.
The diff coverage is 84.48%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #4289      +/-   ##
============================================
- Coverage     67.29%   67.09%   -0.21%     
  Complexity       20       20              
============================================
  Files          1040     1041       +1     
  Lines         51662    51713      +51     
  Branches       7238     7247       +9     
============================================
- Hits          34767    34696      -71     
- Misses        14507    14651     +144     
+ Partials       2388     2366      -22
Impacted Files Coverage Δ Complexity Δ
...re/segment/virtualcolumn/VirtualColumnContext.java 100% <ø> (+8.33%) 0 <0> (ø) ⬇️
...helix/core/sharding/BucketizedSegmentStrategy.java 0% <0%> (ø) 0 <0> (ø) ⬇️
.../pinot/controller/api/upload/SegmentValidator.java 65.38% <100%> (-0.66%) 0 <0> (ø)
...indexsegment/immutable/ImmutableSegmentLoader.java 92.15% <100%> (-0.16%) 0 <0> (ø)
.../core/indexsegment/mutable/MutableSegmentImpl.java 81.04% <100%> (ø) 0 <0> (ø) ⬇️
...apache/pinot/controller/api/upload/ZKOperator.java 72.52% <100%> (-0.3%) 0 <0> (ø)
.../sharding/BalanceNumSegmentAssignmentStrategy.java 90.62% <100%> (-0.29%) 0 <0> (ø)
...harding/ReplicaGroupSegmentAssignmentStrategy.java 100% <100%> (ø) 0 <0> (ø) ⬇️
...ntroller/helix/core/PinotHelixResourceManager.java 62.51% <100%> (-0.7%) 0 <0> (ø)
...pache/pinot/minion/executor/PurgeTaskExecutor.java 69.56% <100%> (ø) 0 <0> (ø) ⬇️
... and 37 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 7566790...2cb74a1. Read the comment docs.

@Jackie-Jiang
Copy link
Contributor

Can you add more descriptions? The only time when you call SegmentMetadata.getTableName() is during segment push?

@snleee
Copy link
Contributor Author

snleee commented Jun 10, 2019

Can you add more descriptions? The only time when you call SegmentMetadata.getTableName() is during segment push?

I have updated the commit message.

  1. is required.
  2. and 3. is required for backward compatibility (writing table.name to segment zk metadata or segment metadata). We can remove them when we decide to remove tableName completely from the segment metadata.

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.

Can we mark segmentMetadata.getTableName() with @ deprecated?

minor suggestions, other than that lgtm

@@ -303,35 +303,37 @@ private SuccessResponse uploadSegment(FormDataMultiPart multiPart, boolean enabl
throw new UnsupportedOperationException("Unsupported upload type: " + uploadType);
}

String rawTableName = segmentMetadata.getTableName();
Copy link
Contributor

Choose a reason for hiding this comment

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

final?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All other temporary variables in the same code block is not using final. Do you think that we still need final?

}

String clientAddress = InetAddress.getByName(request.getRemoteAddr()).getHostName();
String segmentName = segmentMetadata.getName();
String offlineTableName = TableNameBuilder.OFFLINE.tableNameWithType(segmentMetadata.getTableName());
String offlineTableName = TableNameBuilder.OFFLINE.tableNameWithType(rawTableName);
Copy link
Contributor

Choose a reason for hiding this comment

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

final?

@snleee
Copy link
Contributor Author

snleee commented Jun 10, 2019

Can we mark segmentMetadata.getTableName() with @ deprecated?

minor suggestions, other than that lgtm

As we discussed offline, I will deprecate tableName from segment zk metadata, not from segment metadata with another pr.

@snleee snleee merged commit 3ae95ba into apache:master Jun 11, 2019
@snleee snleee deleted the segment-metadata-tablename-cleanup branch June 11, 2019 00:46
snleee pushed a commit to snleee/pinot that referenced this pull request Jun 14, 2019
This is a follow up work for apache#4288 and apache#4289

1. Added deprecated annotation for segment metadata & segment
   zk metadata.
2. Remove all getTableName & setTableName usages from testing code

- There is no usage of getTableName() for segment zk metadata except
the case where we fill segment metadata from segment zk metadata
for realtime segment creation.
- For segment metadata, the only usage is during the segment upload
- We still write segment name to both segment zk metadata and segment
  metadata for rollback support.
snleee pushed a commit to snleee/pinot that referenced this pull request Jun 14, 2019
This is a follow up work for apache#4288 and apache#4289

1. Added deprecated annotation for segment zk metadata.
2. Remove all getTableName & setTableName usages from testing code

- There is no usage of getTableName() for segment zk metadata except
the case where we fill segment metadata from segment zk metadata
for realtime segment creation.
- For segment metadata, the only usage is during the segment upload
- We still write segment name to both segment zk metadata and segment
  metadata for rollback support.
snleee pushed a commit that referenced this pull request Jun 18, 2019
* Add deprecated annotation for segment zk metadata

This is a follow up work for #4288 and #4289

1. Added deprecated annotation for segment zk metadata.
2. Remove all getTableName & setTableName usages from testing code

- There is no usage of getTableName() for segment zk metadata except
the case where we fill segment metadata from segment zk metadata
for realtime segment creation.
- For segment metadata, the only usage is during the segment upload
- We still write segment name to both segment zk metadata and segment
  metadata for rollback support.

* Addressing comments
@snleee
Copy link
Contributor Author

snleee commented Jul 24, 2019

#4468

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.

4 participants