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

[POC] [AbfsInputStream] Add position and reader type in tracing context #129

Draft
wants to merge 8 commits into
base: wasbDepCodeReview
Choose a base branch
from

Conversation

anujmodi2021
Copy link
Collaborator

Tracing header will have 2 more things:

  1. Read position
  2. Reader Type: Normal or Prefetch

Note some tracing validator tests are failing but functional tests are working fine and header is constructed as expected.

Copy link
Collaborator

@saxenapranav saxenapranav left a comment

Choose a reason for hiding this comment

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

Great code!

readRemote does create new tracingContext object before going to client.

Since, we are adding properties in realtime on singleton tracingContext, I feel corruption can happen. What if on the given FS op on inputStream, we create child tracingContext before adding any property to it.

}

public void sendReadMetrics(TracingContext tracingContext) throws IOException {
if (!abfsConfiguration.isReadCallsMetricEnabled() || readMetricData.length() == 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since readMetricData is init with some string, length should not be 0. i think we can remove it.

Comment on lines +1240 to +1242
createReadMetircFile(readMetricFileName, tracingContext1);
appendToReadMetricFile(readMetricFileName, tracingContext1);
flushReadMetricFile(readMetricFileName, tracingContext1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since we are at client level, what if we directly call createPath, append, flush.

@@ -562,6 +575,8 @@ int readRemote(long position, byte[] b, int offset, int length, TracingContext t
streamStatistics.remoteReadOperation();
}
LOG.trace("Trigger client.read for path={} position={} offset={} length={}", path, position, offset, length);
tracingContext.getHeader();
Copy link
Collaborator

Choose a reason for hiding this comment

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

hope its not required.

@@ -211,6 +212,8 @@ public int read(long position, byte[] buffer, int offset, int length)
if (streamStatistics != null) {
streamStatistics.readOperationStarted();
}
LOG.debug("Direct read with position called, no Optimizations");
tracingContext.setReaderID("NR");
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should have a new tracingContext object in the method, else parallel thread would use same tc and probably metric-corruption can happen.

Comment on lines +626 to +630
if (firstRead && n > 0) {
tracingContext.setFirstReadPosition(AbfsClient.getNormalizedValue(n, 4 * ONE_MB));
tracingContext.setFirstReadPositionFromEnd(AbfsClient.getNormalizedValue(contentLength - n, 4 * ONE_MB));
} else {
tracingContext.setFirstReadPosition("");
Copy link
Collaborator

Choose a reason for hiding this comment

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

this might reflect on all the calls post seek. Any way if we can reset it.

} finally {
this.isSendMetricCall = false;
}
}

public void updateReadMetrics(String inputStreamId, int bufferLength, int requestedLength, long contentLength, long nextReadPos, boolean firstRead) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

lets have it synchronized.

@anujmodi2021 anujmodi2021 changed the title [AbfsInputStream] Add position and reader type in tracing context [POC] [AbfsInputStream] Add position and reader type in tracing context Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants