-
Notifications
You must be signed in to change notification settings - Fork 57
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
SNOW-1497358 Support multiple storage for Iceberg mode #783
Merged
sfc-gh-alhuang
merged 12 commits into
iceberg-support
from
alhuang-iceberg-multiple-stages
Jul 11, 2024
Merged
Changes from 11 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
44cc28e
Support multiple stage for iceberg mode
sfc-gh-alhuang 30dda19
Refatcor API client
sfc-gh-alhuang c71f04a
fix test
sfc-gh-alhuang b6cc3c4
Fix request optional fields
sfc-gh-alhuang f54859f
Refactor
sfc-gh-alhuang c18c82e
cleanup configurerequest / configureresponse and separate out channel…
sfc-gh-hmadan a95626c
fix test & format
sfc-gh-alhuang 58b0776
Add remove storage method
sfc-gh-alhuang a88a524
Update storage
sfc-gh-alhuang a9c0fd0
update error message
sfc-gh-alhuang 4528682
update log message
sfc-gh-alhuang 76aadbb
Delete remove logic
sfc-gh-alhuang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (c) 2021 Snowflake Computing Inc. All rights reserved. | ||
* Copyright (c) 2021-2024 Snowflake Computing Inc. All rights reserved. | ||
*/ | ||
|
||
package net.snowflake.ingest.streaming.internal; | ||
|
@@ -101,4 +101,11 @@ void invalidateChannelIfSequencersMatch( | |
int getSize() { | ||
return cache.size(); | ||
} | ||
|
||
/** Get the number of channels for a given table */ | ||
int getSizePerTable(String fullyQualifiedTableName) { | ||
ConcurrentHashMap<String, SnowflakeStreamingIngestChannelInternal<T>> channelsMapPerTable = | ||
cache.get(fullyQualifiedTableName); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this thread safe? It's possible that the count changes between these two calls, right? |
||
return channelsMapPerTable == null ? 0 : channelsMapPerTable.size(); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
src/main/java/net/snowflake/ingest/streaming/internal/ChannelConfigureRequest.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,53 @@ | ||
/* | ||
* Copyright (c) 2024 Snowflake Computing Inc. All rights reserved. | ||
*/ | ||
|
||
package net.snowflake.ingest.streaming.internal; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
/** Class used to serialize the channel configure request. */ | ||
class ChannelConfigureRequest extends ConfigureRequest { | ||
@JsonProperty("database") | ||
private String database; | ||
|
||
@JsonProperty("schema") | ||
private String schema; | ||
|
||
@JsonProperty("table") | ||
private String table; | ||
|
||
/** | ||
* Constructor for channel configure request | ||
* | ||
* @param role Role to be used for the request. | ||
* @param database Database name. | ||
* @param schema Schema name. | ||
* @param table Table name. | ||
*/ | ||
ChannelConfigureRequest(String role, String database, String schema, String table) { | ||
setRole(role); | ||
this.database = database; | ||
this.schema = schema; | ||
this.table = table; | ||
} | ||
|
||
String getDatabase() { | ||
return database; | ||
} | ||
|
||
String getSchema() { | ||
return schema; | ||
} | ||
|
||
String getTable() { | ||
return table; | ||
} | ||
|
||
@Override | ||
public String getStringForLogging() { | ||
return String.format( | ||
"ChannelConfigureRequest(role=%s, db=%s, schema=%s, table=%s, file_name=%s)", | ||
getRole(), database, schema, table, getFileName()); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
src/main/java/net/snowflake/ingest/streaming/internal/ChannelConfigureResponse.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,46 @@ | ||
/* | ||
* Copyright (c) 2024 Snowflake Computing Inc. All rights reserved. | ||
*/ | ||
|
||
package net.snowflake.ingest.streaming.internal; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
/** Class used to deserialize responses from channel configure endpoint */ | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
class ChannelConfigureResponse extends StreamingIngestResponse { | ||
@JsonProperty("status_code") | ||
private Long statusCode; | ||
|
||
@JsonProperty("message") | ||
private String message; | ||
|
||
@JsonProperty("stage_location") | ||
private FileLocationInfo stageLocation; | ||
|
||
@Override | ||
Long getStatusCode() { | ||
return statusCode; | ||
} | ||
|
||
void setStatusCode(Long statusCode) { | ||
this.statusCode = statusCode; | ||
} | ||
|
||
String getMessage() { | ||
return message; | ||
} | ||
|
||
void setMessage(String message) { | ||
this.message = message; | ||
} | ||
|
||
FileLocationInfo getStageLocation() { | ||
return stageLocation; | ||
} | ||
|
||
void setStageLocation(FileLocationInfo stageLocation) { | ||
this.stageLocation = stageLocation; | ||
} | ||
} |
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
22 changes: 22 additions & 0 deletions
22
src/main/java/net/snowflake/ingest/streaming/internal/ClientConfigureRequest.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,22 @@ | ||
/* | ||
* Copyright (c) 2024 Snowflake Computing Inc. All rights reserved. | ||
*/ | ||
|
||
package net.snowflake.ingest.streaming.internal; | ||
|
||
/** Class used to serialize client configure request */ | ||
class ClientConfigureRequest extends ConfigureRequest { | ||
/** | ||
* Constructor for client configure request | ||
* | ||
* @param role Role to be used for the request. | ||
*/ | ||
ClientConfigureRequest(String role) { | ||
setRole(role); | ||
} | ||
|
||
@Override | ||
public String getStringForLogging() { | ||
return String.format("ClientConfigureRequest(role=%s, file_name=%s)", getRole(), getFileName()); | ||
} | ||
} |
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
38 changes: 38 additions & 0 deletions
38
src/main/java/net/snowflake/ingest/streaming/internal/ConfigureRequest.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,38 @@ | ||
/* | ||
* Copyright (c) 2024 Snowflake Computing Inc. All rights reserved. | ||
*/ | ||
|
||
package net.snowflake.ingest.streaming.internal; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
/** Abstract class for {@link ChannelConfigureRequest} and {@link ClientConfigureRequest} */ | ||
abstract class ConfigureRequest implements StreamingIngestRequest { | ||
@JsonProperty("role") | ||
private String role; | ||
|
||
// File name for the GCS signed url request | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@JsonProperty("file_name") | ||
private String fileName; | ||
|
||
String getRole() { | ||
return role; | ||
} | ||
|
||
void setRole(String role) { | ||
this.role = role; | ||
} | ||
|
||
String getFileName() { | ||
return fileName; | ||
} | ||
|
||
void setFileName(String fileName) { | ||
this.fileName = fileName; | ||
} | ||
|
||
@Override | ||
public abstract String getStringForLogging(); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.