<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div name="messageBodySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;">Here is a full run of it. I am working on the open source project cqerl:
<div><br /></div>
<div>
<div>(NODE)19> [Test] = ets:match_object(cqerl_clusters, {'_', '_', {Node, '$1'}}).</div>
<div>[{cluster_table,'$primary_cluster',</div>
<div> {{{192,168,1,104},9042},</div>
<div> [{cassandra_nodes,[{<<"192.168.1.107">>,9042},</div>
<div> {<<"192.168.1.104">>,9042}]},</div>
<div> {keyspace,devices},</div>
<div> {included_applications,[]},</div>
<div> {reconnect_interval,12}]}}]</div>
<div>(NODE)20> ets:delete_object(cqerl_clusters, Test). </div>
<div>** exception error: bad argument</div>
<div> in function ets:delete_object/2</div>
<div> called as ets:delete_object(cqerl_clusters,</div>
<div> {cluster_table,'$primary_cluster',</div>
<div> {{{192,168,1,104},9042},</div>
<div> [{cassandra_nodes,[{<<"192.168.1.107">>,9042},</div>
<div> {<<"192.168.1.104">>,9042}]},</div>
<div> {keyspace,devices},</div>
<div> {included_applications,[]},</div>
<div> {reconnect_interval,12}]}})</div>
<div>(NODE)21> ets:delete_object(cqerl_clusters, [Test]).</div>
<div>** exception error: bad argument</div>
<div> in function ets:delete_object/2</div>
<div> called as ets:delete_object(cqerl_clusters,</div>
<div> [{cluster_table,'$primary_cluster',</div>
<div> {{{192,168,1,104},9042},</div>
<div> [{cassandra_nodes,[{<<"192.168.1.107">>,9042},</div>
<div> {<<"192.168.1.104">>,9042}]},</div>
<div> {keyspace,devices},</div>
<div> {included_applications,[]},</div>
<div> {reconnect_interval,12}]}}])</div>
</div>
<div><br /></div>
<div>Cant figure why the match is working but not the delete..</div>
</div>
<div name="messageReplySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;"><br />
On Jul 13, 2018, 11:01 AM -0400, Code Wiget <codewiget95@gmail.com>, wrote:<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #1abc9c;">
<div name="messageBodySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;">
<div>Here, it seems alive</div>
<div><br /></div>
<div>(NODE13> ets:info(table_name).</div>
<div>[{read_concurrency,true},</div>
<div> {write_concurrency,false},</div>
<div> {compressed,false},</div>
<div> {memory,422},</div>
<div> {owner,<0.1064.0>},</div>
<div> {heir,none},</div>
<div> {name,cqerl_clusters},</div>
<div> {size,2},</div>
<div> {node,’NODE'},</div>
<div> {named_table,true},</div>
<div> {type,bag},</div>
<div> {keypos,2},</div>
<div> {protection,protected}]</div>
<div><br /></div>
</div>
<div name="messageReplySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;"><br />
On Jul 13, 2018, 7:24 AM -0400, Sverker Eriksson <sverker.eriksson@ericsson.com>, wrote:<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #e67e22;">
<div>Your ets:match_delete looks fine.</div>
<div>Are you sure the table is still alive? Try ets:info(table_name).</div>
<div><br /></div>
<div>When you get an exception in the Erlang shell, the shell process will terminate and be restarted</div>
<div>losing all process specific resources such as ets tables.</div>
<div><br /></div>
<div><br /></div>
<div>/Sverker, Erlang/OTP</div>
<div><br /></div>
<div><br /></div>
<div>On tor, 2018-07-12 at 16:35 -0400, Code Wiget wrote:</div>
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #3498db;">
<div name="messageBodySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;">Hey everyone,
<div><br /></div>
<div>Lets say you have an ets table with entries as shown below:</div>
<div><br /></div>
<div>{table_name, key, {A, [B]}. </div>
<div><br /></div>
<div>I am trying to delete all table entries matching A. I can create a match like so:</div>
<div><br /></div>
<div>ets:match(table_name, {'_', '_', {Node, '$1'}}) </div>
<div><br /></div>
<div>and it returns the values for B. But when I run match_delete or select_delete, I get a badarg error…:<br /></div>
<div><br /></div>
<blockquote style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #d35400;">
<div>
<div>ets:match_delete(table_name, {'_', '_', {Node, '$1'}}).</div>
</div>
<div>
<div>** exception error: bad argument</div>
</div>
<div>
<div> in function ets:select_delete/2</div>
</div>
<div>
<div> called as ets:select_delete(table_name,</div>
</div>
<div>
<div> [{{'_','_',{{{192,168,1,104},9042},'$1'}},[],[true]}])</div>
</div>
<div>
<div> in call from ets:match_delete/2 (ets.erl, line 726)</div>
</div>
<div>
<div>(NODE)16> ets:select_delete(table_name, {'_', '_', {Node, '$1'}}).</div>
</div>
<div>
<div>** exception error: bad argument</div>
</div>
<div>
<div> in function ets:select_delete/2</div>
</div>
<div>
<div> called as ets:select_delete(table_name,{'_','_',{{{192,168,1,104},9042},'$1'}})</div>
</div>
</blockquote>
<div>
<div><br /></div>
<div>So I tried to match and object and delete it...</div>
<div><br /></div>
</div>
<blockquote style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #d35400;">
<div>
<div>(NODE)17> ets:match_object(table_name, {'_', '_', {Node, '$1'}}). </div>
</div>
<div>
<div>[{table_name,'$primary_cluster',</div>
</div>
<div>
<div> Info…]</div>
</div>
<div><br /></div>
<div><br /></div>
<div>
<div>(NODE)25> ets:delete_object(table_name, Info). </div>
</div>
<div>
<div>** exception error: bad argument</div>
</div>
<div>
<div> in function ets:delete_object/2</div>
</div>
<div>
<div> called as ets:delete_object(table_name, …. )</div>
</div>
<div><br /></div>
</blockquote>
I would like to avoid re-creating the table structure, as it is not from a project that I created and would take some time to fix all the code. How do I delete something from this table?
<div><br /></div>
<div>Thanks!<br />
<div><br /></div>
</div>
</div>
<div name="messageReplySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;"><br />
<div></div>
</div>
<pre>_______________________________________________
erlang-questions mailing list
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>
<a href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a>
</pre></blockquote>
_______________________________________________<br />
erlang-questions mailing list<br />
erlang-questions@erlang.org<br />
http://erlang.org/mailman/listinfo/erlang-questions<br /></blockquote>
<div></div>
</div>
</blockquote>
<div></div>
</div>
</body>
</html>