Repository navigation
Conversation
| + " log_payload %3$s,\n" | ||
| + " %3$s_id VARCHAR(255) DEFAULT NULL,\n" | ||
| + " log_payload_id VARCHAR(255) NOT NULL,\n" | ||
| + " log_payload_order SMALLINT NOT NULL,\n" |
There was a problem hiding this comment.
Does this require SQL upgrades on metadata storage?
There was a problem hiding this comment.
Oh, yes. I added labels.
There was a problem hiding this comment.
I don't think you can roll back to a prior version in this proposed implementation. Can you change it so that you can roll back and forward across a version with this patch?
There was a problem hiding this comment.
Hmm, probably it's possible. But the tasklogs table is only used for a single API to get segments generated by a task (https://github.com/druid-io/druid/blob/master/docs/content/design/indexing-service.md#submitting-tasks-and-querying-task-status). I think supporting rolling back might be too complicated for this single usage. Maybe it makes sense to note this incompatible change properly and users should drop and create tasklogs table if they want to roll back in the release notes. What do you think?
There was a problem hiding this comment.
I think it'd be best to create a new table.
It's annoying, but, metadata schema changes are super disruptive, so I think it's worth the extra work.
There was a problem hiding this comment.
That's a nice solution. I'll update PR soon.
There was a problem hiding this comment.
Thanks. If you do that, then we can remove the "incompatible" tag. And let's all take a bit to consider the schema of the new table, so we don't need to do this again :)
There was a problem hiding this comment.
Updated to use a new table.
I also changed the configuration name for the task audit logs from druid.metadata.storage.tables.taskLogTable to druid.metadata.storage.tables.taskActionsTable to avoid a case that users accidentally use the same name for the new table with the old one which will cause errors. I think this should be still labeled as 'incompatible' because of this configuration change.
| + " id %2$s NOT NULL,\n" | ||
| + " %4$s_id VARCHAR(255) DEFAULT NULL,\n" | ||
| + " log_payload %3$s,\n" | ||
| + " %3$s_id VARCHAR(255) DEFAULT NULL,\n" |
There was a problem hiding this comment.
Will the entry_id ever be null? Maybe it can have NOT NULL in the schema as well
| catch (IOException e) { | ||
| log.makeAlert(e, "Failed to deserialize log") | ||
| .addData("entryId", entryId) | ||
| .addData("payload", StringUtils.fromUtf8(payload)) |
There was a problem hiding this comment.
I wonder if this is too big for a log message, given that these payloads can be several MB
|
It does seem a little weird to me to use the metadata store to hold split chunks of a large binary payload across multiple rows. This would be a bigger design change, but I wonder if it would be better to keep the task action audit logs in deep storage instead, in a per-task file keyed by task ID. It doesn't look like Druid uses this audit table internally for any internal decision making. |
That's a good point. It might be a good idea if we need to store audit logs. @gianm any thoughts? |
Honestly, the only reason that API exists is because when I was originally building the task action system, I thought it might be cool to see what segments a task created. I didn't have a specific use case in mind. I am not sure if anyone in the community has built anything interesting around it since then or not.
Storing audit logs in deep storage (like task reports) seems like a better idea to me than the metadata store. I suppose each one would need to be its own file. I would support moving them there, and maybe making them optional. I think they should be off by default -- they aren't too useful and they'll create a lot of extra files on deep storage (which people sometimes try to minimize, especially if they're on a system like hdfs where it's tough to scale to large numbers of files). |
That sounds good to me. I'll update this PR soon. Thanks @jon-wei and @gianm. |
|
Hmm, I've been thinking about this and would like to revert all changes in this PR and reduce this PR's scope to disable audit logging by default. The reasons are
|
|
@jihoonson That sounds reasonable. I agree that it's not worth the effort to migrate the whole audit log system to use deep storage given the various design considerations you mentioned, and the workaround is not too complex or burdensome. |
|
Closing this in favor of #5859. |
LocalTaskActionClientadds an audit log whenever it is submitted if the action should be audited. Here is the code snippet.The
addAuditLog()method internally inserts the byte-serialized taskAction to the metastore.This can make actions failed if they are too large. One of the example of such large actions can be found in batch ingestion: if input data is very large, there can be a lot of segments to be published. HadoopIndexTask currently workarounds this issue by publishing segments per interval like below, but this is a temporal solution and there should be the same issue if there are too many segments per interval.
This PR is to allow multiple rows for the same action, so that we can avoid such failures.
This change is