You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/08/02 03:34:43 UTC

[GitHub] [inlong] pocozh commented on a diff in pull request #5261: [INLONG-5259][Agent] File data sources support custom end-of-line symbols

pocozh commented on code in PR #5261:
URL: https://github.com/apache/inlong/pull/5261#discussion_r934507923


##########
inlong-agent/agent-core/src/main/java/org/apache/inlong/agent/core/trigger/TriggerManager.java:
##########
@@ -120,9 +120,13 @@ public boolean submitTrigger(TriggerProfile triggerProfile) {
      */
     public void preprocessTrigger(TriggerProfile profile) {
         String syncType = profile.get(JobConstants.JOB_FILE_COLLECT_TYPE, "");
-        if (FileCollectType.FULL.equals(syncType)) {
-            LOGGER.info("Initialize submit full path. trigger {} ", profile.getTriggerId());
-            manager.getJobManager().submitFileJobProfile(profile);
+        switch (FileConstants.valueOf(syncType)) {
+            case FULL:
+            case INCREMENT:

Review Comment:
   Why `INCREMENT` mode needs  being preprocessed here?



##########
inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/reader/TextFileReader.java:
##########
@@ -140,7 +161,26 @@ public void setWaitMillisecond(long millis) {
 
     @Override
     public String getSnapshot() {
-        return StringUtils.EMPTY;
+        if (Objects.nonNull(localSnapshot)) {
+            return file.getPath() + JOB_OFFSET_DELIMITER_TASK + localSnapshot.getSnapshot();

Review Comment:
   It's better to add ut to verify offsets of multi tasks while custom end-of-line symbols



##########
inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/TextFileSource.java:
##########
@@ -76,6 +84,28 @@ public List<Reader> split(JobProfile jobConf) {
         return result;
     }
 
+    @Override
+    public void initSourceMeta(JobProfile jobProfile) {
+        this.sourceMetas = MetaDataUtils.getSourceMeta(jobProfile);
+    }
+
+    private int getSeekPosition(JobProfile jobConf, File file) {
+        int seekPosition;
+        if (jobConf.hasKey(JobConstants.JOB_FILE_COLLECT_TYPE) && FileConstants.INCREMENT.name()

Review Comment:
   What about `FULL` mode?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org